1 /* 2 * (C) Copyright 2008-2016 Fuzhou Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef _DRM_MODES_H 8 #define _DRM_MODES_H 9 10 #define DRM_DISPLAY_INFO_LEN 32 11 #define DRM_CONNECTOR_NAME_LEN 32 12 #define DRM_DISPLAY_MODE_LEN 32 13 #define DRM_PROP_NAME_LEN 32 14 15 #define DRM_MODE_TYPE_BUILTIN (1<<0) 16 #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) 17 #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) 18 #define DRM_MODE_TYPE_PREFERRED (1<<3) 19 #define DRM_MODE_TYPE_DEFAULT (1<<4) 20 #define DRM_MODE_TYPE_USERDEF (1<<5) 21 #define DRM_MODE_TYPE_DRIVER (1<<6) 22 23 /* Video mode flags */ 24 /* bit compatible with the xorg definitions. */ 25 #define DRM_MODE_FLAG_PHSYNC (1 << 0) 26 #define DRM_MODE_FLAG_NHSYNC (1 << 1) 27 #define DRM_MODE_FLAG_PVSYNC (1 << 2) 28 #define DRM_MODE_FLAG_NVSYNC (1 << 3) 29 #define DRM_MODE_FLAG_INTERLACE (1 << 4) 30 #define DRM_MODE_FLAG_DBLSCAN (1 << 5) 31 #define DRM_MODE_FLAG_CSYNC (1 << 6) 32 #define DRM_MODE_FLAG_PCSYNC (1 << 7) 33 #define DRM_MODE_FLAG_NCSYNC (1 << 8) 34 #define DRM_MODE_FLAG_HSKEW (1 << 9) /* hskew provided */ 35 #define DRM_MODE_FLAG_BCAST (1 << 10) 36 #define DRM_MODE_FLAG_PIXMUX (1 << 11) 37 #define DRM_MODE_FLAG_DBLCLK (1 << 12) 38 #define DRM_MODE_FLAG_CLKDIV2 (1 << 13) 39 40 #define DRM_MODE_CONNECTOR_Unknown 0 41 #define DRM_MODE_CONNECTOR_VGA 1 42 #define DRM_MODE_CONNECTOR_DVII 2 43 #define DRM_MODE_CONNECTOR_DVID 3 44 #define DRM_MODE_CONNECTOR_DVIA 4 45 #define DRM_MODE_CONNECTOR_Composite 5 46 #define DRM_MODE_CONNECTOR_SVIDEO 6 47 #define DRM_MODE_CONNECTOR_LVDS 7 48 #define DRM_MODE_CONNECTOR_Component 8 49 #define DRM_MODE_CONNECTOR_9PinDIN 9 50 #define DRM_MODE_CONNECTOR_DisplayPort 10 51 #define DRM_MODE_CONNECTOR_HDMIA 11 52 #define DRM_MODE_CONNECTOR_HDMIB 12 53 #define DRM_MODE_CONNECTOR_TV 13 54 #define DRM_MODE_CONNECTOR_eDP 14 55 #define DRM_MODE_CONNECTOR_VIRTUAL 15 56 #define DRM_MODE_CONNECTOR_DSI 16 57 58 #define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1) 59 #define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2) 60 #define DRM_EDID_PT_SEPARATE_SYNC (3 << 3) 61 #define DRM_EDID_PT_STEREO (1 << 5) 62 #define DRM_EDID_PT_INTERLACED (1 << 7) 63 64 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ 65 enum v4l2_colorspace { 66 /* 67 * Default colorspace, i.e. let the driver figure it out. 68 * Can only be used with video capture. 69 */ 70 V4L2_COLORSPACE_DEFAULT = 0, 71 72 /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */ 73 V4L2_COLORSPACE_SMPTE170M = 1, 74 75 /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */ 76 V4L2_COLORSPACE_SMPTE240M = 2, 77 78 /* Rec.709: used for HDTV */ 79 V4L2_COLORSPACE_REC709 = 3, 80 81 /* 82 * Deprecated, do not use. No driver will ever return this. This was 83 * based on a misunderstanding of the bt878 datasheet. 84 */ 85 V4L2_COLORSPACE_BT878 = 4, 86 87 /* 88 * NTSC 1953 colorspace. This only makes sense when dealing with 89 * really, really old NTSC recordings. Superseded by SMPTE 170M. 90 */ 91 V4L2_COLORSPACE_470_SYSTEM_M = 5, 92 93 /* 94 * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when 95 * dealing with really old PAL/SECAM recordings. Superseded by 96 * SMPTE 170M. 97 */ 98 V4L2_COLORSPACE_470_SYSTEM_BG = 6, 99 100 /* 101 * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601 102 * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG. 103 */ 104 V4L2_COLORSPACE_JPEG = 7, 105 106 /* For RGB colorspaces such as produces by most webcams. */ 107 V4L2_COLORSPACE_SRGB = 8, 108 109 /* AdobeRGB colorspace */ 110 V4L2_COLORSPACE_ADOBERGB = 9, 111 112 /* BT.2020 colorspace, used for UHDTV. */ 113 V4L2_COLORSPACE_BT2020 = 10, 114 115 /* Raw colorspace: for RAW unprocessed images */ 116 V4L2_COLORSPACE_RAW = 11, 117 118 /* DCI-P3 colorspace, used by cinema projectors */ 119 V4L2_COLORSPACE_DCI_P3 = 12, 120 }; 121 122 #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ 123 #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ 124 #define CRTC_NO_DBLSCAN (1 << 2) /* don't adjust doublescan */ 125 #define CRTC_NO_VSCAN (1 << 3) /* don't adjust doublescan */ 126 #define CRTC_STEREO_DOUBLE_ONLY (CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN) 127 128 #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF 129 130 struct drm_display_mode { 131 /* Proposed mode values */ 132 int clock; /* in kHz */ 133 int hdisplay; 134 int hsync_start; 135 int hsync_end; 136 int htotal; 137 int vdisplay; 138 int vsync_start; 139 int vsync_end; 140 int vtotal; 141 int vrefresh; 142 int vscan; 143 unsigned int flags; 144 int picture_aspect_ratio; 145 int hskew; 146 unsigned int type; 147 /* Actual mode we give to hw */ 148 int crtc_clock; /* in KHz */ 149 int crtc_hdisplay; 150 int crtc_hblank_start; 151 int crtc_hblank_end; 152 int crtc_hsync_start; 153 int crtc_hsync_end; 154 int crtc_htotal; 155 int crtc_hskew; 156 int crtc_vdisplay; 157 int crtc_vblank_start; 158 int crtc_vblank_end; 159 int crtc_vsync_start; 160 int crtc_vsync_end; 161 int crtc_vtotal; 162 }; 163 164 #endif 165