Skip to content

Commit

Permalink
drm/vkms: refactor overlay plane creation
Browse files Browse the repository at this point in the history
Move the logic to create an overlay plane to its own function.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220107182809.141003-1-jose.exposito89@gmail.com
  • Loading branch information
José Expósito authored and Melissa Wen committed Jan 9, 2022
1 parent 5313fb2 commit 5edaa2b
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions drivers/gpu/drm/vkms/vkms_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,29 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
.get_modes = vkms_conn_get_modes,
};

static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
struct drm_crtc *crtc)
{
struct vkms_plane *overlay;

overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
if (IS_ERR(overlay))
return PTR_ERR(overlay);

if (!overlay->base.possible_crtcs)
overlay->base.possible_crtcs = drm_crtc_mask(crtc);

return 0;
}

int vkms_output_init(struct vkms_device *vkmsdev, int index)
{
struct vkms_output *output = &vkmsdev->output;
struct drm_device *dev = &vkmsdev->drm;
struct drm_connector *connector = &output->connector;
struct drm_encoder *encoder = &output->encoder;
struct drm_crtc *crtc = &output->crtc;
struct vkms_plane *primary, *cursor = NULL, *overlay = NULL;
struct vkms_plane *primary, *cursor = NULL;
int ret;
int writeback;

Expand All @@ -48,12 +63,9 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
return PTR_ERR(primary);

if (vkmsdev->config->overlay) {
overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
if (IS_ERR(overlay))
return PTR_ERR(overlay);

if (!overlay->base.possible_crtcs)
overlay->base.possible_crtcs = drm_crtc_mask(crtc);
ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
if (ret)
return ret;
}

if (vkmsdev->config->cursor) {
Expand Down

0 comments on commit 5edaa2b

Please sign in to comment.