mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 09:04:51 +08:00
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: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Melissa Wen <melissa.srw@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210705074633.9425-3-tzimmermann@suse.de
This commit is contained in:
parent
b715650220
commit
7602d42218
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user