summaryrefslogtreecommitdiff
path: root/drivers/gpu/imx/dpu
diff options
context:
space:
mode:
authorLiu Ying <victor.liu@nxp.com>2017-08-01 11:28:16 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commita3ddab824ed8cd246ae20817d3354e505ef9e8e6 (patch)
treee95e4b89ed0db4a8320bb098d26e2bdfa9f4849b /drivers/gpu/imx/dpu
parent970f79bfec9df54782916d6e9b39f17b39d17af1 (diff)
MLK-15110-20 gpu: imx: dpu: fetcheco: Fixup stride when we use prefetch
When we use prefetch, we use DPR and PRG to do frame input cropping. Thus, the stride of fetcheco is the stride of cropped frame, which means the value of the stride is cropped_width * bytes_per_pixel. Since the pixel format has to be NV12 or NV21 when we use prefetch, we assume the cropped_width stands for how many UV we have in bytes for one line, while bytes_per_pixel should be 8bits for every U or V component. Also, to address TKT339017, when we use prefetch engine for fetcheco, we need to round the stride up to the fetcheco burst size, i.e., burst length multiplies 8 bytes. According to TKT343664, the buffer base address has to align to burst size, so we'll pick an appropriate burst size value in fetcheco_source_stride(). Signed-off-by: Liu Ying <victor.liu@nxp.com>
Diffstat (limited to 'drivers/gpu/imx/dpu')
-rw-r--r--drivers/gpu/imx/dpu/dpu-fetcheco.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/gpu/imx/dpu/dpu-fetcheco.c b/drivers/gpu/imx/dpu/dpu-fetcheco.c
index 178ecae0fd2d..77ee950b59e3 100644
--- a/drivers/gpu/imx/dpu/dpu-fetcheco.c
+++ b/drivers/gpu/imx/dpu/dpu-fetcheco.c
@@ -140,10 +140,35 @@ void fetcheco_source_bpp(struct dpu_fetcheco *fe, int bpp)
}
EXPORT_SYMBOL_GPL(fetcheco_source_bpp);
-void fetcheco_source_stride(struct dpu_fetcheco *fe, int stride)
+/*
+ * The arguments width and bpp are valid only when use_prefetch is true.
+ * Since the pixel format has to be NV12 or NV21 when use_prefetch is true,
+ * we assume width stands for how many UV we have in bytes for one line,
+ * while bpp should be 8bits for every U or V component.
+ */
+void fetcheco_source_stride(struct dpu_fetcheco *fe, unsigned int width,
+ int bpp, unsigned int stride,
+ dma_addr_t baddr, bool use_prefetch)
{
+ unsigned int burst_size;
u32 val;
+ if (use_prefetch) {
+ /*
+ * address TKT343664:
+ * fetch unit base address has to align to burst size
+ */
+ burst_size = 1 << (ffs(baddr) - 1);
+ burst_size = min(burst_size, 128U);
+
+ stride = width * (bpp >> 3);
+ /*
+ * address TKT339017:
+ * fixup for burst size vs stride mismatch
+ */
+ stride = round_up(stride, burst_size);
+ }
+
mutex_lock(&fe->mutex);
val = dpu_fe_read(fe, SOURCEBUFFERATTRIBUTES0);
val &= ~0xffff;