1 // SPDX-License-Identifier: GPL-2.0
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
10 #include <drm/drm_plane_helper.h>
11 #include <drm/drm_atomic_helper.h>
13 static const struct drm_plane_funcs vkms_plane_funcs = {
14 .update_plane = drm_atomic_helper_update_plane,
15 .disable_plane = drm_atomic_helper_disable_plane,
16 .destroy = drm_plane_cleanup,
17 .reset = drm_atomic_helper_plane_reset,
18 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
19 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
22 static void vkms_primary_plane_update(struct drm_plane *plane,
23 struct drm_plane_state *old_state)
27 static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
28 .atomic_update = vkms_primary_plane_update,
31 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev)
33 struct drm_device *dev = &vkmsdev->drm;
34 struct drm_plane *plane;
38 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
40 return ERR_PTR(-ENOMEM);
42 formats = vkms_formats;
43 nformats = ARRAY_SIZE(vkms_formats);
45 ret = drm_universal_plane_init(dev, plane, 0,
48 NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
54 drm_plane_helper_add(plane, &vkms_primary_helper_funcs);