drm/omap: remove dma & vrfb rotation
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 3 May 2017 11:14:27 +0000 (14:14 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 2 Jun 2017 07:57:22 +0000 (10:57 +0300)
We have three rotation methods supported by the SoCs with DSS: DMA,
VRFB and TILER.

DMA rotation works in theory on all DSS platforms, but in practice it's
unusable due to the huge amount of memory bandwidth it uses, and has
never really been used.

VRFB is available on OMAP3, but is not supported by omapdrm, even though
we have some code for it in the dispc driver.

TILER is supported on OMAP4/OMAP5/DRA7/AM5 platforms, but has some
driver bugs.

To clean up the driver to help fixing the TILER issues, this patch drops
the DMA and VRFB rotation support, leaving only TILER rotation.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/omapdrm/dss/dispc.c
drivers/gpu/drm/omapdrm/dss/dss_features.c
drivers/gpu/drm/omapdrm/dss/dss_features.h
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_fb.c
drivers/gpu/drm/omapdrm/omap_plane.c

index 802d3e72843beb18d07cb2728095f63b5ed3f802..77d10bf9285f29c5893abcfbea08d55812aea6da 100644 (file)
@@ -1908,230 +1908,7 @@ static s32 pixinc(int pixels, u8 ps)
                return 0;
 }
 
