Skip to contentSkip to conversation

drm: make sure visible is set to false if fb is null

PATCH In review Gustavo Padovan 3 participants 4 messages Oct 24, 2014 – Oct 27, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: make sure visible is set to false if fb is null

From: Gustavo Padovan <[email protected]>

We can't let visible set true while the fb is null, some places of the code only check for visible to base its decisions.

---
 drivers/gpu/drm/drm_plane_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_plane_helper.c +5 -0
index 827ec1a..fe4d1fb 100644
@@ -127,6 +127,11 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 		return -ERANGE;
 	}
 
+	if (!fb) {
+		*visible = false;
+		return 0;
+	}
+
 	*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
 	if (!*visible)
 		/*
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/2 drm/i915: remove unneeded visible check

From: Gustavo Padovan <[email protected]>

The fb check introduced to drm_plane_helper_check_update() just make this check impossible to branch in.

---
 drivers/gpu/drm/i915/intel_display.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -16
index ef2107f..5372b73 100644
@@ -11484,23 +11484,12 @@ intel_check_primary_plane(struct drm_plane *plane,
 	struct drm_rect *dest = &state->dst;
 	struct drm_rect *src = &state->src;
 	const struct drm_rect *clip = &state->clip;
-	int ret;
-
-	ret = drm_plane_helper_check_update(plane, crtc, fb,
-					    src, dest, clip,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    false, true, &state->visible);
-	if (ret)
-		return ret;
-
-	/* no fb bound */
-	if (state->visible && !fb) {
-		DRM_ERROR("No FB bound\n");
-		return -EINVAL;
-	}
 
-	return 0;
+	return drm_plane_helper_check_update(plane, crtc, fb,
+					     src, dest, clip,
+					     DRM_PLANE_HELPER_NO_SCALING,
+					     DRM_PLANE_HELPER_NO_SCALING,
+					     false, true, &state->visible);
 }
 
 static int
Signature · 1 line
1.9.3
Reviewed-by on v1 1/2
#2 lore raw
In reply to Gustavo Padovan
Quoted 6 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

We can't let visible set true while the fb is null, some places of the code only check for visible to base its decisions.

For the series:

Quoted 27 lines
---
 drivers/gpu/drm/drm_plane_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_plane_helper.c +5 -0
index 827ec1a..fe4d1fb 100644
@@ -127,6 +127,11 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
 		return -ERANGE;
 	}
 
+	if (!fb) {
+		*visible = false;
+		return 0;
+	}
+
 	*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
 	if (!*visible)
 		/*
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

We can't let visible set true while the fb is null, some places of the code only check for visible to base its decisions.

For the series:

Both merged to dinq, thanks.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx