]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
vmwgfx: Print error diagnostics if depth doesn't match the host expectation
[linux-imx.git] / drivers / gpu / drm / vmwgfx / vmwgfx_kms.c
index be8163b8f1ae88d4f6fe756a617b79a124a33b23..9ea2f05e72bb0ad73b1e6775c1d8c495dfa6bd1c 100644 (file)
@@ -990,7 +990,7 @@ out:
        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 bpp, unsigned depth)
 {
@@ -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_HEIGHT, height);
        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)