Skip to content

Commit

Permalink
drm/verisilicon: bias fb address for dual-head offset
Browse files Browse the repository at this point in the history
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
  • Loading branch information
Icenowy authored and RevySR committed Sep 16, 2024
1 parent ef81b6e commit 90077b9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions drivers/gpu/drm/verisilicon/vs_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,18 +497,43 @@ static void update_fb(struct vs_plane *plane, u8 display_id,
struct vs_plane_state *plane_state = to_vs_plane_state(state);
struct drm_framebuffer *drm_fb = state->fb;
struct drm_rect *src = &state->src;
u32 src_x, src_y;

src_y = src->y1 >> 16;
src_x = src->x1 >> 16;

fb->display_id = display_id;
fb->y_address = plane->dma_addr[0];
if (src_y)
fb->y_address += src_y * drm_fb->pitches[0];
if (src_x)
fb->y_address += src_x * drm_fb->format->cpp[0];

fb->y_stride = drm_fb->pitches[0];
if (drm_fb->format->format == DRM_FORMAT_YVU420) {
fb->u_address = plane->dma_addr[2];
if (src_y)
fb->u_address += src_y * drm_fb->pitches[2];
if (src_x)
fb->u_address += src_x * drm_fb->format->cpp[2];
fb->v_address = plane->dma_addr[1];
if (src_y)
fb->v_address += src_y * drm_fb->pitches[1];
if (src_x)
fb->v_address += src_x * drm_fb->format->cpp[1];
fb->u_stride = drm_fb->pitches[2];
fb->v_stride = drm_fb->pitches[1];
} else {
fb->u_address = plane->dma_addr[1];
if (src_y)
fb->u_address += src_y * drm_fb->pitches[1];
if (src_x)
fb->u_address += src_x * drm_fb->format->cpp[1];
fb->v_address = plane->dma_addr[2];
if (src_y)
fb->v_address += src_y * drm_fb->pitches[2];
if (src_x)
fb->v_address += src_x * drm_fb->format->cpp[2];
fb->u_stride = drm_fb->pitches[1];
fb->v_stride = drm_fb->pitches[2];
}
Expand Down

0 comments on commit 90077b9

Please sign in to comment.