]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/vmwgfx: Correctly detect 3D
authorJakob Bornecrantz <jakob@vmware.com>
Sat, 30 Jan 2010 03:38:06 +0000 (03:38 +0000)
committerDave Airlie <airlied@redhat.com>
Mon, 1 Feb 2010 01:29:03 +0000 (11:29 +1000)
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c

index dedd121d8fe7153381942922581a20e413037582..f47ff2c05466bcd310371906b074d4b1217629e3 100644 (file)
@@ -357,6 +357,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
        dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier;
        register_pm_notifier(&dev_priv->pm_nb);
 
+       DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n");
+
        return 0;
 
 out_no_device:
index 50529a7f06fb6303f7127280c81821a7cb82cf5c..59acc51993f63b809f995431e290a7b8747094d1 100644 (file)
@@ -389,6 +389,7 @@ extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
                               uint32_t *sequence);
 extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
 extern int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma);
+extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
 
 /**
  * TTM glue - vmwgfx_ttm_glue.c
index f7d5f70b52dd68c395d4eb0751a445a83b1901f8..4157547cc6e44a79570d74004713ba187acc1c99 100644 (file)
 #include "drmP.h"
 #include "ttm/ttm_placement.h"
 
+bool vmw_fifo_have_3d(struct vmw_private *dev_priv)
+{
+       __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
+       uint32_t fifo_min, hwversion;
+
+       fifo_min = ioread32(fifo_mem  + SVGA_FIFO_MIN);
+       if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int))
+               return false;
+
+       hwversion = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION);
+       if (hwversion == 0)
+               return false;
+
+       if (hwversion < SVGA3D_HWVERSION_WS65_B1)
+               return false;
+
+       return true;
+}
+
 int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 {
        __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
index 5fa6a4ed238add81c5da2a2e2fb65ab50f4862da..778851f9f1d60d3c04fbb5befb14990598df5e4c 100644 (file)
@@ -43,7 +43,7 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
                param->value = vmw_overlay_num_free_overlays(dev_priv);
                break;
        case DRM_VMW_PARAM_3D:
-               param->value = dev_priv->capabilities & SVGA_CAP_3D ? 1 : 0;
+               param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
                break;
        case DRM_VMW_PARAM_FIFO_OFFSET:
                param->value = dev_priv->mmio_start;