diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-08-25 19:03:42 +0200 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-08-25 19:03:42 +0200 |
commit | 35c8ce6c2945ff09dc52dbc2a7382798ba64c1da (patch) | |
tree | bf33d46cef8df3f13f990d399b19df80befcf4c3 | |
parent | 1d3cf107d20cb11ad07667622785ef8341ab9c2a (diff) |
ttm and buffer objects ioctl stubs.
-rw-r--r-- | linux-core/drmP.h | 6 | ||||
-rw-r--r-- | linux-core/drm_bo.c | 32 | ||||
-rw-r--r-- | linux-core/drm_ttm.c | 5 | ||||
-rw-r--r-- | linux-core/drm_ttm.h | 2 | ||||
-rw-r--r-- | shared-core/drm.h | 77 |
5 files changed, 120 insertions, 2 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 3dd7e775..9e1e4ba8 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1347,6 +1347,12 @@ extern int drm_fence_object_wait(drm_device_t * dev, drm_fence_object_t * fence, extern int drm_fence_ioctl(DRM_IOCTL_ARGS); +/* + * buffer objects (drm_bo.c) + */ + +extern int drm_bo_ioctl(DRM_IOCTL_ARGS); + /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap(struct drm_map *map, diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index d87cd2a1..6a677578 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -277,6 +277,38 @@ int drm_bo_alloc_space(drm_device_t *dev, int tt, drm_buffer_object_t *buf) } #endif +static int drm_do_bo_ioctl(drm_file_t *priv, int num_requests, void __user *data) +{ + return 0; +} + +int drm_bo_ioctl(DRM_IOCTL_ARGS) +{ + DRM_DEVICE; + drm_bo_arg_t arg; + unsigned long data_ptr; + (void) dev; + + DRM_COPY_FROM_USER_IOCTL(arg, (void __user *)data, sizeof(arg)); + data_ptr = arg.data_lo; + + if (sizeof(data_ptr) > 4) { + int shift = 32; + data_ptr |= arg.data_hi << shift; + } + + switch(arg.op) { + case drm_op_bo: + return drm_do_bo_ioctl(priv, arg.num_requests, + (void __user *) data_ptr); + case drm_op_ttm: + return drm_ttm_ioctl(priv, arg.num_requests, + (drm_ttm_arg_t __user *) data_ptr); + } + + return 0; +} + diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c index 806c109b..46878a7d 100644 --- a/linux-core/drm_ttm.c +++ b/linux-core/drm_ttm.c @@ -798,3 +798,8 @@ int drm_add_ttm(drm_device_t * dev, unsigned size, drm_map_list_t ** maplist) return 0; } + +int drm_ttm_ioctl(drm_file_t *priv, int num_requests, drm_ttm_arg_t __user *data) +{ + return 0; +} diff --git a/linux-core/drm_ttm.h b/linux-core/drm_ttm.h index ea9a8372..81006c3c 100644 --- a/linux-core/drm_ttm.h +++ b/linux-core/drm_ttm.h @@ -148,6 +148,8 @@ extern int drm_destroy_ttm(drm_ttm_t * ttm); extern void drm_user_destroy_region(drm_ttm_backend_list_t * entry); extern int drm_ttm_add_mm_to_list(drm_ttm_t * ttm, struct mm_struct *mm); extern void drm_ttm_delete_mm(drm_ttm_t * ttm, struct mm_struct *mm); +extern int drm_ttm_ioctl(drm_file_t *priv, int num_requests, + drm_ttm_arg_t __user *data); #define DRM_MASK_VAL(dest, mask, val) \ (dest) = ((dest) & ~(mask)) | ((val) & (mask)); diff --git a/shared-core/drm.h b/shared-core/drm.h index bda565b3..fb18b5c5 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -671,7 +671,80 @@ typedef struct drm_fence_arg { #define DRM_BO_MASK_MEM 0xFFFFFFFF #define DRM_BO_HINT_PREFER_VRAM 0x00000001 -#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 +#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 +#define DRM_BO_HINT_DONT_BLOCK 0x00000004 + +/* + * Multiplexing ioctl argument. + */ + +typedef struct drm_bo_arg { + unsigned num_requests; + enum { + drm_op_bo, + drm_op_ttm + } op; + unsigned data_lo; + unsigned data_hi; +} drm_bo_arg_t; + +typedef struct drm_ttm_arg { + enum { + drm_ttm_create, + drm_ttm_destroy, + drm_ttm_reference, + drm_ttm_unreference + } op; + unsigned handle; + unsigned size_lo; + unsigned size_hi; +}drm_ttm_arg_t; + + +typedef struct drm_bo_arg_request { + unsigned handle; /* User space handle */ + unsigned mask; + unsigned hint; + unsigned size_lo; + unsigned size_hi; + + enum { + drm_bo_type_ttm, + drm_bo_type_dc, + drm_bo_type_user + }type; + unsigned arg_handle; + unsigned user_pointer_lo; + unsigned user_pointer_hi; + enum { + drm_bo_create, + drm_bo_validate, + drm_bo_map, + drm_bo_fence, + drm_bo_destroy, + drm_bo_reference, + drm_bo_unreference + } op; +} drm_bo_arg_request_t; + +typedef struct drm_bo_arg_reply { + int ret; + unsigned handle; + unsigned flags; + unsigned size_lo; + unsigned size_hi; + unsigned offset_lo; + unsigned offset_hi; + unsigned arg_handle; + unsigned map_flags; +}drm_bo_arg_reply_t; + + +typedef union { + drm_bo_arg_request_t bo_req; + drm_bo_arg_reply_t bo_rep; +}drm_bo_arg_data; + /** * \name Ioctls Definitions @@ -739,7 +812,7 @@ typedef struct drm_fence_arg { #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) - +#define DRM_IOCTL_BUFFER_OBJECT DRM_IOWR(0x3c, drm_buffer_arg_t) /*@}*/ |