summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_plane.c
diff options
context:
space:
mode:
authorJessica Zhang <quic_jesszhan@quicinc.com>2023-10-28 01:32:51 +0300
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-12-02 02:56:46 +0300
commite50e5fed41c7eed2db4119645bf3480ec43fec11 (patch)
tree21c7994957b46423b1b44b6efdbf6a7863240449 /drivers/gpu/drm/drm_plane.c
parent70e67aaec2f4706df0006423eebca813b00f5840 (diff)
downloadlinux-e50e5fed41c7eed2db4119645bf3480ec43fec11.tar.xz
drm: Introduce pixel_source DRM plane property
Add support for pixel_source property to drm_plane and related documentation. In addition, force pixel_source to DRM_PLANE_PIXEL_SOURCE_FB in DRM_IOCTL_MODE_SETPLANE as to not break legacy userspace. This enum property will allow user to specify a pixel source for the plane. Possible pixel sources will be defined in the drm_plane_pixel_source enum. Currently, the only pixel sources are DRM_PLANE_PIXEL_SOURCE_FB (the default value) and DRM_PLANE_PIXEL_SOURCE_NONE. Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Sebastian Wick <sebastian@sebastianwick.net> Acked-by: Simon Ser <contact@emersion.fr> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20231027-solid-fill-v7-1-780188bfa7b2@quicinc.com
Diffstat (limited to 'drivers/gpu/drm/drm_plane.c')
-rw-r--r--drivers/gpu/drm/drm_plane.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 9e8e4c60983d..c8dbe5ae60cc 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -953,6 +953,14 @@ bool drm_any_plane_has_format(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_any_plane_has_format);
+static bool drm_plane_needs_disable(struct drm_plane_state *state, struct drm_framebuffer *fb)
+{
+ if (state->pixel_source == DRM_PLANE_PIXEL_SOURCE_NONE)
+ return true;
+
+ return state->pixel_source == DRM_PLANE_PIXEL_SOURCE_FB && fb == NULL;
+}
+
/*
* __setplane_internal - setplane handler for internal callers
*
@@ -975,8 +983,8 @@ static int __setplane_internal(struct drm_plane *plane,
WARN_ON(drm_drv_uses_atomic_modeset(plane->dev));
- /* No fb means shut it down */
- if (!fb) {
+ /* No visible data means shut it down */
+ if (drm_plane_needs_disable(plane->state, fb)) {
plane->old_fb = plane->fb;
ret = plane->funcs->disable_plane(plane, ctx);
if (!ret) {
@@ -1027,8 +1035,8 @@ static int __setplane_atomic(struct drm_plane *plane,
WARN_ON(!drm_drv_uses_atomic_modeset(plane->dev));
- /* No fb means shut it down */
- if (!fb)
+ /* No visible data means shut it down */
+ if (drm_plane_needs_disable(plane->state, fb))
return plane->funcs->disable_plane(plane, ctx);
/*
@@ -1101,6 +1109,9 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
return -ENOENT;
}
+ if (plane->state)
+ plane->state->pixel_source = DRM_PLANE_PIXEL_SOURCE_FB;
+
if (plane_req->fb_id) {
fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
if (!fb) {