1*592ffb21SWarner Losh /* 2*592ffb21SWarner Losh * Copyright © 2006 Keith Packard 3*592ffb21SWarner Losh * Copyright © 2007-2008 Dave Airlie 4*592ffb21SWarner Losh * Copyright © 2007-2008 Intel Corporation 5*592ffb21SWarner Losh * Jesse Barnes <jesse.barnes@intel.com> 6*592ffb21SWarner Losh * 7*592ffb21SWarner Losh * Permission is hereby granted, free of charge, to any person obtaining a 8*592ffb21SWarner Losh * copy of this software and associated documentation files (the "Software"), 9*592ffb21SWarner Losh * to deal in the Software without restriction, including without limitation 10*592ffb21SWarner Losh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11*592ffb21SWarner Losh * and/or sell copies of the Software, and to permit persons to whom the 12*592ffb21SWarner Losh * Software is furnished to do so, subject to the following conditions: 13*592ffb21SWarner Losh * 14*592ffb21SWarner Losh * The above copyright notice and this permission notice shall be included in 15*592ffb21SWarner Losh * all copies or substantial portions of the Software. 16*592ffb21SWarner Losh * 17*592ffb21SWarner Losh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18*592ffb21SWarner Losh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19*592ffb21SWarner Losh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20*592ffb21SWarner Losh * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 21*592ffb21SWarner Losh * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22*592ffb21SWarner Losh * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23*592ffb21SWarner Losh * OTHER DEALINGS IN THE SOFTWARE. 24*592ffb21SWarner Losh */ 25*592ffb21SWarner Losh #ifndef __DRM_CRTC_H__ 26*592ffb21SWarner Losh #define __DRM_CRTC_H__ 27*592ffb21SWarner Losh 28*592ffb21SWarner Losh #include <dev/drm2/drm_mode.h> 29*592ffb21SWarner Losh 30*592ffb21SWarner Losh #include <dev/drm2/drm_fourcc.h> 31*592ffb21SWarner Losh 32*592ffb21SWarner Losh struct drm_device; 33*592ffb21SWarner Losh struct drm_mode_set; 34*592ffb21SWarner Losh struct drm_framebuffer; 35*592ffb21SWarner Losh struct drm_object_properties; 36*592ffb21SWarner Losh 37*592ffb21SWarner Losh 38*592ffb21SWarner Losh #define DRM_MODE_OBJECT_CRTC 0xcccccccc 39*592ffb21SWarner Losh #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 40*592ffb21SWarner Losh #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 41*592ffb21SWarner Losh #define DRM_MODE_OBJECT_MODE 0xdededede 42*592ffb21SWarner Losh #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 43*592ffb21SWarner Losh #define DRM_MODE_OBJECT_FB 0xfbfbfbfb 44*592ffb21SWarner Losh #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 45*592ffb21SWarner Losh #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 46*592ffb21SWarner Losh 47*592ffb21SWarner Losh struct drm_mode_object { 48*592ffb21SWarner Losh uint32_t id; 49*592ffb21SWarner Losh uint32_t type; 50*592ffb21SWarner Losh struct drm_object_properties *properties; 51*592ffb21SWarner Losh }; 52*592ffb21SWarner Losh 53*592ffb21SWarner Losh #define DRM_OBJECT_MAX_PROPERTY 24 54*592ffb21SWarner Losh struct drm_object_properties { 55*592ffb21SWarner Losh int count; 56*592ffb21SWarner Losh uint32_t ids[DRM_OBJECT_MAX_PROPERTY]; 57*592ffb21SWarner Losh uint64_t values[DRM_OBJECT_MAX_PROPERTY]; 58*592ffb21SWarner Losh }; 59*592ffb21SWarner Losh 60*592ffb21SWarner Losh /* 61*592ffb21SWarner Losh * Note on terminology: here, for brevity and convenience, we refer to connector 62*592ffb21SWarner Losh * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, 63*592ffb21SWarner Losh * DVI, etc. And 'screen' refers to the whole of the visible display, which 64*592ffb21SWarner Losh * may span multiple monitors (and therefore multiple CRTC and connector 65*592ffb21SWarner Losh * structures). 66*592ffb21SWarner Losh */ 67*592ffb21SWarner Losh 68*592ffb21SWarner Losh enum drm_mode_status { 69*592ffb21SWarner Losh MODE_OK = 0, /* Mode OK */ 70*592ffb21SWarner Losh MODE_HSYNC, /* hsync out of range */ 71*592ffb21SWarner Losh MODE_VSYNC, /* vsync out of range */ 72*592ffb21SWarner Losh MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ 73*592ffb21SWarner Losh MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ 74*592ffb21SWarner Losh MODE_BAD_WIDTH, /* requires an unsupported linepitch */ 75*592ffb21SWarner Losh MODE_NOMODE, /* no mode with a matching name */ 76*592ffb21SWarner Losh MODE_NO_INTERLACE, /* interlaced mode not supported */ 77*592ffb21SWarner Losh MODE_NO_DBLESCAN, /* doublescan mode not supported */ 78*592ffb21SWarner Losh MODE_NO_VSCAN, /* multiscan mode not supported */ 79*592ffb21SWarner Losh MODE_MEM, /* insufficient video memory */ 80*592ffb21SWarner Losh MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ 81*592ffb21SWarner Losh MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ 82*592ffb21SWarner Losh MODE_MEM_VIRT, /* insufficient video memory given virtual size */ 83*592ffb21SWarner Losh MODE_NOCLOCK, /* no fixed clock available */ 84*592ffb21SWarner Losh MODE_CLOCK_HIGH, /* clock required is too high */ 85*592ffb21SWarner Losh MODE_CLOCK_LOW, /* clock required is too low */ 86*592ffb21SWarner Losh MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ 87*592ffb21SWarner Losh MODE_BAD_HVALUE, /* horizontal timing was out of range */ 88*592ffb21SWarner Losh MODE_BAD_VVALUE, /* vertical timing was out of range */ 89*592ffb21SWarner Losh MODE_BAD_VSCAN, /* VScan value out of range */ 90*592ffb21SWarner Losh MODE_HSYNC_NARROW, /* horizontal sync too narrow */ 91*592ffb21SWarner Losh MODE_HSYNC_WIDE, /* horizontal sync too wide */ 92*592ffb21SWarner Losh MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ 93*592ffb21SWarner Losh MODE_HBLANK_WIDE, /* horizontal blanking too wide */ 94*592ffb21SWarner Losh MODE_VSYNC_NARROW, /* vertical sync too narrow */ 95*592ffb21SWarner Losh MODE_VSYNC_WIDE, /* vertical sync too wide */ 96*592ffb21SWarner Losh MODE_VBLANK_NARROW, /* vertical blanking too narrow */ 97*592ffb21SWarner Losh MODE_VBLANK_WIDE, /* vertical blanking too wide */ 98*592ffb21SWarner Losh MODE_PANEL, /* exceeds panel dimensions */ 99*592ffb21SWarner Losh MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ 100*592ffb21SWarner Losh MODE_ONE_WIDTH, /* only one width is supported */ 101*592ffb21SWarner Losh MODE_ONE_HEIGHT, /* only one height is supported */ 102*592ffb21SWarner Losh MODE_ONE_SIZE, /* only one resolution is supported */ 103*592ffb21SWarner Losh MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ 104*592ffb21SWarner Losh MODE_UNVERIFIED = -3, /* mode needs to reverified */ 105*592ffb21SWarner Losh MODE_BAD = -2, /* unspecified reason */ 106*592ffb21SWarner Losh MODE_ERROR = -1 /* error condition */ 107*592ffb21SWarner Losh }; 108*592ffb21SWarner Losh 109*592ffb21SWarner Losh #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \ 110*592ffb21SWarner Losh DRM_MODE_TYPE_CRTC_C) 111*592ffb21SWarner Losh 112*592ffb21SWarner Losh #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \ 113*592ffb21SWarner Losh .name = nm, .status = 0, .type = (t), .clock = (c), \ 114*592ffb21SWarner Losh .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ 115*592ffb21SWarner Losh .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ 116*592ffb21SWarner Losh .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ 117*592ffb21SWarner Losh .vscan = (vs), .flags = (f), .vrefresh = 0, \ 118*592ffb21SWarner Losh .base.type = DRM_MODE_OBJECT_MODE 119*592ffb21SWarner Losh 120*592ffb21SWarner Losh #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ 121*592ffb21SWarner Losh 122*592ffb21SWarner Losh struct drm_display_mode { 123*592ffb21SWarner Losh /* Header */ 124*592ffb21SWarner Losh struct list_head head; 125*592ffb21SWarner Losh struct drm_mode_object base; 126*592ffb21SWarner Losh 127*592ffb21SWarner Losh char name[DRM_DISPLAY_MODE_LEN]; 128*592ffb21SWarner Losh 129*592ffb21SWarner Losh enum drm_mode_status status; 130*592ffb21SWarner Losh unsigned int type; 131*592ffb21SWarner Losh 132*592ffb21SWarner Losh /* Proposed mode values */ 133*592ffb21SWarner Losh int clock; /* in kHz */ 134*592ffb21SWarner Losh int hdisplay; 135*592ffb21SWarner Losh int hsync_start; 136*592ffb21SWarner Losh int hsync_end; 137*592ffb21SWarner Losh int htotal; 138*592ffb21SWarner Losh int hskew; 139*592ffb21SWarner Losh int vdisplay; 140*592ffb21SWarner Losh int vsync_start; 141*592ffb21SWarner Losh int vsync_end; 142*592ffb21SWarner Losh int vtotal; 143*592ffb21SWarner Losh int vscan; 144*592ffb21SWarner Losh unsigned int flags; 145*592ffb21SWarner Losh 146*592ffb21SWarner Losh /* Addressable image size (may be 0 for projectors, etc.) */ 147*592ffb21SWarner Losh int width_mm; 148*592ffb21SWarner Losh int height_mm; 149*592ffb21SWarner Losh 150*592ffb21SWarner Losh /* Actual mode we give to hw */ 151*592ffb21SWarner Losh int clock_index; 152*592ffb21SWarner Losh int synth_clock; 153*592ffb21SWarner Losh int crtc_hdisplay; 154*592ffb21SWarner Losh int crtc_hblank_start; 155*592ffb21SWarner Losh int crtc_hblank_end; 156*592ffb21SWarner Losh int crtc_hsync_start; 157*592ffb21SWarner Losh int crtc_hsync_end; 158*592ffb21SWarner Losh int crtc_htotal; 159*592ffb21SWarner Losh int crtc_hskew; 160*592ffb21SWarner Losh int crtc_vdisplay; 161*592ffb21SWarner Losh int crtc_vblank_start; 162*592ffb21SWarner Losh int crtc_vblank_end; 163*592ffb21SWarner Losh int crtc_vsync_start; 164*592ffb21SWarner Losh int crtc_vsync_end; 165*592ffb21SWarner Losh int crtc_vtotal; 166*592ffb21SWarner Losh 167*592ffb21SWarner Losh /* Driver private mode info */ 168*592ffb21SWarner Losh int private_size; 169*592ffb21SWarner Losh int *private; 170*592ffb21SWarner Losh int private_flags; 171*592ffb21SWarner Losh 172*592ffb21SWarner Losh int vrefresh; /* in Hz */ 173*592ffb21SWarner Losh int hsync; /* in kHz */ 174*592ffb21SWarner Losh }; 175*592ffb21SWarner Losh 176*592ffb21SWarner Losh enum drm_connector_status { 177*592ffb21SWarner Losh connector_status_connected = 1, 178*592ffb21SWarner Losh connector_status_disconnected = 2, 179*592ffb21SWarner Losh connector_status_unknown = 3, 180*592ffb21SWarner Losh }; 181*592ffb21SWarner Losh 182*592ffb21SWarner Losh enum subpixel_order { 183*592ffb21SWarner Losh SubPixelUnknown = 0, 184*592ffb21SWarner Losh SubPixelHorizontalRGB, 185*592ffb21SWarner Losh SubPixelHorizontalBGR, 186*592ffb21SWarner Losh SubPixelVerticalRGB, 187*592ffb21SWarner Losh SubPixelVerticalBGR, 188*592ffb21SWarner Losh SubPixelNone, 189*592ffb21SWarner Losh }; 190*592ffb21SWarner Losh 191*592ffb21SWarner Losh #define DRM_COLOR_FORMAT_RGB444 (1<<0) 192*592ffb21SWarner Losh #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) 193*592ffb21SWarner Losh #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) 194*592ffb21SWarner Losh /* 195*592ffb21SWarner Losh * Describes a given display (e.g. CRT or flat panel) and its limitations. 196*592ffb21SWarner Losh */ 197*592ffb21SWarner Losh struct drm_display_info { 198*592ffb21SWarner Losh char name[DRM_DISPLAY_INFO_LEN]; 199*592ffb21SWarner Losh 200*592ffb21SWarner Losh /* Physical size */ 201*592ffb21SWarner Losh unsigned int width_mm; 202*592ffb21SWarner Losh unsigned int height_mm; 203*592ffb21SWarner Losh 204*592ffb21SWarner Losh /* Clock limits FIXME: storage format */ 205*592ffb21SWarner Losh unsigned int min_vfreq, max_vfreq; 206*592ffb21SWarner Losh unsigned int min_hfreq, max_hfreq; 207*592ffb21SWarner Losh unsigned int pixel_clock; 208*592ffb21SWarner Losh unsigned int bpc; 209*592ffb21SWarner Losh 210*592ffb21SWarner Losh enum subpixel_order subpixel_order; 211*592ffb21SWarner Losh u32 color_formats; 212*592ffb21SWarner Losh 213*592ffb21SWarner Losh u8 cea_rev; 214*592ffb21SWarner Losh }; 215*592ffb21SWarner Losh 216*592ffb21SWarner Losh struct drm_framebuffer_funcs { 217*592ffb21SWarner Losh /* note: use drm_framebuffer_remove() */ 218*592ffb21SWarner Losh void (*destroy)(struct drm_framebuffer *framebuffer); 219*592ffb21SWarner Losh int (*create_handle)(struct drm_framebuffer *fb, 220*592ffb21SWarner Losh struct drm_file *file_priv, 221*592ffb21SWarner Losh unsigned int *handle); 222*592ffb21SWarner Losh /** 223*592ffb21SWarner Losh * Optinal callback for the dirty fb ioctl. 224*592ffb21SWarner Losh * 225*592ffb21SWarner Losh * Userspace can notify the driver via this callback 226*592ffb21SWarner Losh * that a area of the framebuffer has changed and should 227*592ffb21SWarner Losh * be flushed to the display hardware. 228*592ffb21SWarner Losh * 229*592ffb21SWarner Losh * See documentation in drm_mode.h for the struct 230*592ffb21SWarner Losh * drm_mode_fb_dirty_cmd for more information as all 231*592ffb21SWarner Losh * the semantics and arguments have a one to one mapping 232*592ffb21SWarner Losh * on this function. 233*592ffb21SWarner Losh */ 234*592ffb21SWarner Losh int (*dirty)(struct drm_framebuffer *framebuffer, 235*592ffb21SWarner Losh struct drm_file *file_priv, unsigned flags, 236*592ffb21SWarner Losh unsigned color, struct drm_clip_rect *clips, 237*592ffb21SWarner Losh unsigned num_clips); 238*592ffb21SWarner Losh }; 239*592ffb21SWarner Losh 240*592ffb21SWarner Losh struct drm_framebuffer { 241*592ffb21SWarner Losh struct drm_device *dev; 242*592ffb21SWarner Losh /* 243*592ffb21SWarner Losh * Note that the fb is refcounted for the benefit of driver internals, 244*592ffb21SWarner Losh * for example some hw, disabling a CRTC/plane is asynchronous, and 245*592ffb21SWarner Losh * scanout does not actually complete until the next vblank. So some 246*592ffb21SWarner Losh * cleanup (like releasing the reference(s) on the backing GEM bo(s)) 247*592ffb21SWarner Losh * should be deferred. In cases like this, the driver would like to 248*592ffb21SWarner Losh * hold a ref to the fb even though it has already been removed from 249*592ffb21SWarner Losh * userspace perspective. 250*592ffb21SWarner Losh */ 251*592ffb21SWarner Losh unsigned int refcount; 252*592ffb21SWarner Losh struct list_head head; 253*592ffb21SWarner Losh struct drm_mode_object base; 254*592ffb21SWarner Losh const struct drm_framebuffer_funcs *funcs; 255*592ffb21SWarner Losh unsigned int pitches[4]; 256*592ffb21SWarner Losh unsigned int offsets[4]; 257*592ffb21SWarner Losh unsigned int width; 258*592ffb21SWarner Losh unsigned int height; 259*592ffb21SWarner Losh /* depth can be 15 or 16 */ 260*592ffb21SWarner Losh unsigned int depth; 261*592ffb21SWarner Losh int bits_per_pixel; 262*592ffb21SWarner Losh int flags; 263*592ffb21SWarner Losh uint32_t pixel_format; /* fourcc format */ 264*592ffb21SWarner Losh struct list_head filp_head; 265*592ffb21SWarner Losh /* if you are using the helper */ 266*592ffb21SWarner Losh void *helper_private; 267*592ffb21SWarner Losh }; 268*592ffb21SWarner Losh 269*592ffb21SWarner Losh struct drm_property_blob { 270*592ffb21SWarner Losh struct drm_mode_object base; 271*592ffb21SWarner Losh struct list_head head; 272*592ffb21SWarner Losh unsigned int length; 273*592ffb21SWarner Losh unsigned char data[]; 274*592ffb21SWarner Losh }; 275*592ffb21SWarner Losh 276*592ffb21SWarner Losh struct drm_property_enum { 277*592ffb21SWarner Losh uint64_t value; 278*592ffb21SWarner Losh struct list_head head; 279*592ffb21SWarner Losh char name[DRM_PROP_NAME_LEN]; 280*592ffb21SWarner Losh }; 281*592ffb21SWarner Losh 282*592ffb21SWarner Losh struct drm_property { 283*592ffb21SWarner Losh struct list_head head; 284*592ffb21SWarner Losh struct drm_mode_object base; 285*592ffb21SWarner Losh uint32_t flags; 286*592ffb21SWarner Losh char name[DRM_PROP_NAME_LEN]; 287*592ffb21SWarner Losh uint32_t num_values; 288*592ffb21SWarner Losh uint64_t *values; 289*592ffb21SWarner Losh 290*592ffb21SWarner Losh struct list_head enum_blob_list; 291*592ffb21SWarner Losh }; 292*592ffb21SWarner Losh 293*592ffb21SWarner Losh struct drm_crtc; 294*592ffb21SWarner Losh struct drm_connector; 295*592ffb21SWarner Losh struct drm_encoder; 296*592ffb21SWarner Losh struct drm_pending_vblank_event; 297*592ffb21SWarner Losh struct drm_plane; 298*592ffb21SWarner Losh 299*592ffb21SWarner Losh /** 300*592ffb21SWarner Losh * drm_crtc_funcs - control CRTCs for a given device 301*592ffb21SWarner Losh * @save: save CRTC state 302*592ffb21SWarner Losh * @restore: restore CRTC state 303*592ffb21SWarner Losh * @reset: reset CRTC after state has been invalidate (e.g. resume) 304*592ffb21SWarner Losh * @cursor_set: setup the cursor 305*592ffb21SWarner Losh * @cursor_move: move the cursor 306*592ffb21SWarner Losh * @gamma_set: specify color ramp for CRTC 307*592ffb21SWarner Losh * @destroy: deinit and free object 308*592ffb21SWarner Losh * @set_property: called when a property is changed 309*592ffb21SWarner Losh * @set_config: apply a new CRTC configuration 310*592ffb21SWarner Losh * @page_flip: initiate a page flip 311*592ffb21SWarner Losh * 312*592ffb21SWarner Losh * The drm_crtc_funcs structure is the central CRTC management structure 313*592ffb21SWarner Losh * in the DRM. Each CRTC controls one or more connectors (note that the name 314*592ffb21SWarner Losh * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc. 315*592ffb21SWarner Losh * connectors, not just CRTs). 316*592ffb21SWarner Losh * 317*592ffb21SWarner Losh * Each driver is responsible for filling out this structure at startup time, 318*592ffb21SWarner Losh * in addition to providing other modesetting features, like i2c and DDC 319*592ffb21SWarner Losh * bus accessors. 320*592ffb21SWarner Losh */ 321*592ffb21SWarner Losh struct drm_crtc_funcs { 322*592ffb21SWarner Losh /* Save CRTC state */ 323*592ffb21SWarner Losh void (*save)(struct drm_crtc *crtc); /* suspend? */ 324*592ffb21SWarner Losh /* Restore CRTC state */ 325*592ffb21SWarner Losh void (*restore)(struct drm_crtc *crtc); /* resume? */ 326*592ffb21SWarner Losh /* Reset CRTC state */ 327*592ffb21SWarner Losh void (*reset)(struct drm_crtc *crtc); 328*592ffb21SWarner Losh 329*592ffb21SWarner Losh /* cursor controls */ 330*592ffb21SWarner Losh int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 331*592ffb21SWarner Losh uint32_t handle, uint32_t width, uint32_t height); 332*592ffb21SWarner Losh int (*cursor_move)(struct drm_crtc *crtc, int x, int y); 333*592ffb21SWarner Losh 334*592ffb21SWarner Losh /* Set gamma on the CRTC */ 335*592ffb21SWarner Losh void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 336*592ffb21SWarner Losh uint32_t start, uint32_t size); 337*592ffb21SWarner Losh /* Object destroy routine */ 338*592ffb21SWarner Losh void (*destroy)(struct drm_crtc *crtc); 339*592ffb21SWarner Losh 340*592ffb21SWarner Losh int (*set_config)(struct drm_mode_set *set); 341*592ffb21SWarner Losh 342*592ffb21SWarner Losh /* 343*592ffb21SWarner Losh * Flip to the given framebuffer. This implements the page 344*592ffb21SWarner Losh * flip ioctl described in drm_mode.h, specifically, the 345*592ffb21SWarner Losh * implementation must return immediately and block all 346*592ffb21SWarner Losh * rendering to the current fb until the flip has completed. 347*592ffb21SWarner Losh * If userspace set the event flag in the ioctl, the event 348*592ffb21SWarner Losh * argument will point to an event to send back when the flip 349*592ffb21SWarner Losh * completes, otherwise it will be NULL. 350*592ffb21SWarner Losh */ 351*592ffb21SWarner Losh int (*page_flip)(struct drm_crtc *crtc, 352*592ffb21SWarner Losh struct drm_framebuffer *fb, 353*592ffb21SWarner Losh struct drm_pending_vblank_event *event); 354*592ffb21SWarner Losh 355*592ffb21SWarner Losh int (*set_property)(struct drm_crtc *crtc, 356*592ffb21SWarner Losh struct drm_property *property, uint64_t val); 357*592ffb21SWarner Losh }; 358*592ffb21SWarner Losh 359*592ffb21SWarner Losh /** 360*592ffb21SWarner Losh * drm_crtc - central CRTC control structure 361*592ffb21SWarner Losh * @dev: parent DRM device 362*592ffb21SWarner Losh * @head: list management 363*592ffb21SWarner Losh * @base: base KMS object for ID tracking etc. 364*592ffb21SWarner Losh * @enabled: is this CRTC enabled? 365*592ffb21SWarner Losh * @mode: current mode timings 366*592ffb21SWarner Losh * @hwmode: mode timings as programmed to hw regs 367*592ffb21SWarner Losh * @invert_dimensions: for purposes of error checking crtc vs fb sizes, 368*592ffb21SWarner Losh * invert the width/height of the crtc. This is used if the driver 369*592ffb21SWarner Losh * is performing 90 or 270 degree rotated scanout 370*592ffb21SWarner Losh * @x: x position on screen 371*592ffb21SWarner Losh * @y: y position on screen 372*592ffb21SWarner Losh * @funcs: CRTC control functions 373*592ffb21SWarner Losh * @gamma_size: size of gamma ramp 374*592ffb21SWarner Losh * @gamma_store: gamma ramp values 375*592ffb21SWarner Losh * @framedur_ns: precise frame timing 376*592ffb21SWarner Losh * @framedur_ns: precise line timing 377*592ffb21SWarner Losh * @pixeldur_ns: precise pixel timing 378*592ffb21SWarner Losh * @helper_private: mid-layer private data 379*592ffb21SWarner Losh * @properties: property tracking for this CRTC 380*592ffb21SWarner Losh * 381*592ffb21SWarner Losh * Each CRTC may have one or more connectors associated with it. This structure 382*592ffb21SWarner Losh * allows the CRTC to be controlled. 383*592ffb21SWarner Losh */ 384*592ffb21SWarner Losh struct drm_crtc { 385*592ffb21SWarner Losh struct drm_device *dev; 386*592ffb21SWarner Losh struct list_head head; 387*592ffb21SWarner Losh 388*592ffb21SWarner Losh struct drm_mode_object base; 389*592ffb21SWarner Losh 390*592ffb21SWarner Losh /* framebuffer the connector is currently bound to */ 391*592ffb21SWarner Losh struct drm_framebuffer *fb; 392*592ffb21SWarner Losh 393*592ffb21SWarner Losh bool enabled; 394*592ffb21SWarner Losh 395*592ffb21SWarner Losh /* Requested mode from modesetting. */ 396*592ffb21SWarner Losh struct drm_display_mode mode; 397*592ffb21SWarner Losh 398*592ffb21SWarner Losh /* Programmed mode in hw, after adjustments for encoders, 399*592ffb21SWarner Losh * crtc, panel scaling etc. Needed for timestamping etc. 400*592ffb21SWarner Losh */ 401*592ffb21SWarner Losh struct drm_display_mode hwmode; 402*592ffb21SWarner Losh 403*592ffb21SWarner Losh bool invert_dimensions; 404*592ffb21SWarner Losh 405*592ffb21SWarner Losh int x, y; 406*592ffb21SWarner Losh const struct drm_crtc_funcs *funcs; 407*592ffb21SWarner Losh 408*592ffb21SWarner Losh /* CRTC gamma size for reporting to userspace */ 409*592ffb21SWarner Losh uint32_t gamma_size; 410*592ffb21SWarner Losh uint16_t *gamma_store; 411*592ffb21SWarner Losh 412*592ffb21SWarner Losh /* Constants needed for precise vblank and swap timestamping. */ 413*592ffb21SWarner Losh s64 framedur_ns, linedur_ns, pixeldur_ns; 414*592ffb21SWarner Losh 415*592ffb21SWarner Losh /* if you are using the helper */ 416*592ffb21SWarner Losh void *helper_private; 417*592ffb21SWarner Losh 418*592ffb21SWarner Losh struct drm_object_properties properties; 419*592ffb21SWarner Losh }; 420*592ffb21SWarner Losh 421*592ffb21SWarner Losh 422*592ffb21SWarner Losh /** 423*592ffb21SWarner Losh * drm_connector_funcs - control connectors on a given device 424*592ffb21SWarner Losh * @dpms: set power state (see drm_crtc_funcs above) 425*592ffb21SWarner Losh * @save: save connector state 426*592ffb21SWarner Losh * @restore: restore connector state 427*592ffb21SWarner Losh * @reset: reset connector after state has been invalidate (e.g. resume) 428*592ffb21SWarner Losh * @detect: is this connector active? 429*592ffb21SWarner Losh * @fill_modes: fill mode list for this connector 430*592ffb21SWarner Losh * @set_property: property for this connector may need update 431*592ffb21SWarner Losh * @destroy: make object go away 432*592ffb21SWarner Losh * @force: notify the driver the connector is forced on 433*592ffb21SWarner Losh * 434*592ffb21SWarner Losh * Each CRTC may have one or more connectors attached to it. The functions 435*592ffb21SWarner Losh * below allow the core DRM code to control connectors, enumerate available modes, 436*592ffb21SWarner Losh * etc. 437*592ffb21SWarner Losh */ 438*592ffb21SWarner Losh struct drm_connector_funcs { 439*592ffb21SWarner Losh void (*dpms)(struct drm_connector *connector, int mode); 440*592ffb21SWarner Losh void (*save)(struct drm_connector *connector); 441*592ffb21SWarner Losh void (*restore)(struct drm_connector *connector); 442*592ffb21SWarner Losh void (*reset)(struct drm_connector *connector); 443*592ffb21SWarner Losh 444*592ffb21SWarner Losh /* Check to see if anything is attached to the connector. 445*592ffb21SWarner Losh * @force is set to false whilst polling, true when checking the 446*592ffb21SWarner Losh * connector due to user request. @force can be used by the driver 447*592ffb21SWarner Losh * to avoid expensive, destructive operations during automated 448*592ffb21SWarner Losh * probing. 449*592ffb21SWarner Losh */ 450*592ffb21SWarner Losh enum drm_connector_status (*detect)(struct drm_connector *connector, 451*592ffb21SWarner Losh bool force); 452*592ffb21SWarner Losh int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 453*592ffb21SWarner Losh int (*set_property)(struct drm_connector *connector, struct drm_property *property, 454*592ffb21SWarner Losh uint64_t val); 455*592ffb21SWarner Losh void (*destroy)(struct drm_connector *connector); 456*592ffb21SWarner Losh void (*force)(struct drm_connector *connector); 457*592ffb21SWarner Losh }; 458*592ffb21SWarner Losh 459*592ffb21SWarner Losh /** 460*592ffb21SWarner Losh * drm_encoder_funcs - encoder controls 461*592ffb21SWarner Losh * @reset: reset state (e.g. at init or resume time) 462*592ffb21SWarner Losh * @destroy: cleanup and free associated data 463*592ffb21SWarner Losh * 464*592ffb21SWarner Losh * Encoders sit between CRTCs and connectors. 465*592ffb21SWarner Losh */ 466*592ffb21SWarner Losh struct drm_encoder_funcs { 467*592ffb21SWarner Losh void (*reset)(struct drm_encoder *encoder); 468*592ffb21SWarner Losh void (*destroy)(struct drm_encoder *encoder); 469*592ffb21SWarner Losh }; 470*592ffb21SWarner Losh 471*592ffb21SWarner Losh #define DRM_CONNECTOR_MAX_UMODES 16 472*592ffb21SWarner Losh #define DRM_CONNECTOR_LEN 32 473*592ffb21SWarner Losh #define DRM_CONNECTOR_MAX_ENCODER 3 474*592ffb21SWarner Losh 475*592ffb21SWarner Losh /** 476*592ffb21SWarner Losh * drm_encoder - central DRM encoder structure 477*592ffb21SWarner Losh * @dev: parent DRM device 478*592ffb21SWarner Losh * @head: list management 479*592ffb21SWarner Losh * @base: base KMS object 480*592ffb21SWarner Losh * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h 481*592ffb21SWarner Losh * @possible_crtcs: bitmask of potential CRTC bindings 482*592ffb21SWarner Losh * @possible_clones: bitmask of potential sibling encoders for cloning 483*592ffb21SWarner Losh * @crtc: currently bound CRTC 484*592ffb21SWarner Losh * @funcs: control functions 485*592ffb21SWarner Losh * @helper_private: mid-layer private data 486*592ffb21SWarner Losh * 487*592ffb21SWarner Losh * CRTCs drive pixels to encoders, which convert them into signals 488*592ffb21SWarner Losh * appropriate for a given connector or set of connectors. 489*592ffb21SWarner Losh */ 490*592ffb21SWarner Losh struct drm_encoder { 491*592ffb21SWarner Losh struct drm_device *dev; 492*592ffb21SWarner Losh struct list_head head; 493*592ffb21SWarner Losh 494*592ffb21SWarner Losh struct drm_mode_object base; 495*592ffb21SWarner Losh int encoder_type; 496*592ffb21SWarner Losh uint32_t possible_crtcs; 497*592ffb21SWarner Losh uint32_t possible_clones; 498*592ffb21SWarner Losh 499*592ffb21SWarner Losh struct drm_crtc *crtc; 500*592ffb21SWarner Losh const struct drm_encoder_funcs *funcs; 501*592ffb21SWarner Losh void *helper_private; 502*592ffb21SWarner Losh }; 503*592ffb21SWarner Losh 504*592ffb21SWarner Losh enum drm_connector_force { 505*592ffb21SWarner Losh DRM_FORCE_UNSPECIFIED, 506*592ffb21SWarner Losh DRM_FORCE_OFF, 507*592ffb21SWarner Losh DRM_FORCE_ON, /* force on analog part normally */ 508*592ffb21SWarner Losh DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ 509*592ffb21SWarner Losh }; 510*592ffb21SWarner Losh 511*592ffb21SWarner Losh /* should we poll this connector for connects and disconnects */ 512*592ffb21SWarner Losh /* hot plug detectable */ 513*592ffb21SWarner Losh #define DRM_CONNECTOR_POLL_HPD (1 << 0) 514*592ffb21SWarner Losh /* poll for connections */ 515*592ffb21SWarner Losh #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) 516*592ffb21SWarner Losh /* can cleanly poll for disconnections without flickering the screen */ 517*592ffb21SWarner Losh /* DACs should rarely do this without a lot of testing */ 518*592ffb21SWarner Losh #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) 519*592ffb21SWarner Losh 520*592ffb21SWarner Losh #define MAX_ELD_BYTES 128 521*592ffb21SWarner Losh 522*592ffb21SWarner Losh /** 523*592ffb21SWarner Losh * drm_connector - central DRM connector control structure 524*592ffb21SWarner Losh * @dev: parent DRM device 525*592ffb21SWarner Losh * @kdev: kernel device for sysfs attributes 526*592ffb21SWarner Losh * @attr: sysfs attributes 527*592ffb21SWarner Losh * @head: list management 528*592ffb21SWarner Losh * @base: base KMS object 529*592ffb21SWarner Losh * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h 530*592ffb21SWarner Losh * @connector_type_id: index into connector type enum 531*592ffb21SWarner Losh * @interlace_allowed: can this connector handle interlaced modes? 532*592ffb21SWarner Losh * @doublescan_allowed: can this connector handle doublescan? 533*592ffb21SWarner Losh * @modes: modes available on this connector (from fill_modes() + user) 534*592ffb21SWarner Losh * @status: one of the drm_connector_status enums (connected, not, or unknown) 535*592ffb21SWarner Losh * @probed_modes: list of modes derived directly from the display 536*592ffb21SWarner Losh * @display_info: information about attached display (e.g. from EDID) 537*592ffb21SWarner Losh * @funcs: connector control functions 538*592ffb21SWarner Losh * @user_modes: user added mode list 539*592ffb21SWarner Losh * @edid_blob_ptr: DRM property containing EDID if present 540*592ffb21SWarner Losh * @properties: property tracking for this connector 541*592ffb21SWarner Losh * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 542*592ffb21SWarner Losh * @dpms: current dpms state 543*592ffb21SWarner Losh * @helper_private: mid-layer private data 544*592ffb21SWarner Losh * @force: a %DRM_FORCE_<foo> state for forced mode sets 545*592ffb21SWarner Losh * @encoder_ids: valid encoders for this connector 546*592ffb21SWarner Losh * @encoder: encoder driving this connector, if any 547*592ffb21SWarner Losh * @eld: EDID-like data, if present 548*592ffb21SWarner Losh * @dvi_dual: dual link DVI, if found 549*592ffb21SWarner Losh * @max_tmds_clock: max clock rate, if found 550*592ffb21SWarner Losh * @latency_present: AV delay info from ELD, if found 551*592ffb21SWarner Losh * @video_latency: video latency info from ELD, if found 552*592ffb21SWarner Losh * @audio_latency: audio latency info from ELD, if found 553*592ffb21SWarner Losh * @null_edid_counter: track sinks that give us all zeros for the EDID 554*592ffb21SWarner Losh * 555*592ffb21SWarner Losh * Each connector may be connected to one or more CRTCs, or may be clonable by 556*592ffb21SWarner Losh * another connector if they can share a CRTC. Each connector also has a specific 557*592ffb21SWarner Losh * position in the broader display (referred to as a 'screen' though it could 558*592ffb21SWarner Losh * span multiple monitors). 559*592ffb21SWarner Losh */ 560*592ffb21SWarner Losh struct drm_connector { 561*592ffb21SWarner Losh struct drm_device *dev; 562*592ffb21SWarner Losh #ifdef FREEBSD_NOTYET 563*592ffb21SWarner Losh struct device kdev; 564*592ffb21SWarner Losh #endif /* FREEBSD_NOTYET */ 565*592ffb21SWarner Losh struct device_attribute *attr; 566*592ffb21SWarner Losh struct list_head head; 567*592ffb21SWarner Losh 568*592ffb21SWarner Losh struct drm_mode_object base; 569*592ffb21SWarner Losh 570*592ffb21SWarner Losh int connector_type; 571*592ffb21SWarner Losh int connector_type_id; 572*592ffb21SWarner Losh bool interlace_allowed; 573*592ffb21SWarner Losh bool doublescan_allowed; 574*592ffb21SWarner Losh struct list_head modes; /* list of modes on this connector */ 575*592ffb21SWarner Losh 576*592ffb21SWarner Losh enum drm_connector_status status; 577*592ffb21SWarner Losh 578*592ffb21SWarner Losh /* these are modes added by probing with DDC or the BIOS */ 579*592ffb21SWarner Losh struct list_head probed_modes; 580*592ffb21SWarner Losh 581*592ffb21SWarner Losh struct drm_display_info display_info; 582*592ffb21SWarner Losh const struct drm_connector_funcs *funcs; 583*592ffb21SWarner Losh 584*592ffb21SWarner Losh struct list_head user_modes; 585*592ffb21SWarner Losh struct drm_property_blob *edid_blob_ptr; 586*592ffb21SWarner Losh struct drm_object_properties properties; 587*592ffb21SWarner Losh 588*592ffb21SWarner Losh uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 589*592ffb21SWarner Losh 590*592ffb21SWarner Losh /* requested DPMS state */ 591*592ffb21SWarner Losh int dpms; 592*592ffb21SWarner Losh 593*592ffb21SWarner Losh void *helper_private; 594*592ffb21SWarner Losh 595*592ffb21SWarner Losh /* forced on connector */ 596*592ffb21SWarner Losh enum drm_connector_force force; 597*592ffb21SWarner Losh uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 598*592ffb21SWarner Losh struct drm_encoder *encoder; /* currently active encoder */ 599*592ffb21SWarner Losh 600*592ffb21SWarner Losh /* EDID bits */ 601*592ffb21SWarner Losh uint8_t eld[MAX_ELD_BYTES]; 602*592ffb21SWarner Losh bool dvi_dual; 603*592ffb21SWarner Losh int max_tmds_clock; /* in MHz */ 604*592ffb21SWarner Losh bool latency_present[2]; 605*592ffb21SWarner Losh int video_latency[2]; /* [0]: progressive, [1]: interlaced */ 606*592ffb21SWarner Losh int audio_latency[2]; 607*592ffb21SWarner Losh int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ 608*592ffb21SWarner Losh unsigned bad_edid_counter; 609*592ffb21SWarner Losh }; 610*592ffb21SWarner Losh 611*592ffb21SWarner Losh /** 612*592ffb21SWarner Losh * drm_plane_funcs - driver plane control functions 613*592ffb21SWarner Losh * @update_plane: update the plane configuration 614*592ffb21SWarner Losh * @disable_plane: shut down the plane 615*592ffb21SWarner Losh * @destroy: clean up plane resources 616*592ffb21SWarner Losh * @set_property: called when a property is changed 617*592ffb21SWarner Losh */ 618*592ffb21SWarner Losh struct drm_plane_funcs { 619*592ffb21SWarner Losh int (*update_plane)(struct drm_plane *plane, 620*592ffb21SWarner Losh struct drm_crtc *crtc, struct drm_framebuffer *fb, 621*592ffb21SWarner Losh int crtc_x, int crtc_y, 622*592ffb21SWarner Losh unsigned int crtc_w, unsigned int crtc_h, 623*592ffb21SWarner Losh uint32_t src_x, uint32_t src_y, 624*592ffb21SWarner Losh uint32_t src_w, uint32_t src_h); 625*592ffb21SWarner Losh int (*disable_plane)(struct drm_plane *plane); 626*592ffb21SWarner Losh void (*destroy)(struct drm_plane *plane); 627*592ffb21SWarner Losh 628*592ffb21SWarner Losh int (*set_property)(struct drm_plane *plane, 629*592ffb21SWarner Losh struct drm_property *property, uint64_t val); 630*592ffb21SWarner Losh }; 631*592ffb21SWarner Losh 632*592ffb21SWarner Losh /** 633*592ffb21SWarner Losh * drm_plane - central DRM plane control structure 634*592ffb21SWarner Losh * @dev: DRM device this plane belongs to 635*592ffb21SWarner Losh * @head: for list management 636*592ffb21SWarner Losh * @base: base mode object 637*592ffb21SWarner Losh * @possible_crtcs: pipes this plane can be bound to 638*592ffb21SWarner Losh * @format_types: array of formats supported by this plane 639*592ffb21SWarner Losh * @format_count: number of formats supported 640*592ffb21SWarner Losh * @crtc: currently bound CRTC 641*592ffb21SWarner Losh * @fb: currently bound fb 642*592ffb21SWarner Losh * @gamma_size: size of gamma table 643*592ffb21SWarner Losh * @gamma_store: gamma correction table 644*592ffb21SWarner Losh * @enabled: enabled flag 645*592ffb21SWarner Losh * @funcs: helper functions 646*592ffb21SWarner Losh * @helper_private: storage for drver layer 647*592ffb21SWarner Losh * @properties: property tracking for this plane 648*592ffb21SWarner Losh */ 649*592ffb21SWarner Losh struct drm_plane { 650*592ffb21SWarner Losh struct drm_device *dev; 651*592ffb21SWarner Losh struct list_head head; 652*592ffb21SWarner Losh 653*592ffb21SWarner Losh struct drm_mode_object base; 654*592ffb21SWarner Losh 655*592ffb21SWarner Losh uint32_t possible_crtcs; 656*592ffb21SWarner Losh uint32_t *format_types; 657*592ffb21SWarner Losh uint32_t format_count; 658*592ffb21SWarner Losh 659*592ffb21SWarner Losh struct drm_crtc *crtc; 660*592ffb21SWarner Losh struct drm_framebuffer *fb; 661*592ffb21SWarner Losh 662*592ffb21SWarner Losh /* CRTC gamma size for reporting to userspace */ 663*592ffb21SWarner Losh uint32_t gamma_size; 664*592ffb21SWarner Losh uint16_t *gamma_store; 665*592ffb21SWarner Losh 666*592ffb21SWarner Losh bool enabled; 667*592ffb21SWarner Losh 668*592ffb21SWarner Losh const struct drm_plane_funcs *funcs; 669*592ffb21SWarner Losh void *helper_private; 670*592ffb21SWarner Losh 671*592ffb21SWarner Losh struct drm_object_properties properties; 672*592ffb21SWarner Losh }; 673*592ffb21SWarner Losh 674*592ffb21SWarner Losh /** 675*592ffb21SWarner Losh * drm_mode_set - new values for a CRTC config change 676*592ffb21SWarner Losh * @head: list management 677*592ffb21SWarner Losh * @fb: framebuffer to use for new config 678*592ffb21SWarner Losh * @crtc: CRTC whose configuration we're about to change 679*592ffb21SWarner Losh * @mode: mode timings to use 680*592ffb21SWarner Losh * @x: position of this CRTC relative to @fb 681*592ffb21SWarner Losh * @y: position of this CRTC relative to @fb 682*592ffb21SWarner Losh * @connectors: array of connectors to drive with this CRTC if possible 683*592ffb21SWarner Losh * @num_connectors: size of @connectors array 684*592ffb21SWarner Losh * 685*592ffb21SWarner Losh * Represents a single crtc the connectors that it drives with what mode 686*592ffb21SWarner Losh * and from which framebuffer it scans out from. 687*592ffb21SWarner Losh * 688*592ffb21SWarner Losh * This is used to set modes. 689*592ffb21SWarner Losh */ 690*592ffb21SWarner Losh struct drm_mode_set { 691*592ffb21SWarner Losh struct drm_framebuffer *fb; 692*592ffb21SWarner Losh struct drm_crtc *crtc; 693*592ffb21SWarner Losh struct drm_display_mode *mode; 694*592ffb21SWarner Losh 695*592ffb21SWarner Losh uint32_t x; 696*592ffb21SWarner Losh uint32_t y; 697*592ffb21SWarner Losh 698*592ffb21SWarner Losh struct drm_connector **connectors; 699*592ffb21SWarner Losh size_t num_connectors; 700*592ffb21SWarner Losh }; 701*592ffb21SWarner Losh 702*592ffb21SWarner Losh /** 703*592ffb21SWarner Losh * struct drm_mode_config_funcs - basic driver provided mode setting functions 704*592ffb21SWarner Losh * @fb_create: create a new framebuffer object 705*592ffb21SWarner Losh * @output_poll_changed: function to handle output configuration changes 706*592ffb21SWarner Losh * 707*592ffb21SWarner Losh * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 708*592ffb21SWarner Losh * involve drivers. 709*592ffb21SWarner Losh */ 710*592ffb21SWarner Losh struct drm_mode_config_funcs { 711*592ffb21SWarner Losh int (*fb_create)(struct drm_device *dev, 712*592ffb21SWarner Losh struct drm_file *file_priv, 713*592ffb21SWarner Losh struct drm_mode_fb_cmd2 *mode_cmd, 714*592ffb21SWarner Losh struct drm_framebuffer **fb); 715*592ffb21SWarner Losh void (*output_poll_changed)(struct drm_device *dev); 716*592ffb21SWarner Losh }; 717*592ffb21SWarner Losh 718*592ffb21SWarner Losh /** 719*592ffb21SWarner Losh * drm_mode_group - group of mode setting resources for potential sub-grouping 720*592ffb21SWarner Losh * @num_crtcs: CRTC count 721*592ffb21SWarner Losh * @num_encoders: encoder count 722*592ffb21SWarner Losh * @num_connectors: connector count 723*592ffb21SWarner Losh * @id_list: list of KMS object IDs in this group 724*592ffb21SWarner Losh * 725*592ffb21SWarner Losh * Currently this simply tracks the global mode setting state. But in the 726*592ffb21SWarner Losh * future it could allow groups of objects to be set aside into independent 727*592ffb21SWarner Losh * control groups for use by different user level processes (e.g. two X servers 728*592ffb21SWarner Losh * running simultaneously on different heads, each with their own mode 729*592ffb21SWarner Losh * configuration and freedom of mode setting). 730*592ffb21SWarner Losh */ 731*592ffb21SWarner Losh struct drm_mode_group { 732*592ffb21SWarner Losh uint32_t num_crtcs; 733*592ffb21SWarner Losh uint32_t num_encoders; 734*592ffb21SWarner Losh uint32_t num_connectors; 735*592ffb21SWarner Losh 736*592ffb21SWarner Losh /* list of object IDs for this group */ 737*592ffb21SWarner Losh uint32_t *id_list; 738*592ffb21SWarner Losh }; 739*592ffb21SWarner Losh 740*592ffb21SWarner Losh /** 741*592ffb21SWarner Losh * drm_mode_config - Mode configuration control structure 742*592ffb21SWarner Losh * @mutex: mutex protecting KMS related lists and structures 743*592ffb21SWarner Losh * @idr_mutex: mutex for KMS ID allocation and management 744*592ffb21SWarner Losh * @crtc_idr: main KMS ID tracking object 745*592ffb21SWarner Losh * @num_fb: number of fbs available 746*592ffb21SWarner Losh * @fb_list: list of framebuffers available 747*592ffb21SWarner Losh * @num_connector: number of connectors on this device 748*592ffb21SWarner Losh * @connector_list: list of connector objects 749*592ffb21SWarner Losh * @num_encoder: number of encoders on this device 750*592ffb21SWarner Losh * @encoder_list: list of encoder objects 751*592ffb21SWarner Losh * @num_crtc: number of CRTCs on this device 752*592ffb21SWarner Losh * @crtc_list: list of CRTC objects 753*592ffb21SWarner Losh * @min_width: minimum pixel width on this device 754*592ffb21SWarner Losh * @min_height: minimum pixel height on this device 755*592ffb21SWarner Losh * @max_width: maximum pixel width on this device 756*592ffb21SWarner Losh * @max_height: maximum pixel height on this device 757*592ffb21SWarner Losh * @funcs: core driver provided mode setting functions 758*592ffb21SWarner Losh * @fb_base: base address of the framebuffer 759*592ffb21SWarner Losh * @poll_enabled: track polling status for this device 760*592ffb21SWarner Losh * @output_poll_work: delayed work for polling in process context 761*592ffb21SWarner Losh * @*_property: core property tracking 762*592ffb21SWarner Losh * 763*592ffb21SWarner Losh * Core mode resource tracking structure. All CRTC, encoders, and connectors 764*592ffb21SWarner Losh * enumerated by the driver are added here, as are global properties. Some 765*592ffb21SWarner Losh * global restrictions are also here, e.g. dimension restrictions. 766*592ffb21SWarner Losh */ 767*592ffb21SWarner Losh struct drm_mode_config { 768*592ffb21SWarner Losh struct sx mutex; /* protects configuration (mode lists etc.) */ 769*592ffb21SWarner Losh struct drm_gem_names crtc_names; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 770*592ffb21SWarner Losh /* this is limited to one for now */ 771*592ffb21SWarner Losh int num_fb; 772*592ffb21SWarner Losh struct list_head fb_list; 773*592ffb21SWarner Losh int num_connector; 774*592ffb21SWarner Losh struct list_head connector_list; 775*592ffb21SWarner Losh int num_encoder; 776*592ffb21SWarner Losh struct list_head encoder_list; 777*592ffb21SWarner Losh int num_plane; 778*592ffb21SWarner Losh struct list_head plane_list; 779*592ffb21SWarner Losh 780*592ffb21SWarner Losh int num_crtc; 781*592ffb21SWarner Losh struct list_head crtc_list; 782*592ffb21SWarner Losh 783*592ffb21SWarner Losh struct list_head property_list; 784*592ffb21SWarner Losh 785*592ffb21SWarner Losh int min_width, min_height; 786*592ffb21SWarner Losh int max_width, max_height; 787*592ffb21SWarner Losh const struct drm_mode_config_funcs *funcs; 788*592ffb21SWarner Losh resource_size_t fb_base; 789*592ffb21SWarner Losh 790*592ffb21SWarner Losh /* output poll support */ 791*592ffb21SWarner Losh bool poll_enabled; 792*592ffb21SWarner Losh bool poll_running; 793*592ffb21SWarner Losh struct timeout_task output_poll_work; 794*592ffb21SWarner Losh 795*592ffb21SWarner Losh /* pointers to standard properties */ 796*592ffb21SWarner Losh struct list_head property_blob_list; 797*592ffb21SWarner Losh struct drm_property *edid_property; 798*592ffb21SWarner Losh struct drm_property *dpms_property; 799*592ffb21SWarner Losh 800*592ffb21SWarner Losh /* DVI-I properties */ 801*592ffb21SWarner Losh struct drm_property *dvi_i_subconnector_property; 802*592ffb21SWarner Losh struct drm_property *dvi_i_select_subconnector_property; 803*592ffb21SWarner Losh 804*592ffb21SWarner Losh /* TV properties */ 805*592ffb21SWarner Losh struct drm_property *tv_subconnector_property; 806*592ffb21SWarner Losh struct drm_property *tv_select_subconnector_property; 807*592ffb21SWarner Losh struct drm_property *tv_mode_property; 808*592ffb21SWarner Losh struct drm_property *tv_left_margin_property; 809*592ffb21SWarner Losh struct drm_property *tv_right_margin_property; 810*592ffb21SWarner Losh struct drm_property *tv_top_margin_property; 811*592ffb21SWarner Losh struct drm_property *tv_bottom_margin_property; 812*592ffb21SWarner Losh struct drm_property *tv_brightness_property; 813*592ffb21SWarner Losh struct drm_property *tv_contrast_property; 814*592ffb21SWarner Losh struct drm_property *tv_flicker_reduction_property; 815*592ffb21SWarner Losh struct drm_property *tv_overscan_property; 816*592ffb21SWarner Losh struct drm_property *tv_saturation_property; 817*592ffb21SWarner Losh struct drm_property *tv_hue_property; 818*592ffb21SWarner Losh 819*592ffb21SWarner Losh /* Optional properties */ 820*592ffb21SWarner Losh struct drm_property *scaling_mode_property; 821*592ffb21SWarner Losh struct drm_property *dithering_mode_property; 822*592ffb21SWarner Losh struct drm_property *dirty_info_property; 823*592ffb21SWarner Losh 824*592ffb21SWarner Losh /* dumb ioctl parameters */ 825*592ffb21SWarner Losh uint32_t preferred_depth, prefer_shadow; 826*592ffb21SWarner Losh }; 827*592ffb21SWarner Losh 828*592ffb21SWarner Losh #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 829*592ffb21SWarner Losh #define obj_to_connector(x) container_of(x, struct drm_connector, base) 830*592ffb21SWarner Losh #define obj_to_encoder(x) container_of(x, struct drm_encoder, base) 831*592ffb21SWarner Losh #define obj_to_mode(x) container_of(x, struct drm_display_mode, base) 832*592ffb21SWarner Losh #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) 833*592ffb21SWarner Losh #define obj_to_property(x) container_of(x, struct drm_property, base) 834*592ffb21SWarner Losh #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) 835*592ffb21SWarner Losh #define obj_to_plane(x) container_of(x, struct drm_plane, base) 836*592ffb21SWarner Losh 837*592ffb21SWarner Losh struct drm_prop_enum_list { 838*592ffb21SWarner Losh int type; 839*592ffb21SWarner Losh char *name; 840*592ffb21SWarner Losh }; 841*592ffb21SWarner Losh 842*592ffb21SWarner Losh extern int drm_crtc_init(struct drm_device *dev, 843*592ffb21SWarner Losh struct drm_crtc *crtc, 844*592ffb21SWarner Losh const struct drm_crtc_funcs *funcs); 845*592ffb21SWarner Losh extern void drm_crtc_cleanup(struct drm_crtc *crtc); 846*592ffb21SWarner Losh 847*592ffb21SWarner Losh extern int drm_connector_init(struct drm_device *dev, 848*592ffb21SWarner Losh struct drm_connector *connector, 849*592ffb21SWarner Losh const struct drm_connector_funcs *funcs, 850*592ffb21SWarner Losh int connector_type); 851*592ffb21SWarner Losh 852*592ffb21SWarner Losh extern void drm_connector_cleanup(struct drm_connector *connector); 853*592ffb21SWarner Losh /* helper to unplug all connectors from sysfs for device */ 854*592ffb21SWarner Losh extern void drm_connector_unplug_all(struct drm_device *dev); 855*592ffb21SWarner Losh 856*592ffb21SWarner Losh extern int drm_encoder_init(struct drm_device *dev, 857*592ffb21SWarner Losh struct drm_encoder *encoder, 858*592ffb21SWarner Losh const struct drm_encoder_funcs *funcs, 859*592ffb21SWarner Losh int encoder_type); 860*592ffb21SWarner Losh 861*592ffb21SWarner Losh extern int drm_plane_init(struct drm_device *dev, 862*592ffb21SWarner Losh struct drm_plane *plane, 863*592ffb21SWarner Losh unsigned long possible_crtcs, 864*592ffb21SWarner Losh const struct drm_plane_funcs *funcs, 865*592ffb21SWarner Losh const uint32_t *formats, uint32_t format_count, 866*592ffb21SWarner Losh bool priv); 867*592ffb21SWarner Losh extern void drm_plane_cleanup(struct drm_plane *plane); 868*592ffb21SWarner Losh 869*592ffb21SWarner Losh extern void drm_encoder_cleanup(struct drm_encoder *encoder); 870*592ffb21SWarner Losh 871*592ffb21SWarner Losh extern char *drm_get_connector_name(struct drm_connector *connector); 872*592ffb21SWarner Losh extern char *drm_get_connector_status_name(enum drm_connector_status status); 873*592ffb21SWarner Losh extern char *drm_get_dpms_name(int val); 874*592ffb21SWarner Losh extern char *drm_get_dvi_i_subconnector_name(int val); 875*592ffb21SWarner Losh extern char *drm_get_dvi_i_select_name(int val); 876*592ffb21SWarner Losh extern char *drm_get_tv_subconnector_name(int val); 877*592ffb21SWarner Losh extern char *drm_get_dirty_info_name(int val); 878*592ffb21SWarner Losh extern char *drm_get_tv_select_name(int val); 879*592ffb21SWarner Losh extern void drm_fb_release(struct drm_file *file_priv); 880*592ffb21SWarner Losh extern int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group); 881*592ffb21SWarner Losh extern void drm_mode_group_free(struct drm_mode_group *group); 882*592ffb21SWarner Losh extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 883*592ffb21SWarner Losh extern bool drm_probe_ddc(device_t adapter); 884*592ffb21SWarner Losh extern struct edid *drm_get_edid(struct drm_connector *connector, 885*592ffb21SWarner Losh device_t adapter); 886*592ffb21SWarner Losh extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 887*592ffb21SWarner Losh extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 888*592ffb21SWarner Losh extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 889*592ffb21SWarner Losh extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); 890*592ffb21SWarner Losh extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 891*592ffb21SWarner Losh const struct drm_display_mode *mode); 892*592ffb21SWarner Losh extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode); 893*592ffb21SWarner Losh extern void drm_mode_config_init(struct drm_device *dev); 894*592ffb21SWarner Losh extern void drm_mode_config_reset(struct drm_device *dev); 895*592ffb21SWarner Losh extern void drm_mode_config_cleanup(struct drm_device *dev); 896*592ffb21SWarner Losh extern void drm_mode_set_name(struct drm_display_mode *mode); 897*592ffb21SWarner Losh extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); 898*592ffb21SWarner Losh extern int drm_mode_width(const struct drm_display_mode *mode); 899*592ffb21SWarner Losh extern int drm_mode_height(const struct drm_display_mode *mode); 900*592ffb21SWarner Losh 901*592ffb21SWarner Losh /* for us by fb module */ 902*592ffb21SWarner Losh extern int drm_mode_attachmode_crtc(struct drm_device *dev, 903*592ffb21SWarner Losh struct drm_crtc *crtc, 904*592ffb21SWarner Losh const struct drm_display_mode *mode); 905*592ffb21SWarner Losh extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); 906*592ffb21SWarner Losh 907*592ffb21SWarner Losh extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); 908*592ffb21SWarner Losh extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); 909*592ffb21SWarner Losh extern void drm_mode_list_concat(struct list_head *head, 910*592ffb21SWarner Losh struct list_head *new); 911*592ffb21SWarner Losh extern void drm_mode_validate_size(struct drm_device *dev, 912*592ffb21SWarner Losh struct list_head *mode_list, 913*592ffb21SWarner Losh int maxX, int maxY, int maxPitch); 914*592ffb21SWarner Losh extern void drm_mode_validate_clocks(struct drm_device *dev, 915*592ffb21SWarner Losh struct list_head *mode_list, 916*592ffb21SWarner Losh int *min, int *max, int n_ranges); 917*592ffb21SWarner Losh extern void drm_mode_prune_invalid(struct drm_device *dev, 918*592ffb21SWarner Losh struct list_head *mode_list, bool verbose); 919*592ffb21SWarner Losh extern void drm_mode_sort(struct list_head *mode_list); 920*592ffb21SWarner Losh extern int drm_mode_hsync(const struct drm_display_mode *mode); 921*592ffb21SWarner Losh extern int drm_mode_vrefresh(const struct drm_display_mode *mode); 922*592ffb21SWarner Losh extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, 923*592ffb21SWarner Losh int adjust_flags); 924*592ffb21SWarner Losh extern void drm_mode_connector_list_update(struct drm_connector *connector); 925*592ffb21SWarner Losh extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 926*592ffb21SWarner Losh struct edid *edid); 927*592ffb21SWarner Losh extern int drm_object_property_set_value(struct drm_mode_object *obj, 928*592ffb21SWarner Losh struct drm_property *property, 929*592ffb21SWarner Losh uint64_t val); 930*592ffb21SWarner Losh extern int drm_object_property_get_value(struct drm_mode_object *obj, 931*592ffb21SWarner Losh struct drm_property *property, 932*592ffb21SWarner Losh uint64_t *value); 933*592ffb21SWarner Losh extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); 934*592ffb21SWarner Losh extern void drm_framebuffer_set_object(struct drm_device *dev, 935*592ffb21SWarner Losh unsigned long handle); 936*592ffb21SWarner Losh extern int drm_framebuffer_init(struct drm_device *dev, 937*592ffb21SWarner Losh struct drm_framebuffer *fb, 938*592ffb21SWarner Losh const struct drm_framebuffer_funcs *funcs); 939*592ffb21SWarner Losh extern void drm_framebuffer_unreference(struct drm_framebuffer *fb); 940*592ffb21SWarner Losh extern void drm_framebuffer_reference(struct drm_framebuffer *fb); 941*592ffb21SWarner Losh extern void drm_framebuffer_remove(struct drm_framebuffer *fb); 942*592ffb21SWarner Losh extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); 943*592ffb21SWarner Losh extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); 944*592ffb21SWarner Losh extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); 945*592ffb21SWarner Losh extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 946*592ffb21SWarner Losh extern bool drm_crtc_in_use(struct drm_crtc *crtc); 947*592ffb21SWarner Losh 948*592ffb21SWarner Losh extern void drm_object_attach_property(struct drm_mode_object *obj, 949*592ffb21SWarner Losh struct drm_property *property, 950*592ffb21SWarner Losh uint64_t init_val); 951*592ffb21SWarner Losh extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, 952*592ffb21SWarner Losh const char *name, int num_values); 953*592ffb21SWarner Losh extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, 954*592ffb21SWarner Losh const char *name, 955*592ffb21SWarner Losh const struct drm_prop_enum_list *props, 956*592ffb21SWarner Losh int num_values); 957*592ffb21SWarner Losh struct drm_property *drm_property_create_bitmask(struct drm_device *dev, 958*592ffb21SWarner Losh int flags, const char *name, 959*592ffb21SWarner Losh const struct drm_prop_enum_list *props, 960*592ffb21SWarner Losh int num_values); 961*592ffb21SWarner Losh struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 962*592ffb21SWarner Losh const char *name, 963*592ffb21SWarner Losh uint64_t min, uint64_t max); 964*592ffb21SWarner Losh extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); 965*592ffb21SWarner Losh extern int drm_property_add_enum(struct drm_property *property, int index, 966*592ffb21SWarner Losh uint64_t value, const char *name); 967*592ffb21SWarner Losh extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); 968*592ffb21SWarner Losh extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 969*592ffb21SWarner Losh char *formats[]); 970*592ffb21SWarner Losh extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 971*592ffb21SWarner Losh extern int drm_mode_create_dithering_property(struct drm_device *dev); 972*592ffb21SWarner Losh extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 973*592ffb21SWarner Losh extern char *drm_get_encoder_name(struct drm_encoder *encoder); 974*592ffb21SWarner Losh 975*592ffb21SWarner Losh extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 976*592ffb21SWarner Losh struct drm_encoder *encoder); 977*592ffb21SWarner Losh extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, 978*592ffb21SWarner Losh struct drm_encoder *encoder); 979*592ffb21SWarner Losh extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, 980*592ffb21SWarner Losh int gamma_size); 981*592ffb21SWarner Losh extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 982*592ffb21SWarner Losh uint32_t id, uint32_t type); 983*592ffb21SWarner Losh /* IOCTLs */ 984*592ffb21SWarner Losh extern int drm_mode_getresources(struct drm_device *dev, 985*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 986*592ffb21SWarner Losh extern int drm_mode_getplane_res(struct drm_device *dev, void *data, 987*592ffb21SWarner Losh struct drm_file *file_priv); 988*592ffb21SWarner Losh extern int drm_mode_getcrtc(struct drm_device *dev, 989*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 990*592ffb21SWarner Losh extern int drm_mode_getconnector(struct drm_device *dev, 991*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 992*592ffb21SWarner Losh extern int drm_mode_setcrtc(struct drm_device *dev, 993*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 994*592ffb21SWarner Losh extern int drm_mode_getplane(struct drm_device *dev, 995*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 996*592ffb21SWarner Losh extern int drm_mode_setplane(struct drm_device *dev, 997*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 998*592ffb21SWarner Losh extern int drm_mode_cursor_ioctl(struct drm_device *dev, 999*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1000*592ffb21SWarner Losh extern int drm_mode_addfb(struct drm_device *dev, 1001*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1002*592ffb21SWarner Losh extern int drm_mode_addfb2(struct drm_device *dev, 1003*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1004*592ffb21SWarner Losh extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); 1005*592ffb21SWarner Losh extern int drm_mode_rmfb(struct drm_device *dev, 1006*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1007*592ffb21SWarner Losh extern int drm_mode_getfb(struct drm_device *dev, 1008*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1009*592ffb21SWarner Losh extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, 1010*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1011*592ffb21SWarner Losh extern int drm_mode_addmode_ioctl(struct drm_device *dev, 1012*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1013*592ffb21SWarner Losh extern int drm_mode_rmmode_ioctl(struct drm_device *dev, 1014*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1015*592ffb21SWarner Losh extern int drm_mode_attachmode_ioctl(struct drm_device *dev, 1016*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1017*592ffb21SWarner Losh extern int drm_mode_detachmode_ioctl(struct drm_device *dev, 1018*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1019*592ffb21SWarner Losh 1020*592ffb21SWarner Losh extern int drm_mode_getproperty_ioctl(struct drm_device *dev, 1021*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1022*592ffb21SWarner Losh extern int drm_mode_getblob_ioctl(struct drm_device *dev, 1023*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1024*592ffb21SWarner Losh extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev, 1025*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1026*592ffb21SWarner Losh extern int drm_mode_hotplug_ioctl(struct drm_device *dev, 1027*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1028*592ffb21SWarner Losh extern int drm_mode_replacefb(struct drm_device *dev, 1029*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1030*592ffb21SWarner Losh extern int drm_mode_getencoder(struct drm_device *dev, 1031*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1032*592ffb21SWarner Losh extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, 1033*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1034*592ffb21SWarner Losh extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 1035*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1036*592ffb21SWarner Losh extern u8 *drm_find_cea_extension(struct edid *edid); 1037*592ffb21SWarner Losh extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); 1038*592ffb21SWarner Losh extern bool drm_detect_hdmi_monitor(struct edid *edid); 1039*592ffb21SWarner Losh extern bool drm_detect_monitor_audio(struct edid *edid); 1040*592ffb21SWarner Losh extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 1041*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1042*592ffb21SWarner Losh extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, 1043*592ffb21SWarner Losh int hdisplay, int vdisplay, int vrefresh, 1044*592ffb21SWarner Losh bool reduced, bool interlaced, bool margins); 1045*592ffb21SWarner Losh extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, 1046*592ffb21SWarner Losh int hdisplay, int vdisplay, int vrefresh, 1047*592ffb21SWarner Losh bool interlaced, int margins); 1048*592ffb21SWarner Losh extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, 1049*592ffb21SWarner Losh int hdisplay, int vdisplay, int vrefresh, 1050*592ffb21SWarner Losh bool interlaced, int margins, int GTF_M, 1051*592ffb21SWarner Losh int GTF_2C, int GTF_K, int GTF_2J); 1052*592ffb21SWarner Losh extern int drm_add_modes_noedid(struct drm_connector *connector, 1053*592ffb21SWarner Losh int hdisplay, int vdisplay); 1054*592ffb21SWarner Losh extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode); 1055*592ffb21SWarner Losh 1056*592ffb21SWarner Losh extern int drm_edid_header_is_valid(const u8 *raw_edid); 1057*592ffb21SWarner Losh extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1058*592ffb21SWarner Losh extern bool drm_edid_is_valid(struct edid *edid); 1059*592ffb21SWarner Losh struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1060*592ffb21SWarner Losh int hsize, int vsize, int fresh, 1061*592ffb21SWarner Losh bool rb); 1062*592ffb21SWarner Losh 1063*592ffb21SWarner Losh extern int drm_mode_create_dumb_ioctl(struct drm_device *dev, 1064*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1065*592ffb21SWarner Losh extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev, 1066*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1067*592ffb21SWarner Losh extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1068*592ffb21SWarner Losh void *data, struct drm_file *file_priv); 1069*592ffb21SWarner Losh extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, 1070*592ffb21SWarner Losh struct drm_file *file_priv); 1071*592ffb21SWarner Losh extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, 1072*592ffb21SWarner Losh struct drm_file *file_priv); 1073*592ffb21SWarner Losh 1074*592ffb21SWarner Losh extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, 1075*592ffb21SWarner Losh int *bpp); 1076*592ffb21SWarner Losh extern int drm_format_num_planes(uint32_t format); 1077*592ffb21SWarner Losh extern int drm_format_plane_cpp(uint32_t format, int plane); 1078*592ffb21SWarner Losh extern int drm_format_horz_chroma_subsampling(uint32_t format); 1079*592ffb21SWarner Losh extern int drm_format_vert_chroma_subsampling(uint32_t format); 1080*592ffb21SWarner Losh 1081*592ffb21SWarner Losh #endif /* __DRM_CRTC_H__ */ 1082