瀏覽代碼

drm/vmwgfx: Fix corner case screen target management

When the surface backing a framebuffer doesn't match the framebuffer's
dimensions, the screen target code would test the framebuffer dimensions
rather than the surface dimensions when deciding whether to bind the
surface as a screen target directly. This causes a screen target -
surface dimension mismatch and a subsequent device error.

Fix this by testing against the surface dimension.

v2: Fix review comments by Sinclair Yeh.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Cc: <stable@vger.kernel.org>
Thomas Hellstrom 9 年之前
父節點
當前提交
beca4cf553
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

+ 4 - 4
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

@@ -399,8 +399,10 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv,
 
 
 	WARN_ON_ONCE(!stdu->defined);
 	WARN_ON_ONCE(!stdu->defined);
 
 
-	if (!vfb->dmabuf && new_fb->width == mode->hdisplay &&
-	    new_fb->height == mode->vdisplay)
+	new_vfbs = (vfb->dmabuf) ? NULL : vmw_framebuffer_to_vfbs(new_fb);
+
+	if (new_vfbs && new_vfbs->surface->base_size.width == mode->hdisplay &&
+	    new_vfbs->surface->base_size.height == mode->vdisplay)
 		new_content_type = SAME_AS_DISPLAY;
 		new_content_type = SAME_AS_DISPLAY;
 	else if (vfb->dmabuf)
 	else if (vfb->dmabuf)
 		new_content_type = SEPARATE_DMA;
 		new_content_type = SEPARATE_DMA;
@@ -444,7 +446,6 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv,
 			content_srf.mip_levels[0]     = 1;
 			content_srf.mip_levels[0]     = 1;
 			content_srf.multisample_count = 0;
 			content_srf.multisample_count = 0;
 		} else {
 		} else {
-			new_vfbs = vmw_framebuffer_to_vfbs(new_fb);
 			content_srf = *new_vfbs->surface;
 			content_srf = *new_vfbs->surface;
 		}
 		}
 
 
@@ -464,7 +465,6 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv,
 			return ret;
 			return ret;
 		}
 		}
 	} else if (new_content_type == SAME_AS_DISPLAY) {
 	} else if (new_content_type == SAME_AS_DISPLAY) {
-		new_vfbs = vmw_framebuffer_to_vfbs(new_fb);
 		new_display_srf = vmw_surface_reference(new_vfbs->surface);
 		new_display_srf = vmw_surface_reference(new_vfbs->surface);
 	}
 	}