Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5edaa2b

Browse files
JoseExpositomelissawen
authored andcommitted
drm/vkms: refactor overlay plane creation
Move the logic to create an overlay plane to its own function. Refactor, no functional changes. Signed-off-by: José Expósito <[email protected]> Reviewed-by: Melissa Wen <[email protected]> Signed-off-by: Melissa Wen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5313fb2 commit 5edaa2b

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

drivers/gpu/drm/vkms/vkms_output.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,29 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
3232
.get_modes = vkms_conn_get_modes,
3333
};
3434

35+
static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
36+
struct drm_crtc *crtc)
37+
{
38+
struct vkms_plane *overlay;
39+
40+
overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
41+
if (IS_ERR(overlay))
42+
return PTR_ERR(overlay);
43+
44+
if (!overlay->base.possible_crtcs)
45+
overlay->base.possible_crtcs = drm_crtc_mask(crtc);
46+
47+
return 0;
48+
}
49+
3550
int vkms_output_init(struct vkms_device *vkmsdev, int index)
3651
{
3752
struct vkms_output *output = &vkmsdev->output;
3853
struct drm_device *dev = &vkmsdev->drm;
3954
struct drm_connector *connector = &output->connector;
4055
struct drm_encoder *encoder = &output->encoder;
4156
struct drm_crtc *crtc = &output->crtc;
42-
struct vkms_plane *primary, *cursor = NULL, *overlay = NULL;
57+
struct vkms_plane *primary, *cursor = NULL;
4358
int ret;
4459
int writeback;
4560

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

5065
if (vkmsdev->config->overlay) {
51-
overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
52-
if (IS_ERR(overlay))
53-
return PTR_ERR(overlay);
54-
55-
if (!overlay->base.possible_crtcs)
56-
overlay->base.possible_crtcs = drm_crtc_mask(crtc);
66+
ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
67+
if (ret)
68+
return ret;
5769
}
5870

5971
if (vkmsdev->config->cursor) {

0 commit comments

Comments
 (0)