MLK-17923 drm/imx: dpu: plane: Do not support fb x/y src offset for tile fmts
authorLiu Ying <victor.liu@nxp.com>
Mon, 26 Mar 2018 08:19:37 +0000 (16:19 +0800)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:36 +0000 (18:46 +0800)
We don't have correct support for fb x/y source offset for tile formats.
The buffer address calculation is wrong when the offset is non-zero.
Also, finer offset needs a fix in silicon(TKT344978).  So, let's do not
support the offset currently.  We may add it back after we figure out
how the updated silicon supports the offset.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/dpu/dpu-plane.c
drivers/gpu/imx/dpu/dpu-fetchdecode.c
drivers/gpu/imx/imx8_dprc.c
drivers/gpu/imx/imx8_prg.c
include/video/dpu.h
include/video/imx8-prefetch.h

index 6f2eaaa..54b4ca9 100644 (file)
@@ -166,27 +166,6 @@ drm_plane_state_to_baseaddr(struct drm_plane_state *state)
        cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
        BUG_ON(!cma_obj);
 
-       /* round down x/y to be tile aligned at left/top */
-       switch (fb->modifier[0]) {
-       case DRM_FORMAT_MOD_NONE:
-               break;
-       case DRM_FORMAT_MOD_AMPHION_TILED:
-               x = round_down(x, 8);
-               y = round_down(y, 256);
-               break;
-       case DRM_FORMAT_MOD_VIVANTE_TILED:
-               x = round_down(x, 4);
-               y = round_down(y, 4);
-               break;
-       case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
-               x = round_down(x, 64);
-               y = round_down(y, 64);
-               break;
-       default:
-               WARN_ON(1);
-               break;
-       }
-
        return cma_obj->paddr + fb->offsets[0] + fb->pitches[0] * y +
               drm_format_plane_cpp(fb->pixel_format, 0) * x;
 }
@@ -205,12 +184,6 @@ drm_plane_state_to_uvbaseaddr(struct drm_plane_state *state)
        x /= drm_format_horz_chroma_subsampling(fb->pixel_format);
        y /= drm_format_vert_chroma_subsampling(fb->pixel_format);
 
-       /* round down x/y to be tile aligned at left/top */
-       if (fb->modifier[1] == DRM_FORMAT_MOD_AMPHION_TILED) {
-               x = round_down(x, 8);
-               y = round_down(y, 128);
-       }
-
        return cma_obj->paddr + fb->offsets[1] + fb->pitches[1] * y +
               drm_format_plane_cpp(fb->pixel_format, 1) * x;
 }
@@ -272,6 +245,9 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
        if (fb->modifier[2] || fb->modifier[3])
                return -EINVAL;
 
+       if (fb->modifier[0] && (src_x || src_y))
+               return -EINVAL;
+
        if (dplane->grp->has_vproc) {
                /* no down scaling */
                if (src_w > state->crtc_w || src_h > state->crtc_h)
@@ -342,8 +318,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
            fetchdecode_prefetch_stride_supported(fd, fb->pitches[0],
                                                  fb->pitches[1],
                                                  src_w,
-                                                 fb->pixel_format) &&
-           fetchdecode_prefetch_crop_supported(fd, fb->modifier[0], src_y))
+                                                 fb->pixel_format))
                dpstate->use_prefetch = true;
        else
                dpstate->use_prefetch = false;
index 6723132..6387dbf 100644 (file)
@@ -830,16 +830,6 @@ bool fetchdecode_prefetch_stride_supported(struct dpu_fetchdecode *fd,
 }
 EXPORT_SYMBOL_GPL(fetchdecode_prefetch_stride_supported);
 
