From: Liu Ying Date: Mon, 26 Mar 2018 08:19:37 +0000 (+0800) Subject: MLK-17923 drm/imx: dpu: plane: Do not support fb x/y src offset for tile fmts X-Git-Tag: C0P2-H0.0--20200415~82 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=1ae552181bb125760f99a360fcdf202e720f8ecd;p=linux.git MLK-17923 drm/imx: dpu: plane: Do not support fb x/y src offset for tile fmts 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 --- diff --git a/drivers/gpu/drm/imx/dpu/dpu-plane.c b/drivers/gpu/drm/imx/dpu/dpu-plane.c index 6f2eaaafbbc7..54b4ca941b7b 100644 --- a/drivers/gpu/drm/imx/dpu/dpu-plane.c +++ b/drivers/gpu/drm/imx/dpu/dpu-plane.c @@ -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; diff --git a/drivers/gpu/imx/dpu/dpu-fetchdecode.c b/drivers/gpu/imx/dpu/dpu-fetchdecode.c index 6723132d7001..6387dbf2ec77 100644 --- a/drivers/gpu/imx/dpu/dpu-fetchdecode.c +++ b/drivers/gpu/imx/dpu/dpu-fetchdecode.c @@ -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, diff --git a/drivers/gpu/imx/imx8_dprc.c b/drivers/gpu/imx/imx8_dprc.c index f1c42b075ce2..79826d77e7f5 100644 --- a/drivers/gpu/imx/imx8_dprc.c +++ b/drivers/gpu/imx/imx8_dprc.c @@ -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, diff --git a/drivers/gpu/imx/imx8_prg.c b/drivers/gpu/imx/imx8_prg.c index 8f2c98cee030..3d5d8231f47e 100644 --- a/drivers/gpu/imx/imx8_prg.c +++ b/drivers/gpu/imx/imx8_prg.c @@ -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); diff --git a/include/video/dpu.h b/include/video/dpu.h index 14dfee229ec7..eaee48360092 100644 --- a/include/video/dpu.h +++ b/include/video/dpu.h @@ -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, diff --git a/include/video/imx8-prefetch.h b/include/video/imx8-prefetch.h index e621ad041978..849ef52c9fb6 100644 --- a/include/video/imx8-prefetch.h +++ b/include/video/imx8-prefetch.h @@ -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,