Commit 2eef1ef6 authored by Igor Torrente's avatar Igor Torrente Committed by Melissa Wen

drm: vkms: get the reference to `drm_framebuffer` instead if coping it

Instead of coping `drm_framebuffer` - which can cause problems -
we just get the reference and add the ref count.
Reviewed-by: default avatarMelissa Wen <mwen@igalia.com>
Signed-off-by: default avatarIgor Torrente <igormtorrente@gmail.com>
Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220905190811.25024-5-igormtorrente@gmail.com
parent 254fe9c1
......@@ -153,7 +153,7 @@ static void compose_plane(struct vkms_frame_info *primary_plane_info,
struct vkms_frame_info *plane_frame_info,
void *vaddr_out)
{
struct drm_framebuffer *fb = &plane_frame_info->fb;
struct drm_framebuffer *fb = plane_frame_info->fb;
void *vaddr;
void (*pixel_blend)(const u8 *p_src, u8 *p_dst);
......@@ -175,7 +175,7 @@ static int compose_active_planes(void **vaddr_out,
struct vkms_frame_info *primary_plane_info,
struct vkms_crtc_state *crtc_state)
{
struct drm_framebuffer *fb = &primary_plane_info->fb;
struct drm_framebuffer *fb = primary_plane_info->fb;
struct drm_gem_object *gem_obj = drm_gem_fb_get_obj(fb, 0);
const void *vaddr;
int i;
......
......@@ -29,7 +29,7 @@ struct vkms_writeback_job {
};
struct vkms_frame_info {
struct drm_framebuffer fb;
struct drm_framebuffer *fb;
struct drm_rect src, dst;
struct iosys_map map[DRM_FORMAT_MAX_PLANES];
unsigned int offset;
......
......@@ -49,12 +49,12 @@ static void vkms_plane_destroy_state(struct drm_plane *plane,
struct vkms_plane_state *vkms_state = to_vkms_plane_state(old_state);
struct drm_crtc *crtc = vkms_state->base.base.crtc;
if (crtc) {
if (crtc && vkms_state->frame_info->fb) {
/* dropping the reference we acquired in
* vkms_primary_plane_update()
*/
if (drm_framebuffer_read_refcount(&vkms_state->frame_info->fb))
drm_framebuffer_put(&vkms_state->frame_info->fb);
if (drm_framebuffer_read_refcount(vkms_state->frame_info->fb))
drm_framebuffer_put(vkms_state->frame_info->fb);
}
kfree(vkms_state->frame_info);
......@@ -109,9 +109,9 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,
frame_info = vkms_plane_state->frame_info;
memcpy(&frame_info->src, &new_state->src, sizeof(struct drm_rect));
memcpy(&frame_info->dst, &new_state->dst, sizeof(struct drm_rect));
memcpy(&frame_info->fb, fb, sizeof(struct drm_framebuffer));
frame_info->fb = fb;
memcpy(&frame_info->map, &shadow_plane_state->data, sizeof(frame_info->map));
drm_framebuffer_get(&frame_info->fb);
drm_framebuffer_get(frame_info->fb);
frame_info->offset = fb->offsets[0];
frame_info->pitch = fb->pitches[0];
frame_info->cpp = fb->format->cpp[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment