drm/vkms: Use offset-adjusted shadow-plane mappings and output

For framebuffers with non-zero offset fields, shadow-plane helpers
provide a pointer to the first byte of the contained data. Use it in
vkms.

Also provide use the offset-adjusted data address for the writeback
job's output buffers. Output framebuffers with non-zero offsets now
have their content written to the correct location.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210803125928.27780-12-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2021-08-03 14:59:28 +02:00
parent 0c64f2f3c8
commit 2ca380ea0e
4 changed files with 4 additions and 3 deletions

View File

@ -257,7 +257,7 @@ void vkms_composer_worker(struct work_struct *work)
return; return;
if (wb_pending) if (wb_pending)
vaddr_out = crtc_state->active_writeback->map[0].vaddr; vaddr_out = crtc_state->active_writeback->data[0].vaddr;
ret = compose_active_planes(&vaddr_out, primary_composer, ret = compose_active_planes(&vaddr_out, primary_composer,
crtc_state); crtc_state);

View File

@ -22,6 +22,7 @@
struct vkms_writeback_job { struct vkms_writeback_job {
struct dma_buf_map map[DRM_FORMAT_MAX_PLANES]; struct dma_buf_map map[DRM_FORMAT_MAX_PLANES];
struct dma_buf_map data[DRM_FORMAT_MAX_PLANES];
}; };
struct vkms_composer { struct vkms_composer {

View File

@ -111,7 +111,7 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,
memcpy(&composer->src, &new_state->src, sizeof(struct drm_rect)); memcpy(&composer->src, &new_state->src, sizeof(struct drm_rect));
memcpy(&composer->dst, &new_state->dst, sizeof(struct drm_rect)); memcpy(&composer->dst, &new_state->dst, sizeof(struct drm_rect));
memcpy(&composer->fb, fb, sizeof(struct drm_framebuffer)); memcpy(&composer->fb, fb, sizeof(struct drm_framebuffer));
memcpy(&composer->map, &shadow_plane_state->map, sizeof(composer->map)); memcpy(&composer->map, &shadow_plane_state->data, sizeof(composer->map));
drm_framebuffer_get(&composer->fb); drm_framebuffer_get(&composer->fb);
composer->offset = fb->offsets[0]; composer->offset = fb->offsets[0];
composer->pitch = fb->pitches[0]; composer->pitch = fb->pitches[0];

View File

@ -75,7 +75,7 @@ static int vkms_wb_prepare_job(struct drm_writeback_connector *wb_connector,
if (!vkmsjob) if (!vkmsjob)
return -ENOMEM; return -ENOMEM;
ret = drm_gem_fb_vmap(job->fb, vkmsjob->map, NULL); ret = drm_gem_fb_vmap(job->fb, vkmsjob->map, vkmsjob->data);
if (ret) { if (ret) {
DRM_ERROR("vmap failed: %d\n", ret); DRM_ERROR("vmap failed: %d\n", ret);
goto err_kfree; goto err_kfree;