Skip to content

Commit

Permalink
drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
Browse files Browse the repository at this point in the history
Use the correct helper and also return early on helper
success rather than on helper failure.

Also explicitly return 0 in the case of no fb.

v2: Check for !fb after updating state->visible (Ville).

Reviewed-by: Ville Syrjälä <[email protected]>
Signed-off-by: Thomas Hellstrom <[email protected]> (v1)
Reported-by: Dan Carpenter <[email protected]>
Reported-by: Daniel Vetter <[email protected]>
Cc: Ville Syrjälä <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Cc: VMware Graphics <[email protected]>
Cc: Sinclair Yeh <[email protected]>
Cc: Thomas Hellstrom <[email protected]>
Acked-by: Thomas Hellstrom <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
thomashvmw authored and danvet committed Oct 5, 2018
1 parent 6b6fce6 commit 40e3def
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,24 +493,24 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *new_state)
{
int ret = 0;
struct drm_crtc_state *crtc_state = NULL;
struct vmw_surface *surface = NULL;
struct drm_framebuffer *fb = new_state->fb;

struct drm_rect src = drm_plane_state_src(new_state);
struct drm_rect dest = drm_plane_state_dest(new_state);
if (new_state->crtc)
crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
new_state->crtc);

/* Turning off */
if (!fb)
ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
true, true);
if (ret)
return ret;

ret = drm_plane_helper_check_update(plane, new_state->crtc, fb,
&src, &dest,
DRM_MODE_ROTATE_0,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
true, true, &new_state->visible);
if (!ret)
return ret;
/* Turning off */
if (!fb)
return 0;

/* A lot of the code assumes this */
if (new_state->crtc_w != 64 || new_state->crtc_h != 64) {
Expand Down

0 comments on commit 40e3def

Please sign in to comment.