Commit 0bef23f9 authored by Michel Dänzer's avatar Michel Dänzer Committed by Dave Airlie

vmwgfx: Print error diagnostics if depth doesn't match the host expectation

Signed-off-by: default avatarMichel Dänzer <daenzer@vmware.com>
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6558429b
...@@ -503,9 +503,9 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, ...@@ -503,9 +503,9 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
struct ttm_buffer_object *bo, struct ttm_buffer_object *bo,
SVGA3dCmdHeader *header); SVGA3dCmdHeader *header);
void vmw_kms_write_svga(struct vmw_private *vmw_priv, int vmw_kms_write_svga(struct vmw_private *vmw_priv,
unsigned width, unsigned height, unsigned pitch, unsigned width, unsigned height, unsigned pitch,
unsigned bpp, unsigned depth); unsigned bpp, unsigned depth);
int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
void vmw_kms_idle_workqueues(struct vmw_master *vmaster); void vmw_kms_idle_workqueues(struct vmw_master *vmaster);
......
...@@ -158,10 +158,14 @@ static int vmw_fb_set_par(struct fb_info *info) ...@@ -158,10 +158,14 @@ static int vmw_fb_set_par(struct fb_info *info)
{ {
struct vmw_fb_par *par = info->par; struct vmw_fb_par *par = info->par;
struct vmw_private *vmw_priv = par->vmw_priv; struct vmw_private *vmw_priv = par->vmw_priv;
int ret;
ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
info->fix.line_length,
par->bpp, par->depth);
if (ret)
return ret;
vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
info->fix.line_length,
par->bpp, par->depth);
if (vmw_priv->capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) { if (vmw_priv->capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) {
/* TODO check if pitch and offset changes */ /* TODO check if pitch and offset changes */
vmw_write(vmw_priv, SVGA_REG_NUM_GUEST_DISPLAYS, 1); vmw_write(vmw_priv, SVGA_REG_NUM_GUEST_DISPLAYS, 1);
......
...@@ -990,7 +990,7 @@ int vmw_kms_cursor_bypass_ioctl(struct drm_device *dev, void *data, ...@@ -990,7 +990,7 @@ int vmw_kms_cursor_bypass_ioctl(struct drm_device *dev, void *data,
return ret; return ret;
} }
void vmw_kms_write_svga(struct vmw_private *vmw_priv, int vmw_kms_write_svga(struct vmw_private *vmw_priv,
unsigned width, unsigned height, unsigned pitch, unsigned width, unsigned height, unsigned pitch,
unsigned bpp, unsigned depth) unsigned bpp, unsigned depth)
{ {
...@@ -1001,6 +1001,14 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv, ...@@ -1001,6 +1001,14 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv,
vmw_write(vmw_priv, SVGA_REG_WIDTH, width); vmw_write(vmw_priv, SVGA_REG_WIDTH, width);
vmw_write(vmw_priv, SVGA_REG_HEIGHT, height); vmw_write(vmw_priv, SVGA_REG_HEIGHT, height);
vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp); vmw_write(vmw_priv, SVGA_REG_BITS_PER_PIXEL, bpp);
if (vmw_read(vmw_priv, SVGA_REG_DEPTH) != depth) {
DRM_ERROR("Invalid depth %u for %u bpp, host expects %u\n",
depth, bpp, vmw_read(vmw_priv, SVGA_REG_DEPTH));
return -EINVAL;
}
return 0;
} }
int vmw_kms_save_vga(struct vmw_private *vmw_priv) int vmw_kms_save_vga(struct vmw_private *vmw_priv)
......
...@@ -123,10 +123,8 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) ...@@ -123,10 +123,8 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
return 0; return 0;
fb = entry->base.crtc.fb; fb = entry->base.crtc.fb;
vmw_kms_write_svga(dev_priv, w, h, fb->pitch, return vmw_kms_write_svga(dev_priv, w, h, fb->pitch,
fb->bits_per_pixel, fb->depth); fb->bits_per_pixel, fb->depth);
return 0;
} }
if (!list_empty(&lds->active)) { if (!list_empty(&lds->active)) {
...@@ -274,9 +272,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) ...@@ -274,9 +272,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
vmw_ldu_del_active(dev_priv, ldu); vmw_ldu_del_active(dev_priv, ldu);
vmw_ldu_commit_list(dev_priv); return vmw_ldu_commit_list(dev_priv);
return 0;
} }
...@@ -301,9 +297,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) ...@@ -301,9 +297,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
vmw_ldu_add_active(dev_priv, ldu, vfb); vmw_ldu_add_active(dev_priv, ldu, vfb);
vmw_ldu_commit_list(dev_priv); return vmw_ldu_commit_list(dev_priv);
return 0;
} }
static struct drm_crtc_funcs vmw_legacy_crtc_funcs = { static struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment