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>
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;
}
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;
}
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)
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;
}
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,
}
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,
/*
- * 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
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);
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,
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,