Commit 7602d422 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/vkms: Inherit plane state from struct drm_shadow_plane_state

Subclass struct drm_shadow_plane_state for VKMS planes and update
all plane-state callbacks accordingly.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210705074633.9425-3-tzimmermann@suse.de
parent b7156502
......@@ -251,7 +251,7 @@ void vkms_composer_worker(struct work_struct *work)
if (crtc_state->num_active_planes >= 1) {
act_plane = crtc_state->active_planes[0];
if (act_plane->base.plane->type == DRM_PLANE_TYPE_PRIMARY)
if (act_plane->base.base.plane->type == DRM_PLANE_TYPE_PRIMARY)
primary_composer = act_plane->composer;
}
......
......@@ -7,6 +7,7 @@
#include <drm/drm.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_encoder.h>
#include <drm/drm_writeback.h>
......@@ -33,7 +34,7 @@ struct vkms_composer {
* @composer: data required for composing computation
*/
struct vkms_plane_state {
struct drm_plane_state base;
struct drm_shadow_plane_state base;
struct vkms_composer *composer;
};
......@@ -111,7 +112,7 @@ struct vkms_device {
container_of(target, struct vkms_crtc_state, base)
#define to_vkms_plane_state(target)\
container_of(target, struct vkms_plane_state, base)
container_of(target, struct vkms_plane_state, base.base)
/* CRTC */
int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
......
......@@ -40,17 +40,16 @@ vkms_plane_duplicate_state(struct drm_plane *plane)
vkms_state->composer = composer;
__drm_atomic_helper_plane_duplicate_state(plane,
&vkms_state->base);
__drm_gem_duplicate_shadow_plane_state(plane, &vkms_state->base);
return &vkms_state->base;
return &vkms_state->base.base;
}
static void vkms_plane_destroy_state(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct vkms_plane_state *vkms_state = to_vkms_plane_state(old_state);
struct drm_crtc *crtc = vkms_state->base.crtc;
struct drm_crtc *crtc = vkms_state->base.base.crtc;
if (crtc) {
/* dropping the reference we acquired in
......@@ -63,7 +62,7 @@ static void vkms_plane_destroy_state(struct drm_plane *plane,
kfree(vkms_state->composer);
vkms_state->composer = NULL;
__drm_atomic_helper_plane_destroy_state(old_state);
__drm_gem_destroy_shadow_plane_state(&vkms_state->base);
kfree(vkms_state);
}
......@@ -71,8 +70,10 @@ static void vkms_plane_reset(struct drm_plane *plane)
{
struct vkms_plane_state *vkms_state;
if (plane->state)
if (plane->state) {
vkms_plane_destroy_state(plane, plane->state);
plane->state = NULL; /* must be set to NULL here */
}
vkms_state = kzalloc(sizeof(*vkms_state), GFP_KERNEL);
if (!vkms_state) {
......@@ -80,8 +81,7 @@ static void vkms_plane_reset(struct drm_plane *plane)
return;
}
plane->state = &vkms_state->base;
plane->state->plane = plane;
__drm_gem_reset_shadow_plane(plane, &vkms_state->base);
}
static const struct drm_plane_funcs vkms_plane_funcs = {
......
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