Mesa (mesa_7_7_branch): vmware/xorg: Properly detect overlay support

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Thu Dec 10 03:53:10 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 5e2a86cb1be935f1c54efcf5b4e6a1b7371ff5e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e2a86cb1be935f1c54efcf5b4e6a1b7371ff5e7

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Tue Dec  8 21:05:30 2009 +0100

vmware/xorg: Properly detect overlay support

---

 src/gallium/winsys/drm/vmware/xorg/vmw_driver.h |    2 +
 src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c  |   31 +++++++++++++++++++++++
 src/gallium/winsys/drm/vmware/xorg/vmw_video.c  |    5 +++
 3 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
index 85c21ca..7265f76 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
@@ -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,
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
index c84368b..0d1a0fc 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
@@ -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)
 {
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
index b99bb2f..5674e4f 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
@@ -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);




More information about the mesa-commit mailing list