diff mbox

[2/4] drm/omap: remove unnecessary pitch round-up

Message ID 1460994134-12587-2-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomi Valkeinen April 18, 2016, 3:42 p.m. UTC
omapdrm checks if the pixel stride is divisible by 8. This is meant to
ensure that the byte stride is 32, which is required by SGX.

The check is not correct, as it checks for pixels, not bytes, and thus
needlessly increases the stride for, e.g., NV12.

Also, SGX driver is not supported in the mainline, and the TI's SGX
driver nowadays does the memory allocation itself and doesn't rely on
omapdrm to figure out the correct pitch.

So we can just remove the whole roundup.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Laurent Pinchart April 19, 2016, 2:11 a.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Monday 18 Apr 2016 18:42:12 Tomi Valkeinen wrote:
> omapdrm checks if the pixel stride is divisible by 8. This is meant to
> ensure that the byte stride is 32, which is required by SGX.
> 
> The check is not correct, as it checks for pixels, not bytes, and thus
> needlessly increases the stride for, e.g., NV12.
> 
> Also, SGX driver is not supported in the mainline, and the TI's SGX
> driver nowadays does the memory allocation itself and doesn't rely on
> omapdrm to figure out the correct pitch.
> 
> So we can just remove the whole roundup.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h
> b/drivers/gpu/drm/omapdrm/omap_drv.h index 0fbe17d0ec6f..bdce6ec64a07
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -244,10 +244,7 @@ static inline int align_pitch(int pitch, int width, int
> bpp) int bytespp = (bpp + 7) / 8;
>  	/* in case someone tries to feed us a completely bogus stride: */
>  	pitch = max(pitch, width * bytespp);
> -	/* PVR needs alignment to 8 pixels.. right now that is the most
> -	 * restrictive stride requirement..
> -	 */
> -	return roundup(pitch, 8 * bytespp);
> +	return pitch;
>  }
> 
>  /* map crtc to vblank mask */
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 0fbe17d0ec6f..bdce6ec64a07 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -244,10 +244,7 @@  static inline int align_pitch(int pitch, int width, int bpp)
 	int bytespp = (bpp + 7) / 8;
 	/* in case someone tries to feed us a completely bogus stride: */
 	pitch = max(pitch, width * bytespp);
-	/* PVR needs alignment to 8 pixels.. right now that is the most
-	 * restrictive stride requirement..
-	 */
-	return roundup(pitch, 8 * bytespp);
+	return pitch;
 }
 
 /* map crtc to vblank mask */