-bool fetchdecode_prefetch_crop_supported(struct dpu_fetchdecode *fd,
-                                        u64 modifier, u32 y_offset)
-{
-       if (WARN_ON(!fd || !fd->dprc))
-               return false;
-
-       return dprc_crop_supported(fd->dprc, modifier, y_offset);
-}
-EXPORT_SYMBOL_GPL(fetchdecode_prefetch_crop_supported);
-
 bool fetchdecode_prefetch_stride_double_check(struct dpu_fetchdecode *fd,
                                              unsigned int stride,
                                              unsigned int uv_stride,
index f1c42b0..79826d7 100644 (file)
@@ -605,30 +605,6 @@ bool dprc_stride_supported(struct dprc *dprc,
 }
 EXPORT_SYMBOL_GPL(dprc_stride_supported);
 
-bool dprc_crop_supported(struct dprc *dprc, u64 modifier, u32 y_offset)
-{
-       if (WARN_ON(!dprc))
-               return false;
-
-       switch (modifier) {
-       case DRM_FORMAT_MOD_AMPHION_TILED:
-               if ((y_offset % AMPHION_Y_STRIPE_HEIGHT) >
-                                       (PRG_HANDSHAKE_8LINES - 1))
-                       return false;
-               break;
-       case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
-               if ((y_offset % VIVANTE_SUPER_TILE_HEIGHT) >
-                                       (PRG_HANDSHAKE_4LINES - 1))
-                       return false;
-               break;
-       default:
-               break;
-       }
-
-       return true;
-}
-EXPORT_SYMBOL_GPL(dprc_crop_supported);
-
 bool dprc_stride_double_check(struct dprc *dprc,
                              unsigned int stride, unsigned int uv_stride,
                              unsigned int width, u32 format,
index 8f2c98c..3d5d823 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -149,42 +149,9 @@ void prg_configure(struct prg *prg, unsigned int width, unsigned int height,
        if (prg->is_auxiliary && stride <= burst_size)
                height /= 2;
 
-       /* prg finer cropping into tile block - top/left start point */
-       switch (modifier) {
-       case DRM_FORMAT_MOD_NONE:
-               break;
-       case DRM_FORMAT_MOD_AMPHION_TILED:
-               x_offset %= AMPHION_STRIPE_WIDTH;
-               y_offset %= (prg->is_auxiliary ?
-                       AMPHION_UV_STRIPE_HEIGHT : AMPHION_Y_STRIPE_HEIGHT);
-               break;
-       case DRM_FORMAT_MOD_VIVANTE_TILED:
-               x_offset %= VIVANTE_TILE_WIDTH;
-               y_offset %= VIVANTE_TILE_HEIGHT;
-               break;
-       case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
-               x_offset %= VIVANTE_SUPER_TILE_WIDTH;
-               y_offset %= VIVANTE_SUPER_TILE_HEIGHT;
-               break;
-       default:
-               dev_err(prg->dev, "unsupported modifier 0x%016llx\n",
-                                                               modifier);
-               return;
-       }
-
-       if (y_offset >
-           ((format == DRM_FORMAT_NV21 || format == DRM_FORMAT_NV12) ?
-               (PRG_HANDSHAKE_8LINES - 1) : (PRG_HANDSHAKE_4LINES - 1))) {
-               dev_err(prg->dev,
-                       "unsupported crop line %d for modifier 0x%016llx\n",
-                                                       y_offset, modifier);
-               return;
-       }
-
        prg_write(prg, STRIDE(stride), PRG_STRIDE);
        prg_write(prg, WIDTH(width), PRG_WIDTH);
        prg_write(prg, HEIGHT(height), PRG_HEIGHT);
-       prg_write(prg, X(x_offset) | Y(y_offset), PRG_OFFSET);
        prg_write(prg, baddr, PRG_BADDR);
 
        val = prg_read(prg, PRG_CTRL);
index 14dfee2..eaee483 100644 (file)
@@ -526,8 +526,6 @@ bool fetchdecode_prefetch_stride_supported(struct dpu_fetchdecode *fd,
                                           unsigned int uv_stride,
                                           unsigned int width,
                                           u32 format);
-bool fetchdecode_prefetch_crop_supported(struct dpu_fetchdecode *fd,
-                                        u64 modifier, u32 y_offset);
 bool fetchdecode_prefetch_stride_double_check(struct dpu_fetchdecode *fd,
                                              unsigned int stride,
                                              unsigned int uv_stride,
index e621ad0..849ef52 100644 (file)
@@ -62,7 +62,6 @@ bool dprc_format_supported(struct dprc *dprc, u32 format, u64 modifier);
 bool dprc_stride_supported(struct dprc *dprc,
                           unsigned int stride, unsigned int uv_stride,
                           unsigned int width, u32 format);
-bool dprc_crop_supported(struct dprc *dprc, u64 modifier, u32 y_offset);
 bool dprc_stride_double_check(struct dprc *dprc,
                              unsigned int stride, unsigned int uv_stride,
                              unsigned int width, u32 format,