headers: Update drm.h
[platform/upstream/libdrm.git] / include / drm / drm_mode.h
index 115f36e..7a7856e 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
+#include "drm.h"
+
 #define DRM_DISPLAY_INFO_LEN   32
 #define DRM_CONNECTOR_NAME_LEN 32
 #define DRM_DISPLAY_MODE_LEN   32
 #define DRM_MODE_FLAG_PIXMUX                   (1<<11)
 #define DRM_MODE_FLAG_DBLCLK                   (1<<12)
 #define DRM_MODE_FLAG_CLKDIV2                  (1<<13)
+ /*
+  * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX
+  * (define not exposed to user space).
+  */
 #define DRM_MODE_FLAG_3D_MASK                  (0x1f<<14)
 #define  DRM_MODE_FLAG_3D_NONE                 (0<<14)
 #define  DRM_MODE_FLAG_3D_FRAME_PACKING                (1<<14)
 #define DRM_MODE_SCALE_CENTER          2 /* Centered, no scaling */
 #define DRM_MODE_SCALE_ASPECT          3 /* Full screen, preserve aspect */
 
+/* Picture aspect ratio options */
+#define DRM_MODE_PICTURE_ASPECT_NONE   0
+#define DRM_MODE_PICTURE_ASPECT_4_3    1
+#define DRM_MODE_PICTURE_ASPECT_16_9   2
+
 /* Dithering mode options */
 #define DRM_MODE_DITHERING_OFF 0
 #define DRM_MODE_DITHERING_ON  1
 
 struct drm_mode_modeinfo {
        __u32 clock;
-       __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
-       __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
+       __u16 hdisplay;
+       __u16 hsync_start;
+       __u16 hsync_end;
+       __u16 htotal;
+       __u16 hskew;
+       __u16 vdisplay;
+       __u16 vsync_start;
+       __u16 vsync_end;
+       __u16 vtotal;
+       __u16 vscan;
 
        __u32 vrefresh;
 
@@ -113,8 +132,10 @@ struct drm_mode_card_res {
        __u32 count_crtcs;
        __u32 count_connectors;
        __u32 count_encoders;
-       __u32 min_width, max_width;
-       __u32 min_height, max_height;
+       __u32 min_width;
+       __u32 max_width;
+       __u32 min_height;
+       __u32 max_height;
 };
 
 struct drm_mode_crtc {
@@ -124,30 +145,35 @@ struct drm_mode_crtc {
        __u32 crtc_id; /**< Id */
        __u32 fb_id; /**< Id of framebuffer */
 
-       __u32 x, y; /**< Position on the frameuffer */
+       __u32 x; /**< x Position on the framebuffer */
+       __u32 y; /**< y Position on the framebuffer */
 
        __u32 gamma_size;
        __u32 mode_valid;
        struct drm_mode_modeinfo mode;
 };
 
-#define DRM_MODE_PRESENT_TOP_FIELD     (1<<0)
-#define DRM_MODE_PRESENT_BOTTOM_FIELD  (1<<1)
+#define DRM_MODE_PRESENT_TOP_FIELD     (1<<0)
+#define DRM_MODE_PRESENT_BOTTOM_FIELD  (1<<1)
 
 /* Planes blend with or override other bits on the CRTC */
 struct drm_mode_set_plane {
        __u32 plane_id;
        __u32 crtc_id;
        __u32 fb_id; /* fb object contains surface format type */
-       __u32 flags;
+       __u32 flags; /* see above flags */
 
        /* Signed dest location allows it to be partially off screen */
-       __s32 crtc_x, crtc_y;
-       __u32 crtc_w, crtc_h;
+       __s32 crtc_x;
+       __s32 crtc_y;
+       __u32 crtc_w;
+       __u32 crtc_h;
 
        /* Source values are 16.16 fixed point */
-       __u32 src_x, src_y;
-       __u32 src_h, src_w;
+       __u32 src_x;
+       __u32 src_y;
+       __u32 src_h;
+       __u32 src_w;
 };
 
 struct drm_mode_get_plane {
@@ -233,8 +259,11 @@ struct drm_mode_get_connector {
        __u32 connector_type_id;
 
        __u32 connection;
-       __u32 mm_width, mm_height; /**< HxW in millimeters */
+       __u32 mm_width;  /**< width in millimeters */
+       __u32 mm_height; /**< height in millimeters */
        __u32 subpixel;
+
+       __u32 pad;
 };
 
 #define DRM_MODE_PROP_PENDING  (1<<0)
@@ -259,6 +288,13 @@ struct drm_mode_get_connector {
 #define DRM_MODE_PROP_OBJECT           DRM_MODE_PROP_TYPE(1)
 #define DRM_MODE_PROP_SIGNED_RANGE     DRM_MODE_PROP_TYPE(2)
 
+/* the PROP_ATOMIC flag is used to hide properties from userspace that
+ * is not aware of atomic properties.  This is mostly to work around
+ * older userspace (DDX drivers) that read/write each prop they find,
+ * witout being aware that this could be triggering a lengthy modeset.
+ */
+#define DRM_MODE_PROP_ATOMIC        0x80000000
+
 struct drm_mode_property_enum {
        __u64 value;
        char name[DRM_PROP_NAME_LEN];
@@ -273,6 +309,8 @@ struct drm_mode_get_property {
        char name[DRM_PROP_NAME_LEN];
 
        __u32 count_values;
+       /* This is only used to count enum values, not blobs. The _blobs is
+        * simply because of a historical reason, i.e. backwards compat. */
        __u32 count_enum_blobs;
 };
 
@@ -290,6 +328,7 @@ struct drm_mode_connector_set_property {
 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
 #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
 #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
+#define DRM_MODE_OBJECT_ANY 0
 
 struct drm_mode_obj_get_properties {
        __u64 props_ptr;
@@ -314,7 +353,8 @@ struct drm_mode_get_blob {
 
 struct drm_mode_fb_cmd {
        __u32 fb_id;
-       __u32 width, height;
+       __u32 width;
+       __u32 height;
        __u32 pitch;
        __u32 bpp;
        __u32 depth;
@@ -327,9 +367,10 @@ struct drm_mode_fb_cmd {
 
 struct drm_mode_fb_cmd2 {
        __u32 fb_id;
-       __u32 width, height;
+       __u32 width;
+       __u32 height;
        __u32 pixel_format; /* fourcc code from drm_fourcc.h */
-       __u32 flags;
+       __u32 flags; /* see above flags */
 
        /*
         * In case of planar formats, this ioctl allows up to 4
@@ -341,9 +382,9 @@ struct drm_mode_fb_cmd2 {
         *   followed by an interleaved U/V plane containing
         *   8 bit 2x2 subsampled colour difference samples.
         *
-        * So it would consist of Y as offset[0] and UV as
-        * offset[1].  Note that offset[0] will generally
-        * be 0.
+        * So it would consist of Y as offsets[0] and UV as
+        * offsets[1].  Note that offsets[0] will generally
+        * be 0 (but this is not required).
         *
         * To accommodate tiled, compressed, etc formats, a per-plane
         * modifier can be specified.  The default value of zero
@@ -362,6 +403,8 @@ struct drm_mode_fb_cmd2 {
 #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
 #define DRM_MODE_FB_DIRTY_FLAGS         0x03
 
+#define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
+
 /*
  * Mark a region of a framebuffer as dirty.
  *
@@ -402,20 +445,21 @@ struct drm_mode_mode_cmd {
        struct drm_mode_modeinfo mode;
 };
 
-#define DRM_MODE_CURSOR_BO     (1<<0)
-#define DRM_MODE_CURSOR_MOVE   (1<<1)
+#define DRM_MODE_CURSOR_BO     0x01
+#define DRM_MODE_CURSOR_MOVE   0x02
+#define DRM_MODE_CURSOR_FLAGS  0x03
 
 /*
- * depending on the value in flags diffrent members are used.
+ * depending on the value in flags different members are used.
  *
  * CURSOR_BO uses
- *    crtc
+ *    crtc_id
  *    width
  *    height
- *    handle - if 0 turns the cursor of
+ *    handle - if 0 turns the cursor off
  *
  * CURSOR_MOVE uses
- *    crtc
+ *    crtc_id
  *    x
  *    y
  */
@@ -453,6 +497,21 @@ struct drm_mode_crtc_lut {
        __u64 blue;
 };
 
+struct drm_color_ctm {
+       /* Conversion matrix in S31.32 format. */
+       __s64 matrix[9];
+};
+
+struct drm_color_lut {
+       /*
+        * Data is U0.16 fixed point format.
+        */
+       __u16 red;
+       __u16 green;
+       __u16 blue;
+       __u16 reserved;
+};
+
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
 #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC)
@@ -469,11 +528,14 @@ struct drm_mode_crtc_lut {
  * flip is already pending as the ioctl is called, EBUSY will be
  * returned.
  *
- * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will
- * request that drm sends back a vblank event (see drm.h: struct
- * drm_event_vblank) when the page flip is done.  The user_data field
- * passed in with this ioctl will be returned as the user_data field
- * in the vblank event struct.
+ * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank
+ * event (see drm.h: struct drm_event_vblank) when the page flip is
+ * done.  The user_data field passed in with this ioctl will be
+ * returned as the user_data field in the vblank event struct.
+ *
+ * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen
+ * 'as soon as possible', meaning that it not delay waiting for vblank.
+ * This may cause tearing on the screen.
  *
  * The reserved field must be zero until we figure out something
  * clever to use it for.
@@ -489,27 +551,27 @@ struct drm_mode_crtc_page_flip {
 
 /* create a dumb scanout buffer */
 struct drm_mode_create_dumb {
-        __u32 height;
-        __u32 width;
-        __u32 bpp;
-        __u32 flags;
-        /* handle, pitch, size will be returned */
-        __u32 handle;
-        __u32 pitch;
-        __u64 size;
+       __u32 height;
+       __u32 width;
+       __u32 bpp;
+       __u32 flags;
+       /* handle, pitch, size will be returned */
+       __u32 handle;
+       __u32 pitch;
+       __u64 size;
 };
 
 /* set up for mmap of a dumb scanout buffer */
 struct drm_mode_map_dumb {
-        /** Handle for the object being mapped. */
-        __u32 handle;
-        __u32 pad;
-        /**
-         * Fake offset to use for subsequent mmap call
-         *
-         * This is a fixed-size type for 32/64 compatibility.
-         */
-        __u64 offset;
+       /** Handle for the object being mapped. */
+       __u32 handle;
+       __u32 pad;
+       /**
+        * Fake offset to use for subsequent mmap call
+        *
+        * This is a fixed-size type for 32/64 compatibility.
+        */
+       __u64 offset;
 };
 
 struct drm_mode_destroy_dumb {
@@ -517,9 +579,16 @@ struct drm_mode_destroy_dumb {
 };
 
 /* page-flip flags are valid, plus: */
-#define DRM_MODE_ATOMIC_TEST_ONLY      0x0100
-#define DRM_MODE_ATOMIC_NONBLOCK       0x0200
-#define DRM_MODE_ATOMIC_ALLOW_MODESET  0x0400
+#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
+#define DRM_MODE_ATOMIC_NONBLOCK  0x0200
+#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
+
+#define DRM_MODE_ATOMIC_FLAGS (\
+               DRM_MODE_PAGE_FLIP_EVENT |\
+               DRM_MODE_PAGE_FLIP_ASYNC |\
+               DRM_MODE_ATOMIC_TEST_ONLY |\
+               DRM_MODE_ATOMIC_NONBLOCK |\
+               DRM_MODE_ATOMIC_ALLOW_MODESET)
 
 struct drm_mode_atomic {
        __u32 flags;
@@ -552,5 +621,4 @@ struct drm_mode_destroy_blob {
        __u32 blob_id;
 };
 
-
 #endif