lkml.org 
[lkml]   [2019]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] drm/rockchip: Add vop_format_get_bpp to get format bpp
Date
For 10bit yuv format, we need to get format bpp each plane, so we
Add vop_format_get_bpp() to instead of format->cpp[];

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 2f821c5..ce5b45d 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -249,6 +249,25 @@ static bool has_rb_swapped(uint32_t format)
}
}

+static int vop_format_get_bpp(u32 format, u8 plane)
+{
+ const struct drm_format_info *info;
+
+ info = drm_format_info(format);
+ if (!info || plane >= info->num_planes)
+ return 0;
+
+ if (info->cpp[0] == 0) {
+ /* only support DRM_FORMAT_NVxx_10 now */
+ if (plane == 0)
+ return 10;
+ else
+ return 20;
+ }
+
+ return info->cpp[plane] * 8;
+}
+
static enum vop_data_format vop_convert_format(uint32_t format)
{
switch (format) {
@@ -832,7 +851,8 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);

- offset = (src->x1 >> 16) * fb->format->cpp[0];
+ offset = (src->x1 >> 16) *
+ vop_format_get_bpp(fb->format->format, 0) / 8;
offset += (src->y1 >> 16) * fb->pitches[0];
dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];

@@ -859,12 +879,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
if (is_yuv) {
int hsub = fb->format->hsub;
int vsub = fb->format->vsub;
- int bpp = fb->format->cpp[1];
+ int bpp = vop_format_get_bpp(fb->format->format, 1);

uv_obj = fb->obj[1];
rk_uv_obj = to_rockchip_obj(uv_obj);

- offset = (src->x1 >> 16) * bpp / hsub;
+ offset = (src->x1 >> 16) * bpp / 8 / hsub;
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;

dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
--
2.7.4


\
 
 \ /
  Last update: 2019-09-25 10:08    [W:0.027 / U:5.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site