1 /* 2 * Copyright (C) 2017-2020 Red Hat 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License as 6 * published by the Free Software Foundation; either version 2 of the 7 * License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 17 * 02111-1307, USA. 18 */ 19 20 #ifndef META_CRTC_MODE_H 21 #define META_CRTC_MODE_H 22 23 #include <glib-object.h> 24 #include <stdint.h> 25 26 #include "core/util-private.h" 27 28 /* Same as KMS mode flags and X11 randr flags */ 29 typedef enum _MetaCrtcModeFlag 30 { 31 META_CRTC_MODE_FLAG_NONE = 0, 32 META_CRTC_MODE_FLAG_PHSYNC = (1 << 0), 33 META_CRTC_MODE_FLAG_NHSYNC = (1 << 1), 34 META_CRTC_MODE_FLAG_PVSYNC = (1 << 2), 35 META_CRTC_MODE_FLAG_NVSYNC = (1 << 3), 36 META_CRTC_MODE_FLAG_INTERLACE = (1 << 4), 37 META_CRTC_MODE_FLAG_DBLSCAN = (1 << 5), 38 META_CRTC_MODE_FLAG_CSYNC = (1 << 6), 39 META_CRTC_MODE_FLAG_PCSYNC = (1 << 7), 40 META_CRTC_MODE_FLAG_NCSYNC = (1 << 8), 41 META_CRTC_MODE_FLAG_HSKEW = (1 << 9), 42 META_CRTC_MODE_FLAG_BCAST = (1 << 10), 43 META_CRTC_MODE_FLAG_PIXMUX = (1 << 11), 44 META_CRTC_MODE_FLAG_DBLCLK = (1 << 12), 45 META_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13), 46 47 META_CRTC_MODE_FLAG_MASK = 0x3fff 48 } MetaCrtcModeFlag; 49 50 typedef struct _MetaCrtcModeInfo 51 { 52 grefcount ref_count; 53 54 int width; 55 int height; 56 float refresh_rate; 57 int64_t vblank_duration_us; 58 MetaCrtcModeFlag flags; 59 } MetaCrtcModeInfo; 60 61 #define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ()) 62 META_EXPORT_TEST 63 G_DECLARE_DERIVABLE_TYPE (MetaCrtcMode, meta_crtc_mode, 64 META, CRTC_MODE, 65 GObject) 66 67 struct _MetaCrtcModeClass 68 { 69 GObjectClass parent_class; 70 }; 71 72 #define META_TYPE_CRTC_MODE_INFO (meta_crtc_mode_info_get_type ()) 73 GType meta_crtc_mode_info_get_type (void); 74 75 META_EXPORT_TEST 76 MetaCrtcModeInfo * meta_crtc_mode_info_new (void); 77 78 META_EXPORT_TEST 79 MetaCrtcModeInfo * meta_crtc_mode_info_ref (MetaCrtcModeInfo *crtc_mode_info); 80 81 META_EXPORT_TEST 82 void meta_crtc_mode_info_unref (MetaCrtcModeInfo *crtc_mode_info); 83 84 G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaCrtcModeInfo, meta_crtc_mode_info_unref) 85 86 uint64_t meta_crtc_mode_get_id (MetaCrtcMode *crtc_mode); 87 88 const char * meta_crtc_mode_get_name (MetaCrtcMode *crtc_mode); 89 90 META_EXPORT_TEST 91 const MetaCrtcModeInfo * meta_crtc_mode_get_info (MetaCrtcMode *crtc_mode); 92 93 #endif /* META_CRTC_MODE_H */ 94