aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2010-01-29 22:38:08 -0500
committerDave Airlie <airlied@redhat.com>2010-01-31 20:29:59 -0500
commit5ffdb658f605cbc420944e7c7eeec9fbb8a73772 (patch)
tree9f091b311f1c434f506d4c34ce373346a77d895b /drivers/gpu
parentc188660f6dbb0df9febe1b841a16c66c28353c15 (diff)
drm/vmwgfx: Don't send bad flags to the host
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c16
3 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 59acc51993f6..135be9688c90 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -96,6 +96,8 @@ struct vmw_surface {
96 struct drm_vmw_size *sizes; 96 struct drm_vmw_size *sizes;
97 uint32_t num_sizes; 97 uint32_t num_sizes;
98 98
99 bool scanout;
100
99 /* TODO so far just a extra pointer */ 101 /* TODO so far just a extra pointer */
100 struct vmw_cursor_snooper snooper; 102 struct vmw_cursor_snooper snooper;
101}; 103};
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 686692de209a..eeba6d1d06e4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -707,6 +707,9 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
707 if (ret) 707 if (ret)
708 goto try_dmabuf; 708 goto try_dmabuf;
709 709
710 if (!surface->scanout)
711 goto err_not_scanout;
712
710 ret = vmw_kms_new_framebuffer_surface(dev_priv, surface, &vfb, 713 ret = vmw_kms_new_framebuffer_surface(dev_priv, surface, &vfb,
711 mode_cmd->width, mode_cmd->height); 714 mode_cmd->width, mode_cmd->height);
712 715
@@ -740,6 +743,13 @@ try_dmabuf:
740 } 743 }
741 744
742 return &vfb->base; 745 return &vfb->base;
746
747err_not_scanout:
748 DRM_ERROR("surface not marked as scanout\n");
749 /* vmw_user_surface_lookup takes one ref */
750 vmw_surface_unreference(&surface);
751
752 return NULL;
743} 753}
744 754
745static int vmw_kms_fb_changed(struct drm_device *dev) 755static int vmw_kms_fb_changed(struct drm_device *dev)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index e01db120efff..c7efbd47ab84 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -35,6 +35,11 @@
35#define VMW_RES_SURFACE ttm_driver_type1 35#define VMW_RES_SURFACE ttm_driver_type1
36#define VMW_RES_STREAM ttm_driver_type2 36#define VMW_RES_STREAM ttm_driver_type2
37 37
38/* XXX: This isn't a real hardware flag, but just a hack for kernel to
39 * know about primary surfaces. Find a better way to accomplish this.
40 */
41#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9)
42
38struct vmw_user_context { 43struct vmw_user_context {
39 struct ttm_base_object base; 44 struct ttm_base_object base;
40 struct vmw_resource res; 45 struct vmw_resource res;
@@ -599,8 +604,17 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
599 if (unlikely(ret != 0)) 604 if (unlikely(ret != 0))
600 goto out_err1; 605 goto out_err1;
601 606
607 if (srf->flags & SVGA3D_SURFACE_HINT_SCANOUT) {
608 /* we should not send this flag down to hardware since
609 * its not a official one
610 */
611 srf->flags &= ~SVGA3D_SURFACE_HINT_SCANOUT;
612 srf->scanout = true;
613 } else {
614 srf->scanout = false;
615 }
602 616
603 if (srf->flags & (1 << 9) && 617 if (srf->scanout &&
604 srf->num_sizes == 1 && 618 srf->num_sizes == 1 &&
605 srf->sizes[0].width == 64 && 619 srf->sizes[0].width == 64 &&
606 srf->sizes[0].height == 64 && 620 srf->sizes[0].height == 64 &&