diff options
author | Eric Anholt <eric@anholt.net> | 2008-10-21 14:38:50 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-10-22 23:46:33 -0400 |
commit | 49568873705e45a0de77b7824a9a46d3201019a7 (patch) | |
tree | a309fed16b27adb7c8b89dc994440f6b50ad05a5 /drivers/gpu/drm/drm_ioc32.c | |
parent | 42f52ef8d96b1434f12ad9f895b5412fda392847 (diff) |
drm: Add 32-bit compatibility for DRM_IOCTL_UPDATE_DRAW.
This fixes vblank support for a 32-bit X Server on a 64-bit kernel.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_ioc32.c')
-rw-r--r-- | drivers/gpu/drm/drm_ioc32.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index 90f5a8d9bdcb..920b72fbc958 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -64,6 +64,8 @@ | |||
64 | #define DRM_IOCTL_SG_ALLOC32 DRM_IOW( 0x38, drm_scatter_gather32_t) | 64 | #define DRM_IOCTL_SG_ALLOC32 DRM_IOW( 0x38, drm_scatter_gather32_t) |
65 | #define DRM_IOCTL_SG_FREE32 DRM_IOW( 0x39, drm_scatter_gather32_t) | 65 | #define DRM_IOCTL_SG_FREE32 DRM_IOW( 0x39, drm_scatter_gather32_t) |
66 | 66 | ||
67 | #define DRM_IOCTL_UPDATE_DRAW32 DRM_IOW( 0x3f, drm_update_draw32_t) | ||
68 | |||
67 | #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) | 69 | #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) |
68 | 70 | ||
69 | typedef struct drm_version_32 { | 71 | typedef struct drm_version_32 { |
@@ -952,6 +954,37 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd, | |||
952 | DRM_IOCTL_SG_FREE, (unsigned long)request); | 954 | DRM_IOCTL_SG_FREE, (unsigned long)request); |
953 | } | 955 | } |
954 | 956 | ||
957 | typedef struct drm_update_draw32 { | ||
958 | drm_drawable_t handle; | ||
959 | unsigned int type; | ||
960 | unsigned int num; | ||
961 | /* 64-bit version has a 32-bit pad here */ | ||
962 | u64 data; /**< Pointer */ | ||
963 | } __attribute__((packed)) drm_update_draw32_t; | ||
964 | |||
965 | static int compat_drm_update_draw(struct file *file, unsigned int cmd, | ||
966 | unsigned long arg) | ||
967 | { | ||
968 | drm_update_draw32_t update32; | ||
969 | struct drm_update_draw __user *request; | ||
970 | int err; | ||
971 | |||
972 | if (copy_from_user(&update32, (void __user *)arg, sizeof(update32))) | ||
973 | return -EFAULT; | ||
974 | |||
975 | request = compat_alloc_user_space(sizeof(*request)); | ||
976 | if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) || | ||
977 | __put_user(update32.handle, &request->handle) || | ||
978 | __put_user(update32.type, &request->type) || | ||
979 | __put_user(update32.num, &request->num) || | ||
980 | __put_user(update32.data, &request->data)) | ||
981 | return -EFAULT; | ||
982 | |||
983 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | ||
984 | DRM_IOCTL_UPDATE_DRAW, (unsigned long)request); | ||
985 | return err; | ||
986 | } | ||
987 | |||
955 | struct drm_wait_vblank_request32 { | 988 | struct drm_wait_vblank_request32 { |
956 | enum drm_vblank_seq_type type; | 989 | enum drm_vblank_seq_type type; |
957 | unsigned int sequence; | 990 | unsigned int sequence; |
@@ -1033,6 +1066,7 @@ drm_ioctl_compat_t *drm_compat_ioctls[] = { | |||
1033 | #endif | 1066 | #endif |
1034 | [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC32)] = compat_drm_sg_alloc, | 1067 | [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC32)] = compat_drm_sg_alloc, |
1035 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE32)] = compat_drm_sg_free, | 1068 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE32)] = compat_drm_sg_free, |
1069 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, | ||
1036 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, | 1070 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
1037 | }; | 1071 | }; |
1038 | 1072 | ||