diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-09-01 16:18:41 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-09-06 06:48:35 -0400 |
commit | f63f6a59d3905ac73aeeb617b27ac31516549ed9 (patch) | |
tree | 051927c6b2b8a1ff0816ea9e58aa462e55d884f4 /drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |
parent | 07999a7e0e409891cb27f34fa1da851d8484a5c5 (diff) |
vmwgfx: Add functionality to get 3D caps
Since we don't allow user-space to map the fifo anymore,
add a parameter to get fifo hw version and
an ioctl to copy the 3D capabilities.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecranz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index 74b1dc8a7cdd..5ecf96660644 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
@@ -54,6 +54,13 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, | |||
54 | case DRM_VMW_PARAM_MAX_FB_SIZE: | 54 | case DRM_VMW_PARAM_MAX_FB_SIZE: |
55 | param->value = dev_priv->vram_size; | 55 | param->value = dev_priv->vram_size; |
56 | break; | 56 | break; |
57 | case DRM_VMW_PARAM_FIFO_HW_VERSION: | ||
58 | { | ||
59 | __le32 __iomem *fifo_mem = dev_priv->mmio_virt; | ||
60 | |||
61 | param->value = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); | ||
62 | break; | ||
63 | } | ||
57 | default: | 64 | default: |
58 | DRM_ERROR("Illegal vmwgfx get param request: %d\n", | 65 | DRM_ERROR("Illegal vmwgfx get param request: %d\n", |
59 | param->param); | 66 | param->param); |
@@ -62,3 +69,44 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, | |||
62 | 69 | ||
63 | return 0; | 70 | return 0; |
64 | } | 71 | } |
72 | |||
73 | |||
74 | int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data, | ||
75 | struct drm_file *file_priv) | ||
76 | { | ||
77 | struct drm_vmw_get_3d_cap_arg *arg = | ||
78 | (struct drm_vmw_get_3d_cap_arg *) data; | ||
79 | struct vmw_private *dev_priv = vmw_priv(dev); | ||
80 | uint32_t size; | ||
81 | __le32 __iomem *fifo_mem; | ||
82 | void __user *buffer = (void __user *)((unsigned long)(arg->buffer)); | ||
83 | void *bounce; | ||
84 | int ret; | ||
85 | |||
86 | if (unlikely(arg->pad64 != 0)) { | ||
87 | DRM_ERROR("Illegal GET_3D_CAP argument.\n"); | ||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | size = (SVGA_FIFO_3D_CAPS_LAST - SVGA_FIFO_3D_CAPS + 1) << 2; | ||
92 | |||
93 | if (arg->max_size < size) | ||
94 | size = arg->max_size; | ||
95 | |||
96 | bounce = vmalloc(size); | ||
97 | if (unlikely(bounce == NULL)) { | ||
98 | DRM_ERROR("Failed to allocate bounce buffer for 3D caps.\n"); | ||
99 | return -ENOMEM; | ||
100 | } | ||
101 | |||
102 | fifo_mem = dev_priv->mmio_virt; | ||
103 | memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size); | ||
104 | |||
105 | ret = copy_to_user(buffer, bounce, size); | ||
106 | vfree(bounce); | ||
107 | |||
108 | if (unlikely(ret != 0)) | ||
109 | DRM_ERROR("Failed to report 3D caps info.\n"); | ||
110 | |||
111 | return ret; | ||
112 | } | ||