aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2011-08-31 03:42:50 -0400
committerDave Airlie <airlied@redhat.com>2011-09-01 04:37:49 -0400
commit0bef23f9180b43e805ce4dabb90b24a0b558721c (patch)
tree6524902551a89a981422e121008ee5f64555266c
parent6558429bc4c7351cc3d80fc9055f1204a9adf060 (diff)
vmwgfx: Print error diagnostics if depth doesn't match the host expectation
Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c14
4 files changed, 23 insertions, 17 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 0c24347d56a6..fc33f3f9ebc4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -503,9 +503,9 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
503 struct ttm_object_file *tfile, 503 struct ttm_object_file *tfile,
504 struct ttm_buffer_object *bo, 504 struct ttm_buffer_object *bo,
505 SVGA3dCmdHeader *header); 505 SVGA3dCmdHeader *header);
506void vmw_kms_write_svga(struct vmw_private *vmw_priv, 506int vmw_kms_write_svga(struct vmw_private *vmw_priv,
507 unsigned width, unsigned height, unsigned pitch, 507 unsigned width, unsigned height, unsigned pitch,
508 unsigned bpp, unsigned depth); 508 unsigned bpp, unsigned depth);
509int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, 509int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
510 struct drm_file *file_priv); 510 struct drm_file *file_priv);
511void vmw_kms_idle_workqueues(struct vmw_master *vmaster); 511void vmw_kms_idle_workqueues(struct vmw_master *vmaster);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 5fb80b138e80..b1888e801e22 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -158,10 +158,14 @@ static int vmw_fb_set_par(struct fb_info *info)
158{ 158{
159 struct vmw_fb_par *par = info->par; 159 struct vmw_fb_par *par = info->par;
160 struct vmw_private *vmw_priv = par->vmw_priv; 160 struct vmw_private *vmw_priv = par->vmw_priv;
161 int ret;
162
163 ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
164 info->fix.line_length,
165 par->bpp, par->depth);
166 if (ret)
167 return ret;
161 168
162 vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
163 info->fix.line_length,
164 par->bpp, par->depth);
165 if (vmw_priv->capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) { 169 if (vmw_priv->capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) {
166 /* TODO check if pitch and offset changes */ 170 /* TODO check if pitch and offset changes */
167 vmw_write(vmw_priv, SVGA_REG_NUM_GUEST_DISPLAYS, 1); 171 vmw_write(vmw_priv, SVGA_REG_NUM_GUEST_DISPLAYS, 1);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index be8163b8f1ae..9ea2f05e72bb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -990,7 +990,7 @@ out:
990 return ret; 990 return ret;
991} 991}
992 992
993void vmw_kms_write_svga(struct vmw_private *vmw_priv, 993int vmw_kms_write_svga(struct vmw_private *vmw_priv,
994 unsigned width, unsigned height, unsigned pitch, 994 unsigned width, unsigned height, unsigned pitch,
995 unsigned bpp, unsigned depth) 995 unsigned bpp, unsigned depth)
996{ 996{
@@ -1001,6 +1001,14 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv,
1001 vmw_write(vmw_priv, SVGA_REG_WIDTH, width); 1001 vmw_write(vmw_priv, SVGA_REG_WIDTH, width);
1002 vmw_write(vmw_priv, SVGA_REG_HEIGHT, height); 1002 vmw_write(vmw_priv, SVGA_REG_HEIGHT, height);
1003 vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp); 1003 vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp);
1004
1005 if (vmw_read(vmw_priv, SVGA_REG_DEPTH) != depth) {
1006 DRM_ERROR("Invalid depth %u for %u bpp, host expects %u\n",
1007 depth, bpp, vmw_read(vmw_priv, SVGA_REG_DEPTH));
1008 return -EINVAL;
1009 }
1010
1011 return 0;
1004} 1012}
1005 1013
1006int vmw_kms_save_vga(struct vmw_private *vmw_priv) 1014int vmw_kms_save_vga(struct vmw_private *vmw_priv)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index c6d09a618353..7e1901c4f065 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -123,10 +123,8 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
123 return 0; 123 return 0;
124 fb = entry->base.crtc.fb; 124 fb = entry->base.crtc.fb;
125 125
126 vmw_kms_write_svga(dev_priv, w, h, fb->pitch, 126 return vmw_kms_write_svga(dev_priv, w, h, fb->pitch,
127 fb->bits_per_pixel, fb->depth); 127 fb->bits_per_pixel, fb->depth);
128
129 return 0;
130 } 128 }
131 129
132 if (!list_empty(&lds->active)) { 130 if (!list_empty(&lds->active)) {
@@ -274,9 +272,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
274 272
275 vmw_ldu_del_active(dev_priv, ldu); 273 vmw_ldu_del_active(dev_priv, ldu);
276 274
277 vmw_ldu_commit_list(dev_priv); 275 return vmw_ldu_commit_list(dev_priv);
278
279 return 0;
280 } 276 }
281 277
282 278
@@ -301,9 +297,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
301 297
302 vmw_ldu_add_active(dev_priv, ldu, vfb); 298 vmw_ldu_add_active(dev_priv, ldu, vfb);
303 299
304 vmw_ldu_commit_list(dev_priv); 300 return vmw_ldu_commit_list(dev_priv);
305
306 return 0;
307} 301}
308 302
309static struct drm_crtc_funcs vmw_legacy_crtc_funcs = { 303static struct drm_crtc_funcs vmw_legacy_crtc_funcs = {