Skip to contentSkip to conversation

drm/pl111: Fix offset calculation for the primary plane.

PATCH In review Eric Anholt 2 participants 3 messages Jun 3, 2017 – Jun 7, 2017

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

PATCH 1/1 drm/pl111: Fix offset calculation for the primary plane.

If src_x/y were nonzero, we failed to shift them down by 16 to get the pixel offset. The recent CMA helper function gets it right.

Fixes bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
---
 drivers/gpu/drm/pl111/pl111_display.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/gpu/drm/pl111/pl111_display.c +2 -13
index 3e0a4fa73ddb..c6ca4f1bbd49 100644
@@ -50,17 +50,6 @@ irqreturn_t pl111_irq(int irq, void *data)
 	return status;
 }
 
-static u32 pl111_get_fb_offset(struct drm_plane_state *pstate)
-{
-	struct drm_framebuffer *fb = pstate->fb;
-	struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, 0);
-
-	return (obj->paddr +
-		fb->offsets[0] +
-		fb->format->cpp[0] * pstate->src_x +
-		fb->pitches[0] * pstate->src_y);
-}
-
 static int pl111_display_check(struct drm_simple_display_pipe *pipe,
 			       struct drm_plane_state *pstate,
 			       struct drm_crtc_state *cstate)
@@ -73,7 +62,7 @@ static int pl111_display_check(struct drm_simple_display_pipe *pipe,
 		return -EINVAL;
 
 	if (fb) {
-		u32 offset = pl111_get_fb_offset(pstate);
+		u32 offset = drm_fb_cma_get_gem_addr(fb, pstate, 0);
 
 		/* FB base address must be dword aligned. */
 		if (offset & 3)
@@ -249,7 +238,7 @@ static void pl111_display_update(struct drm_simple_display_pipe *pipe,
 	struct drm_framebuffer *fb = pstate->fb;
 
 	if (fb) {
-		u32 addr = pl111_get_fb_offset(pstate);
+		u32 addr = drm_fb_cma_get_gem_addr(fb, pstate, 0);
 
 		writel(addr, priv->regs + CLCD_UBAS);
 	}
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Anholt

If src_x/y were nonzero, we failed to shift them down by 16 to get the pixel offset. The recent CMA helper function gets it right.

Fixes bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
Quoted 51 lines
---
 drivers/gpu/drm/pl111/pl111_display.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/gpu/drm/pl111/pl111_display.c +2 -13
index 3e0a4fa73ddb..c6ca4f1bbd49 100644
@@ -50,17 +50,6 @@ irqreturn_t pl111_irq(int irq, void *data)
 	return status;
 }
 
-static u32 pl111_get_fb_offset(struct drm_plane_state *pstate)
-{
-	struct drm_framebuffer *fb = pstate->fb;
-	struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, 0);
-
-	return (obj->paddr +
-		fb->offsets[0] +
-		fb->format->cpp[0] * pstate->src_x +
-		fb->pitches[0] * pstate->src_y);
-}
-
 static int pl111_display_check(struct drm_simple_display_pipe *pipe,
 			       struct drm_plane_state *pstate,
 			       struct drm_crtc_state *cstate)
@@ -73,7 +62,7 @@ static int pl111_display_check(struct drm_simple_display_pipe *pipe,
 		return -EINVAL;
 
 	if (fb) {
-		u32 offset = pl111_get_fb_offset(pstate);
+		u32 offset = drm_fb_cma_get_gem_addr(fb, pstate, 0);
 
 		/* FB base address must be dword aligned. */
 		if (offset & 3)
@@ -249,7 +238,7 @@ static void pl111_display_update(struct drm_simple_display_pipe *pipe,
 	struct drm_framebuffer *fb = pstate->fb;
 
 	if (fb) {
-		u32 addr = pl111_get_fb_offset(pstate);
+		u32 addr = drm_fb_cma_get_gem_addr(fb, pstate, 0);
 
 		writel(addr, priv->regs + CLCD_UBAS);
 	}
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
#2 lore raw
Quoted 10 lines · Sean Paul
Quoted 6 lines · Eric Anholt

If src_x/y were nonzero, we failed to shift them down by 16 to get the pixel offset. The recent CMA helper function gets it right.

Fixes bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")

Pushed. Thanks!

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel