linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/pl111: Fix offset calculation for the primary plane.
@ 2017-06-03  1:57 Eric Anholt
  2017-06-06 14:30 ` Sean Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Anholt @ 2017-06-03  1:57 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, linus.walleij, 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.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
Reported-by: Mircea Carausu <mircea.carausu@broadcom.com>
---
 drivers/gpu/drm/pl111/pl111_display.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c
index 3e0a4fa73ddb..c6ca4f1bbd49 100644
--- a/drivers/gpu/drm/pl111/pl111_display.c
+++ b/drivers/gpu/drm/pl111/pl111_display.c
@@ -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);
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/pl111: Fix offset calculation for the primary plane.
  2017-06-03  1:57 [PATCH] drm/pl111: Fix offset calculation for the primary plane Eric Anholt
@ 2017-06-06 14:30 ` Sean Paul
  2017-06-07 18:51   ` Eric Anholt
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Paul @ 2017-06-06 14:30 UTC (permalink / raw)
  To: Eric Anholt; +Cc: dri-devel, linux-kernel

On Fri, Jun 02, 2017 at 06:57:33PM -0700, Eric Anholt wrote:
> 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.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Fixes: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
> Reported-by: Mircea Carausu <mircea.carausu@broadcom.com>


Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/pl111/pl111_display.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c
> index 3e0a4fa73ddb..c6ca4f1bbd49 100644
> --- a/drivers/gpu/drm/pl111/pl111_display.c
> +++ b/drivers/gpu/drm/pl111/pl111_display.c
> @@ -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);
>  	}
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/pl111: Fix offset calculation for the primary plane.
  2017-06-06 14:30 ` Sean Paul
@ 2017-06-07 18:51   ` Eric Anholt
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Anholt @ 2017-06-07 18:51 UTC (permalink / raw)
  To: Sean Paul; +Cc: dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

Sean Paul <seanpaul@chromium.org> writes:

> On Fri, Jun 02, 2017 at 06:57:33PM -0700, Eric Anholt wrote:
>> 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.
>> 
>> Signed-off-by: Eric Anholt <eric@anholt.net>
>> Fixes: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
>> Reported-by: Mircea Carausu <mircea.carausu@broadcom.com>
>
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Pushed.  Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-07 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-03  1:57 [PATCH] drm/pl111: Fix offset calculation for the primary plane Eric Anholt
2017-06-06 14:30 ` Sean Paul
2017-06-07 18:51   ` Eric Anholt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).