1
0
Fork 0

MLK-15110-19 gpu: imx: dpu: fetchdecode: Fixup stride when we use prefetch

When we use prefetch, we use DPR and PRG to do frame input cropping.  Thus,
the stride of fetchdecode is the stride of cropped frame, which means the
value of the stride is cropped_width * bytes_per_pixel.  Also, to address
TKT339017, when we use prefetch engine for fetchdecode, we need to round
the frame stride up to the fetchdecode 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
fetchdecode_source_stride().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
pull/10/head
Liu Ying 2017-06-28 15:55:24 +08:00 committed by Jason Liu
parent 0e8ecbabd4
commit 1b1881be86
3 changed files with 25 additions and 3 deletions

View File

@ -354,7 +354,8 @@ static void dpu_plane_atomic_update(struct drm_plane *plane,
}
fetchdecode_source_bpp(fd, bpp);
fetchdecode_source_stride(fd, fb->pitches[0]);
fetchdecode_source_stride(fd, src_w, bpp, fb->pitches[0],
drm_plane_state_to_baseaddr(state), false);
fetchdecode_src_buf_dimensions(fd, src_w, src_h);
fetchdecode_set_fmt(fd, fb->format->format);
fetchdecode_source_buffer_enable(fd);

View File

@ -269,10 +269,29 @@ void fetchdecode_source_bpp(struct dpu_fetchdecode *fd, int bpp)
}
EXPORT_SYMBOL_GPL(fetchdecode_source_bpp);
void fetchdecode_source_stride(struct dpu_fetchdecode *fd, int stride)
void fetchdecode_source_stride(struct dpu_fetchdecode *fd, 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(&fd->mutex);
val = dpu_fd_read(fd, SOURCEBUFFERATTRIBUTES0);
val &= ~0xffff;

View File

@ -476,7 +476,9 @@ void fetchdecode_set_burstlength(struct dpu_fetchdecode *fd, dma_addr_t baddr,
bool use_prefetch);
void fetchdecode_baseaddress(struct dpu_fetchdecode *fd, dma_addr_t paddr);
void fetchdecode_source_bpp(struct dpu_fetchdecode *fd, int bpp);
void fetchdecode_source_stride(struct dpu_fetchdecode *fd, int stride);
void fetchdecode_source_stride(struct dpu_fetchdecode *fd, unsigned int width,
int bpp, unsigned int stride,
dma_addr_t baddr, bool use_prefetch);
void fetchdecode_src_buf_dimensions(struct dpu_fetchdecode *fd, unsigned int w,
unsigned int h);
void fetchdecode_set_fmt(struct dpu_fetchdecode *fd, u32 fmt);