drm/omap: cleanup offset calculation
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 3 May 2017 12:01:10 +0000 (15:01 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 2 Jun 2017 07:57:22 +0000 (10:57 +0300)
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

index 77d10bf9285f29c5893abcfbea08d55812aea6da..5c4288f44573b840e82807cf7a6c10ee3aeff932 100644 (file)
@@ -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 ||