From 5bffbd6e275efffbb649c20c528a11412ccf99cd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 5 Apr 2007 13:34:50 +1000 Subject: initial userspace interface to get modes --- shared-core/drm.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 3c59cd40..33194dcc 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -888,6 +888,74 @@ typedef union drm_mm_init_arg{ } rep; } drm_mm_init_arg_t; +/* + * Drm mode setting + */ + +struct drm_mode_modeinfo { + + unsigned int id; + + unsigned int clock; + unsigned short hdisplay, hsync_start, hsync_end, htotal, hskew; + unsigned short vdisplay, vsync_start, vsync_end, vtotal, vscan; + + unsigned int flags; +// int count_flag; +// unsigned int __user *modeFlags; +}; + +struct drm_mode_card_res { + + unsigned int fb_id; + + int count_crtcs; + int count_outputs; + int count_modes; + struct drm_mode_modeinfo __user *modes; + +}; + +struct drm_mode_crtc { + unsigned int crtc_id; /**< Id */ + unsigned int buffer_id; /**< Id of framebuffer */ + + int x, y; /**< Position on the frameuffer */ + unsigned int width, height; + unsigned int mode; /**< Current mode used */ + + int count_outputs; + unsigned int outputs; /**< Outputs that are connected */ + + int count_possibles; + unsigned int possibles; /**< Outputs that can be connected */ + + unsigned int __user *set_outputs; /**< Outputs to be connected */ + + int gamma_size; + +}; + +struct drm_mode_get_output { + + unsigned int output; /**< Id */ + unsigned int crtc; /**< Id of crtc */ + + unsigned int connection; + unsigned int width, height; /**< HxW in millimeters */ + unsigned int subpixel; + + int count_crtcs; + unsigned int crtcs; /**< possible crtc to connect to */ + + int count_clones; + unsigned int clones; /**< list of clones */ + + int count_modes; + unsigned int __user *modes; /**< list of modes it supports */ + +}; + /** * \name Ioctls Definitions */ @@ -959,6 +1027,10 @@ typedef union drm_mm_init_arg{ #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) +#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) +#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, drm_mode_crtc_t) +#define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, drm_mode_get_output_t) + /*@}*/ /** -- cgit v1.2.3 From 7bb112fecadc6fe42e5828b861600691071ccd91 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 5 Apr 2007 17:06:42 +1000 Subject: checkpoint commit: added getresources, crtc and output This adds the user interfaces from Jakob and hooks them up for 3 ioctls GetResources, GetCrtc and GetOutput. I've made the ids for everything fbs, crtcs, outputs and modes go via idr as per krh's suggestion on irc as it make the code nice and consistent. --- shared-core/drm.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 33194dcc..1af0be38 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -892,6 +892,8 @@ typedef union drm_mm_init_arg{ * Drm mode setting */ +#define DRM_DISPLAY_MODE_LEN 32 + struct drm_mode_modeinfo { unsigned int id; @@ -901,8 +903,8 @@ struct drm_mode_modeinfo { unsigned short vdisplay, vsync_start, vsync_end, vtotal, vscan; unsigned int flags; -// int count_flag; -// unsigned int __user *modeFlags; + + char name[DRM_DISPLAY_MODE_LEN]; }; struct drm_mode_card_res { @@ -910,7 +912,11 @@ struct drm_mode_card_res { unsigned int fb_id; int count_crtcs; + unsigned int __user *crtc_id; + int count_outputs; + unsigned int __user *output_id; + int count_modes; struct drm_mode_modeinfo __user *modes; @@ -918,10 +924,10 @@ struct drm_mode_card_res { struct drm_mode_crtc { unsigned int crtc_id; /**< Id */ - unsigned int buffer_id; /**< Id of framebuffer */ + unsigned int fb_id; /**< Id of framebuffer */ int x, y; /**< Position on the frameuffer */ - unsigned int width, height; + unsigned int mode; /**< Current mode used */ int count_outputs; @@ -942,7 +948,7 @@ struct drm_mode_get_output { unsigned int crtc; /**< Id of crtc */ unsigned int connection; - unsigned int width, height; /**< HxW in millimeters */ + unsigned int mm_width, mm_height; /**< HxW in millimeters */ unsigned int subpixel; int count_crtcs; @@ -1028,8 +1034,8 @@ struct drm_mode_get_output { #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) -#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, drm_mode_crtc_t) -#define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, drm_mode_get_output_t) +#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) +#define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, struct drm_mode_get_output) /*@}*/ -- cgit v1.2.3 From b4094864f188a1346cc3b51bcb457beeacefbf82 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 5 Apr 2007 18:01:02 +1000 Subject: checkpoint commit: implement SetCrtc so modes can in theory be set from user This hooks up the userspace mode set it "seems" to work. --- shared-core/drm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 1af0be38..49bc41bc 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -1036,7 +1036,7 @@ struct drm_mode_get_output { #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, struct drm_mode_get_output) - +#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA3, struct drm_mode_crtc) /*@}*/ /** -- cgit v1.2.3 From b50bda002b824efb24e18e8d514ff0ca763c15b9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 10 Apr 2007 18:44:47 +1000 Subject: add addfb/rmfb ioctls Originally from Jakob, cleaned up by airlied. --- shared-core/drm.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 49bc41bc..8329609f 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -962,6 +962,14 @@ struct drm_mode_get_output { }; +struct drm_mode_fb_cmd { + unsigned int buffer_id; + unsigned int width, height; + unsigned int pitch; + unsigned int bpp; + unsigned int handle; +}; + /** * \name Ioctls Definitions */ @@ -1037,6 +1045,8 @@ struct drm_mode_get_output { #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_GETOUTPUT DRM_IOWR(0xA2, struct drm_mode_get_output) #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA3, struct drm_mode_crtc) +#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xA4, struct drm_mode_fb_cmd) +#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int) /*@}*/ /** -- cgit v1.2.3 From 1e39dc43230ba1827eedc29ab422464281ec3e1b Mon Sep 17 00:00:00 2001 From: David Airlie Date: Tue, 10 Apr 2007 16:25:31 +1000 Subject: export output name to userspace --- shared-core/drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 8329609f..f1afc049 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -891,7 +891,7 @@ typedef union drm_mm_init_arg{ /* * Drm mode setting */ - +#define DRM_OUTPUT_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 struct drm_mode_modeinfo { @@ -946,6 +946,7 @@ struct drm_mode_get_output { unsigned int output; /**< Id */ unsigned int crtc; /**< Id of crtc */ + unsigned char name[DRM_OUTPUT_NAME_LEN]; unsigned int connection; unsigned int mm_width, mm_height; /**< HxW in millimeters */ -- cgit v1.2.3 From 44be9c9d5950d3b2ba4d5527189abec8dac0686f Mon Sep 17 00:00:00 2001 From: David Airlie Date: Wed, 11 Apr 2007 13:19:30 +1000 Subject: add an fb count + id get to the get resources code path --- shared-core/drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f1afc049..a5330b28 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -909,7 +909,8 @@ struct drm_mode_modeinfo { struct drm_mode_card_res { - unsigned int fb_id; + int count_fbs; + unsigned int __user *fb_id; int count_crtcs; unsigned int __user *crtc_id; -- cgit v1.2.3 From a6cc6a778f8b2f86300a8ce87441d044fd67f930 Mon Sep 17 00:00:00 2001 From: David Airlie Date: Wed, 11 Apr 2007 17:13:45 +1000 Subject: add support for setting a framebuffer depth --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index a5330b28..621b201c 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -970,6 +970,7 @@ struct drm_mode_fb_cmd { unsigned int pitch; unsigned int bpp; unsigned int handle; + unsigned int depth; }; /** -- cgit v1.2.3 From 2e21779992bd5026d8ec4dea52466377dbe5a0ed Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Wed, 11 Apr 2007 12:51:52 -0700 Subject: Add new buffer object type for kernel allocations that don't initially have a user mapping. --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 621b201c..698f851b 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -795,6 +795,7 @@ typedef struct drm_fence_arg { typedef enum { drm_bo_type_dc, + drm_bo_type_kernel, /* for initial kernel allocations */ drm_bo_type_user, drm_bo_type_fake }drm_bo_type_t; -- cgit v1.2.3 From a81558d8b3ee17fbf46e32b10732e22fcd997858 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 12 Apr 2007 08:45:40 +1000 Subject: add getfb ioctl --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 698f851b..b5b0aa52 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -1051,6 +1051,7 @@ struct drm_mode_fb_cmd { #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA3, struct drm_mode_crtc) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xA4, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int) +#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xA6, struct drm_mode_fb_cmd) /*@}*/ /** -- cgit v1.2.3