diff mbox

[07/16] drm/omap: cleanup offset calculation

Message ID 1493893412-12178-8-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomi Valkeinen May 4, 2017, 10:23 a.m. UTC
The code to calculate offset in dispc's calc_offset() is overly complex.
Simplify it.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart May 24, 2017, 9:33 a.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thursday 04 May 2017 13:23:23 Tomi Valkeinen wrote:
> The code to calculate offset in dispc's calc_offset() is overly complex.
> Simplify it.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c
> b/drivers/gpu/drm/omapdrm/dss/dispc.c index 4d335bf5e4d3..48bb71eafa56
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -1923,11 +1923,9 @@ static void calc_offset(u16 screen_width, u16 width,
>  	 * field 0 = even field = bottom field
>  	 * field 1 = odd field = top field
>  	 */
> +	*offset0 = field_offset * screen_width * ps;
>  	*offset1 = 0;
> -	if (field_offset)
> -		*offset0 = *offset1 + field_offset * screen_width * ps;
> -	else
> -		*offset0 = *offset1;
> +
>  	*row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) 
+
>  			(fieldmode ? screen_width : 0), ps);
>  	if (color_mode == OMAP_DSS_COLOR_YUV2 ||
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 4d335bf5e4d3..48bb71eafa56 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -1923,11 +1923,9 @@  static void calc_offset(u16 screen_width, u16 width,
 	 * field 0 = even field = bottom field
 	 * field 1 = odd field = top field
 	 */
+	*offset0 = field_offset * screen_width * ps;
 	*offset1 = 0;
-	if (field_offset)
-		*offset0 = *offset1 + field_offset * screen_width * ps;
-	else
-		*offset0 = *offset1;
+
 	*row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) +
 			(fieldmode ? screen_width : 0), ps);
 	if (color_mode == OMAP_DSS_COLOR_YUV2 ||