vmware/xorg: Properly detect overlay support
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 8 Dec 2009 20:05:30 +0000 (21:05 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 9 Dec 2009 08:51:05 +0000 (09:51 +0100)
src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
src/gallium/winsys/drm/vmware/xorg/vmw_video.c

index 85c21ca60e3c12418d1a4009c634c7d51c297d40..7265f767a53cdf4a4eb5617344c32646146c47f2 100644 (file)
@@ -73,6 +73,8 @@ void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
  * vmw_ioctl.c
  */
 
+int vmw_ioctl_supports_overlay(struct vmw_driver *vmw);
+
 int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
 
 struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
index c84368bab7f1cabe6f62b85d8309ad4936d61533..0d1a0fcee630fe796048acd3e68307f9ab611629 100644 (file)
@@ -56,6 +56,37 @@ struct vmw_dma_buffer
     uint32_t size;
 };
 
+static int
+vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out)
+{
+    struct drm_vmw_getparam_arg gp_arg;
+    int ret;
+
+    memset(&gp_arg, 0, sizeof(gp_arg));
+    gp_arg.param = param;
+    ret = drmCommandWriteRead(vmw->fd, DRM_VMW_GET_PARAM,
+           &gp_arg, sizeof(gp_arg));
+
+    if (ret == 0) {
+       *out = gp_arg.value;
+    }
+
+    return ret;
+}
+
+int
+vmw_ioctl_supports_overlay(struct vmw_driver *vmw)
+{
+    uint64_t value;
+    int ret;
+
+    ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_OVERLAY_IOCTL, &value);
+    if (ret)
+       return ret;
+
+    return value ? 0 : -ENOSYS;
+}
+
 int
 vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot)
 {
index b99bb2f7e345026ffbcbbc922a93e23d7fbd4c0a..5674e4f352969ee58ef8df23dfa3039ef5a122f5 100644 (file)
@@ -276,6 +276,11 @@ vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
 
     debug_printf("%s: enter\n", __func__);
 
+    if (vmw_ioctl_supports_overlay(vmw) != 0) {
+        debug_printf("No overlay ioctl support\n");
+        return FALSE;
+    }
+
     numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors);
 
     newAdaptor = vmw_video_init_adaptor(pScrn, vmw);