Message ID | 20210728003126.1425028-9-anitha.chrisanthus@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/14] drm/kmb: Enable LCD DMA for low TVDDCV | expand |
Please ignore this patch. Will combine this with 256B w/a patch. > -----Original Message----- > From: Chrisanthus, Anitha <anitha.chrisanthus@intel.com> > Sent: Tuesday, July 27, 2021 5:31 PM > To: dri-devel@lists.freedesktop.org; Chrisanthus, Anitha > <anitha.chrisanthus@intel.com>; Dea, Edmund J <edmund.j.dea@intel.com> > Subject: [PATCH 09/14] drm/kmb : W/A for planar formats > > This is a work around for fully planar formats, where color corruption > was observed for formats like YU12, YU16 etc. Set the DMA Vstride and > Line width for U and V planes to the same as the Y plane and not the > actual pitch. For decoded video frames, continue to use the info from > metadata. > > Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display") > Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com> > --- > drivers/gpu/drm/kmb/kmb_plane.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/kmb/kmb_plane.c > b/drivers/gpu/drm/kmb/kmb_plane.c > index dacec5c4266f..4523af949ea1 100644 > --- a/drivers/gpu/drm/kmb/kmb_plane.c > +++ b/drivers/gpu/drm/kmb/kmb_plane.c > @@ -333,6 +333,7 @@ static void kmb_plane_atomic_update(struct > drm_plane *plane, > struct disp_cfg *init_disp_cfg; > struct viv_vidmem_metadata *md = NULL; > struct drm_gem_object *gem_obj; > + unsigned int cb_stride, cr_stride; > > if (!plane || !new_plane_state || !old_plane_state) > return; > @@ -397,8 +398,10 @@ static void kmb_plane_atomic_update(struct > drm_plane *plane, > val |= get_bits_per_pixel(fb->format); > /* Program Cb/Cr for planar formats */ > if (num_planes > 1) { > - kmb_write_lcd(kmb, > LCD_LAYERn_DMA_CB_LINE_VSTRIDE(plane_id), > - fb->pitches[1]); > + cb_stride = md ? fb->pitches[1] : width * fb->format->cpp[0]; > + kmb_write_lcd(kmb, > + LCD_LAYERn_DMA_CB_LINE_VSTRIDE(plane_id), > + cb_stride); > kmb_write_lcd(kmb, > LCD_LAYERn_DMA_CB_LINE_WIDTH(plane_id), > (width * fb->format->cpp[0])); > > @@ -419,9 +422,11 @@ static void kmb_plane_atomic_update(struct > drm_plane *plane, > addr[U_PLANE]); > > if (num_planes == 3) { > + cr_stride = md ? fb->pitches[2] : > + width * fb->format->cpp[0]; > kmb_write_lcd(kmb, > > LCD_LAYERn_DMA_CR_LINE_VSTRIDE(plane_id), > - fb->pitches[2]); > + cr_stride); > > kmb_write_lcd(kmb, > > LCD_LAYERn_DMA_CR_LINE_WIDTH(plane_id), > -- > 2.25.1
diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c index dacec5c4266f..4523af949ea1 100644 --- a/drivers/gpu/drm/kmb/kmb_plane.c +++ b/drivers/gpu/drm/kmb/kmb_plane.c @@ -333,6 +333,7 @@ static void kmb_plane_atomic_update(struct drm_plane *plane, struct disp_cfg *init_disp_cfg; struct viv_vidmem_metadata *md = NULL; struct drm_gem_object *gem_obj; + unsigned int cb_stride, cr_stride; if (!plane || !new_plane_state || !old_plane_state) return; @@ -397,8 +398,10 @@ static void kmb_plane_atomic_update(struct drm_plane *plane, val |= get_bits_per_pixel(fb->format); /* Program Cb/Cr for planar formats */ if (num_planes > 1) { - kmb_write_lcd(kmb, LCD_LAYERn_DMA_CB_LINE_VSTRIDE(plane_id), - fb->pitches[1]); + cb_stride = md ? fb->pitches[1] : width * fb->format->cpp[0]; + kmb_write_lcd(kmb, + LCD_LAYERn_DMA_CB_LINE_VSTRIDE(plane_id), + cb_stride); kmb_write_lcd(kmb, LCD_LAYERn_DMA_CB_LINE_WIDTH(plane_id), (width * fb->format->cpp[0])); @@ -419,9 +422,11 @@ static void kmb_plane_atomic_update(struct drm_plane *plane, addr[U_PLANE]); if (num_planes == 3) { + cr_stride = md ? fb->pitches[2] : + width * fb->format->cpp[0]; kmb_write_lcd(kmb, LCD_LAYERn_DMA_CR_LINE_VSTRIDE(plane_id), - fb->pitches[2]); + cr_stride); kmb_write_lcd(kmb, LCD_LAYERn_DMA_CR_LINE_WIDTH(plane_id),
This is a work around for fully planar formats, where color corruption was observed for formats like YU12, YU16 etc. Set the DMA Vstride and Line width for U and V planes to the same as the Y plane and not the actual pitch. For decoded video frames, continue to use the info from metadata. Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display") Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com> --- drivers/gpu/drm/kmb/kmb_plane.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)