-static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
-               u16 screen_width,
-               u16 width, u16 height,
-               enum omap_color_mode color_mode, bool fieldmode,
-               unsigned int field_offset,
-               unsigned *offset0, unsigned *offset1,
-               s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
-{
-       u8 ps;
-
-       switch (color_mode) {
-       case OMAP_DSS_COLOR_YUV2:
-       case OMAP_DSS_COLOR_UYVY:
-               ps = 4;
-               break;
-       default:
-               ps = color_mode_to_bpp(color_mode) / 8;
-               break;
-       }
-
-       DSSDBG("calc_rot(%d): scrw %d, %dx%d\n", rotation, screen_width,
-                       width, height);
-
-       /*
-        * field 0 = even field = bottom field
-        * field 1 = odd field = top field
-        */
-       switch (rotation + mirror * 4) {
-       case OMAP_DSS_ROT_0:
-       case OMAP_DSS_ROT_180:
-               /*
-                * If the pixel format is YUV or UYVY divide the width
-                * of the image by 2 for 0 and 180 degree rotation.
-                */
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       width = width >> 1;
-       case OMAP_DSS_ROT_90:
-       case OMAP_DSS_ROT_270:
-               *offset1 = 0;
-               if (field_offset)
-                       *offset0 = field_offset * screen_width * ps;
-               else
-                       *offset0 = 0;
-
-               *row_inc = pixinc(1 +
-                       (y_predecim * screen_width - x_predecim * width) +
-                       (fieldmode ? screen_width : 0), ps);
-               *pix_inc = pixinc(x_predecim, ps);
-               break;
-
-       case OMAP_DSS_ROT_0 + 4:
-       case OMAP_DSS_ROT_180 + 4:
-               /* If the pixel format is YUV or UYVY divide the width
-                * of the image by 2  for 0 degree and 180 degree
-                */
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       width = width >> 1;
-       case OMAP_DSS_ROT_90 + 4:
-       case OMAP_DSS_ROT_270 + 4:
-               *offset1 = 0;
-               if (field_offset)
-                       *offset0 = field_offset * screen_width * ps;
-               else
-                       *offset0 = 0;
-               *row_inc = pixinc(1 -
-                       (y_predecim * screen_width + x_predecim * width) -
-                       (fieldmode ? screen_width : 0), ps);
-               *pix_inc = pixinc(x_predecim, ps);
-               break;
-
-       default:
-               BUG();
-               return;
-       }
-}
-
-static void calc_dma_rotation_offset(u8 rotation, bool mirror,
-               u16 screen_width,
-               u16 width, u16 height,
-               enum omap_color_mode color_mode, bool fieldmode,
-               unsigned int field_offset,
-               unsigned *offset0, unsigned *offset1,
-               s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
-{
-       u8 ps;
-       u16 fbw, fbh;
-
-       ps = color_mode_to_bpp(color_mode) / 8;
-
-       DSSDBG("calc_rot(%d): scrw %d, %dx%d\n", rotation, screen_width,
-                       width, height);
-
-       /* width & height are overlay sizes, convert to fb sizes */
-
-       if (rotation == OMAP_DSS_ROT_0 || rotation == OMAP_DSS_ROT_180) {
-               fbw = width;
-               fbh = height;
-       } else {
-               fbw = height;
-               fbh = width;
-       }
-
-       /*
-        * field 0 = even field = bottom field
-        * field 1 = odd field = top field
-        */
-       switch (rotation + mirror * 4) {
-       case OMAP_DSS_ROT_0:
-               *offset1 = 0;
-               if (field_offset)
-                       *offset0 = *offset1 + field_offset * screen_width * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(1 +
-                       (y_predecim * screen_width - fbw * x_predecim) +
-                       (fieldmode ? screen_width : 0), ps);
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       *pix_inc = pixinc(x_predecim, 2 * ps);
-               else
-                       *pix_inc = pixinc(x_predecim, ps);
-               break;
-       case OMAP_DSS_ROT_90:
-               *offset1 = screen_width * (fbh - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 + field_offset * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(screen_width * (fbh * x_predecim - 1) +
-                               y_predecim + (fieldmode ? 1 : 0), ps);
-               *pix_inc = pixinc(-x_predecim * screen_width, ps);
-               break;
-       case OMAP_DSS_ROT_180:
-               *offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 - field_offset * screen_width * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(-1 -
-                       (y_predecim * screen_width - fbw * x_predecim) -
-                       (fieldmode ? screen_width : 0), ps);
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       *pix_inc = pixinc(-x_predecim, 2 * ps);
-               else
-                       *pix_inc = pixinc(-x_predecim, ps);
-               break;
-       case OMAP_DSS_ROT_270:
-               *offset1 = (fbw - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 - field_offset * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(-screen_width * (fbh * x_predecim - 1) -
-                               y_predecim - (fieldmode ? 1 : 0), ps);
-               *pix_inc = pixinc(x_predecim * screen_width, ps);
-               break;
-
-       /* mirroring */
-       case OMAP_DSS_ROT_0 + 4:
-               *offset1 = (fbw - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 + field_offset * screen_width * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(y_predecim * screen_width * 2 - 1 +
-                               (fieldmode ? screen_width : 0),
-                               ps);
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       *pix_inc = pixinc(-x_predecim, 2 * ps);
-               else
-                       *pix_inc = pixinc(-x_predecim, ps);
-               break;
-
-       case OMAP_DSS_ROT_90 + 4:
-               *offset1 = 0;
-               if (field_offset)
-                       *offset0 = *offset1 + field_offset * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(-screen_width * (fbh * x_predecim - 1) +
-                               y_predecim + (fieldmode ? 1 : 0),
-                               ps);
-               *pix_inc = pixinc(x_predecim * screen_width, ps);
-               break;
-
-       case OMAP_DSS_ROT_180 + 4:
-               *offset1 = screen_width * (fbh - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 - field_offset * screen_width * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(1 - y_predecim * screen_width * 2 -
-                               (fieldmode ? screen_width : 0),
-                               ps);
-               if (color_mode == OMAP_DSS_COLOR_YUV2 ||
-                       color_mode == OMAP_DSS_COLOR_UYVY)
-                       *pix_inc = pixinc(x_predecim, 2 * ps);
-               else
-                       *pix_inc = pixinc(x_predecim, ps);
-               break;
-
-       case OMAP_DSS_ROT_270 + 4:
-               *offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps;
-               if (field_offset)
-                       *offset0 = *offset1 - field_offset * ps;
-               else
-                       *offset0 = *offset1;
-               *row_inc = pixinc(screen_width * (fbh * x_predecim - 1) -
-                               y_predecim - (fieldmode ? 1 : 0),
-                               ps);
-               *pix_inc = pixinc(-x_predecim * screen_width, ps);
-               break;
-
-       default:
-               BUG();
-               return;
-       }
-}
-
-static void calc_tiler_rotation_offset(u16 screen_width, u16 width,
+static void calc_offset(u16 screen_width, u16 width,
                enum omap_color_mode color_mode, bool fieldmode,
                unsigned int field_offset, unsigned *offset0, unsigned *offset1,
                s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
@@ -2711,23 +2488,10 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
                frame_height = height;
        }
 
-       if (rotation_type == OMAP_DSS_ROT_TILER)
-               calc_tiler_rotation_offset(screen_width, frame_width,
-                               color_mode, fieldmode, field_offset,
-                               &offset0, &offset1, &row_inc, &pix_inc,
-                               x_predecim, y_predecim);
-       else if (rotation_type == OMAP_DSS_ROT_DMA)
-               calc_dma_rotation_offset(rotation, mirror, screen_width,
-                               frame_width, frame_height,
-                               color_mode, fieldmode, field_offset,
-                               &offset0, &offset1, &row_inc, &pix_inc,
-                               x_predecim, y_predecim);
-       else
-               calc_vrfb_rotation_offset(rotation, mirror,
-                               screen_width, frame_width, frame_height,
-                               color_mode, fieldmode, field_offset,
-                               &offset0, &offset1, &row_inc, &pix_inc,
-                               x_predecim, y_predecim);
+       calc_offset(screen_width, frame_width,
+                       color_mode, fieldmode, field_offset,
+                       &offset0, &offset1, &row_inc, &pix_inc,
+                       x_predecim, y_predecim);
 
        DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n",
                        offset0, offset1, row_inc, pix_inc);
@@ -4168,7 +3932,7 @@ static const struct dispc_errata_i734_data {
                .width = 1, .height = 1,
                .color_mode = OMAP_DSS_COLOR_RGB24U,
                .rotation = OMAP_DSS_ROT_0,
-               .rotation_type = OMAP_DSS_ROT_DMA,
+               .rotation_type = OMAP_DSS_ROT_NONE,
                .mirror = 0,
                .pos_x = 0, .pos_y = 0,
                .out_width = 0, .out_height = 0,
index 135b2a511cf05c6dd7565fba17961be42a403742..bdac1d645ef01b2804e8f67c950ba87ab7f4209f 100644 (file)
@@ -51,8 +51,6 @@ struct omap_dss_features {
        const enum omap_overlay_caps *overlay_caps;
        const struct dss_param_range *dss_params;
 
-       const enum omap_dss_rotation_type supported_rotation_types;
-
        const u32 buffer_size_unit;
        const u32 burst_size_unit;
 };
@@ -596,7 +594,6 @@ static const struct omap_dss_features omap2_dss_features = {
        .supported_color_modes = omap2_dss_supported_color_modes,
        .overlay_caps = omap2_dss_overlay_caps,
        .dss_params = omap2_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
        .buffer_size_unit = 1,
        .burst_size_unit = 8,
 };
@@ -616,7 +613,6 @@ static const struct omap_dss_features omap3430_dss_features = {
        .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
        .buffer_size_unit = 1,
        .burst_size_unit = 8,
 };
@@ -639,7 +635,6 @@ static const struct omap_dss_features am35xx_dss_features = {
        .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
        .buffer_size_unit = 1,
        .burst_size_unit = 8,
 };
@@ -658,7 +653,6 @@ static const struct omap_dss_features am43xx_dss_features = {
        .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = am43xx_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA,
        .buffer_size_unit = 1,
        .burst_size_unit = 8,
 };
@@ -677,7 +671,6 @@ static const struct omap_dss_features omap3630_dss_features = {
        .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3630_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
        .buffer_size_unit = 1,
        .burst_size_unit = 8,
 };
@@ -698,7 +691,6 @@ static const struct omap_dss_features omap4430_es1_0_dss_features  = {
        .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
        .buffer_size_unit = 16,
        .burst_size_unit = 16,
 };
@@ -718,7 +710,6 @@ static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
        .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
        .buffer_size_unit = 16,
        .burst_size_unit = 16,
 };
@@ -738,7 +729,6 @@ static const struct omap_dss_features omap4_dss_features = {
        .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
        .buffer_size_unit = 16,
        .burst_size_unit = 16,
 };
@@ -758,7 +748,6 @@ static const struct omap_dss_features omap5_dss_features = {
        .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap5_dss_param_range,
-       .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
        .buffer_size_unit = 16,
        .burst_size_unit = 16,
 };
@@ -845,11 +834,6 @@ void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
        *end = omap_current_dss_features->reg_fields[id].end;
 }
 
-bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
-{
-       return omap_current_dss_features->supported_rotation_types & rot_type;
-}
-
 void dss_features_init(enum omapdss_version version)
 {
        switch (version) {
index 27fbe64935e8323120c0b328ce2bd050ebcbfaf8..6f262887502d73b4f7d71a1ac2663f0ed02724b2 100644 (file)
@@ -95,8 +95,6 @@ bool dss_feat_color_mode_supported(enum omap_plane_id plane,
 u32 dss_feat_get_buffer_size_unit(void);       /* in bytes */
 u32 dss_feat_get_burst_size_unit(void);                /* in bytes */
 
-bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type);
-
 bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
 void dss_features_init(enum omapdss_version version);
index 51d2403c201b870929bf1e582e3a90ed129bcadb..c33b53f27e0dca5972910c64752e14e2f25c6df2 100644 (file)
@@ -159,9 +159,8 @@ enum omap_dss_display_state {
 };
 
 enum omap_dss_rotation_type {
-       OMAP_DSS_ROT_DMA        = 1 << 0,
-       OMAP_DSS_ROT_VRFB       = 1 << 1,
-       OMAP_DSS_ROT_TILER      = 1 << 2,
+       OMAP_DSS_ROT_NONE       = 0,
+       OMAP_DSS_ROT_TILER      = 1 << 0,
 };
 
 /* clockwise rotation angle */
index 4bf9fcfcf673eddb197270dc0c536dd95fef85e8..1d2a94df7054ce9c29ee4fc3d6211b61e633a19c 100644 (file)
@@ -221,7 +221,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
                }
 
                info->paddr         = get_linear_addr(plane, format, 0, x, y);
-               info->rotation_type = OMAP_DSS_ROT_DMA;
+               info->rotation_type = OMAP_DSS_ROT_NONE;
                info->screen_width  = plane->pitch;
        }
 
index 8b343aa84098dd054bc71c7df2b9aefbe9222d56..40747a625374387f7ccb9b861673453136184b2e 100644 (file)
@@ -68,7 +68,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
        DBG("%s, crtc=%p fb=%p", omap_plane->name, state->crtc, state->fb);
 
        memset(&info, 0, sizeof(info));
-       info.rotation_type = OMAP_DSS_ROT_DMA;
+       info.rotation_type = OMAP_DSS_ROT_NONE;
        info.rotation = OMAP_DSS_ROT_0;
        info.global_alpha = 0xff;
        info.mirror = 0;