summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vkms/vkms_plane.c
diff options
context:
space:
mode:
authorHaneen Mohammed <hamohammed.sa@gmail.com>2018-09-06 08:17:16 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2018-09-11 19:56:13 +0200
commitc27d931d402b517336fea2b25ae951bee0249f65 (patch)
treefdcdcab7c4a4cef3a1d048d2fa9fbcf5c7d1cf04 /drivers/gpu/drm/vkms/vkms_plane.c
parent6be8f3bd2c78915a9f3a058a346ae93068d35c01 (diff)
downloadblackbird-obmc-linux-c27d931d402b517336fea2b25ae951bee0249f65.tar.gz
blackbird-obmc-linux-c27d931d402b517336fea2b25ae951bee0249f65.zip
drm/vkms: Add cursor plane support
Add cursor plane support and update vkms_plane_atomic_check to enable positioning cursor plane. Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/c69078820eacf3246fa77beb0c6227b692cc5e82.1536210181.git.hamohammed.sa@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_plane.c')
-rw-r--r--drivers/gpu/drm/vkms/vkms_plane.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index c91661631c76..428247d403dc 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -81,8 +81,8 @@ static const struct drm_plane_funcs vkms_plane_funcs = {
.atomic_destroy_state = vkms_plane_destroy_state,
};
-static void vkms_primary_plane_update(struct drm_plane *plane,
- struct drm_plane_state *old_state)
+static void vkms_plane_atomic_update(struct drm_plane *plane,
+ struct drm_plane_state *old_state)
{
struct vkms_plane_state *vkms_plane_state;
struct vkms_crc_data *crc_data;
@@ -101,6 +101,7 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_crtc_state *crtc_state;
+ bool can_position = false;
int ret;
if (!state->fb | !state->crtc)
@@ -110,15 +111,18 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ can_position = true;
+
ret = drm_atomic_helper_check_plane_state(state, crtc_state,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
- false, true);
+ can_position, true);
if (ret != 0)
return ret;
/* for now primary plane must be visible and full screen */
- if (!state->visible)
+ if (!state->visible && !can_position)
return -EINVAL;
return 0;
@@ -156,15 +160,17 @@ static void vkms_cleanup_fb(struct drm_plane *plane,
}
static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
- .atomic_update = vkms_primary_plane_update,
+ .atomic_update = vkms_plane_atomic_update,
.atomic_check = vkms_plane_atomic_check,
.prepare_fb = vkms_prepare_fb,
.cleanup_fb = vkms_cleanup_fb,
};
-struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
+struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
+ enum drm_plane_type type)
{
struct drm_device *dev = &vkmsdev->drm;
+ const struct drm_plane_helper_funcs *funcs;
struct drm_plane *plane;
const u32 *formats;
int ret, nformats;
@@ -173,19 +179,26 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
if (!plane)
return ERR_PTR(-ENOMEM);
- formats = vkms_formats;
- nformats = ARRAY_SIZE(vkms_formats);
+ if (type == DRM_PLANE_TYPE_CURSOR) {
+ formats = vkms_cursor_formats;
+ nformats = ARRAY_SIZE(vkms_cursor_formats);
+ funcs = &vkms_primary_helper_funcs;
+ } else {
+ formats = vkms_formats;
+ nformats = ARRAY_SIZE(vkms_formats);
+ funcs = &vkms_primary_helper_funcs;
+ }
ret = drm_universal_plane_init(dev, plane, 0,
&vkms_plane_funcs,
formats, nformats,
- NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
+ NULL, type, NULL);
if (ret) {
kfree(plane);
return ERR_PTR(ret);
}
- drm_plane_helper_add(plane, &vkms_primary_helper_funcs);
+ drm_plane_helper_add(plane, funcs);
return plane;
}
OpenPOWER on IntegriCloud