diff options
author | Sinclair Yeh <syeh@vmware.com> | 2017-03-23 11:28:11 -0700 |
---|---|---|
committer | Sinclair Yeh <syeh@vmware.com> | 2017-03-31 09:13:08 -0700 |
commit | 36cc79bc9077319c04bd3b132edcacaa9a0d9f2b (patch) | |
tree | 85674576ea3047d63c069cb3ae7ce73bfce90c41 /drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |
parent | 27d247c678a09fcac08d6865db73e41b23d3d5f3 (diff) | |
download | lwn-36cc79bc9077319c04bd3b132edcacaa9a0d9f2b.tar.gz lwn-36cc79bc9077319c04bd3b132edcacaa9a0d9f2b.zip |
drm/vmwgfx: Add universal plane support
Universal support is prerequisite for atomic mode set.
Explicitly create planes for the cursor and the primary FB. With
a functional cursor plane, the DRM will no longer use the legacy
cursor_set2 and cursor_move entry points.
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index d4268efc37d2..8ffccb87cf3a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@ -459,8 +459,6 @@ out_no_fence: } static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { - .cursor_set2 = vmw_du_crtc_cursor_set2, - .cursor_move = vmw_du_crtc_cursor_move, .gamma_set = vmw_du_crtc_gamma_set, .destroy = vmw_sou_crtc_destroy, .set_config = vmw_sou_crtc_set_config, @@ -497,6 +495,23 @@ static const struct drm_connector_funcs vmw_sou_connector_funcs = { .destroy = vmw_sou_connector_destroy, }; +/* + * Screen Object Display Plane Functions + */ + +static const struct drm_plane_funcs vmw_sou_plane_funcs = { + .update_plane = drm_primary_helper_update, + .disable_plane = drm_primary_helper_disable, + .destroy = vmw_du_primary_plane_destroy, +}; + +static const struct drm_plane_funcs vmw_sou_cursor_funcs = { + .update_plane = vmw_du_cursor_plane_update, + .disable_plane = vmw_du_cursor_plane_disable, + .destroy = vmw_du_cursor_plane_destroy, +}; + + static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) { struct vmw_screen_object_unit *sou; @@ -504,6 +519,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) struct drm_connector *connector; struct drm_encoder *encoder; struct drm_crtc *crtc; + int ret; sou = kzalloc(sizeof(*sou), GFP_KERNEL); if (!sou) @@ -521,19 +537,62 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) sou->base.pref_mode = NULL; sou->base.is_implicit = false; - drm_connector_init(dev, connector, &vmw_sou_connector_funcs, - DRM_MODE_CONNECTOR_VIRTUAL); + /* Initialize primary plane */ + ret = drm_universal_plane_init(dev, &sou->base.primary, + 0, &vmw_sou_plane_funcs, + vmw_primary_plane_formats, + ARRAY_SIZE(vmw_primary_plane_formats), + DRM_PLANE_TYPE_PRIMARY, NULL); + if (ret) { + DRM_ERROR("Failed to initialize primary plane"); + goto err_free; + } + + /* Initialize cursor plane */ + ret = drm_universal_plane_init(dev, &sou->base.cursor, + 0, &vmw_sou_cursor_funcs, + vmw_cursor_plane_formats, + ARRAY_SIZE(vmw_cursor_plane_formats), + DRM_PLANE_TYPE_CURSOR, NULL); + if (ret) { + DRM_ERROR("Failed to initialize cursor plane"); + drm_plane_cleanup(&sou->base.primary); + goto err_free; + } + + ret = drm_connector_init(dev, connector, &vmw_sou_connector_funcs, + DRM_MODE_CONNECTOR_VIRTUAL); + if (ret) { + DRM_ERROR("Failed to initialize connector\n"); + goto err_free; + } + connector->status = vmw_du_connector_detect(connector, true); - drm_encoder_init(dev, encoder, &vmw_screen_object_encoder_funcs, - DRM_MODE_ENCODER_VIRTUAL, NULL); - drm_mode_connector_attach_encoder(connector, encoder); + ret = drm_encoder_init(dev, encoder, &vmw_screen_object_encoder_funcs, + DRM_MODE_ENCODER_VIRTUAL, NULL); + if (ret) { + DRM_ERROR("Failed to initialize encoder\n"); + goto err_free_connector; + } + + (void) drm_mode_connector_attach_encoder(connector, encoder); encoder->possible_crtcs = (1 << unit); encoder->possible_clones = 0; - (void) drm_connector_register(connector); + ret = drm_connector_register(connector); + if (ret) { + DRM_ERROR("Failed to register connector\n"); + goto err_free_encoder; + } - drm_crtc_init(dev, crtc, &vmw_screen_object_crtc_funcs); + ret = drm_crtc_init_with_planes(dev, crtc, &sou->base.primary, + &sou->base.cursor, + &vmw_screen_object_crtc_funcs, NULL); + if (ret) { + DRM_ERROR("Failed to initialize CRTC\n"); + goto err_free_unregister; + } drm_mode_crtc_set_gamma_size(crtc, 256); @@ -550,6 +609,16 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) sou->base.is_implicit); return 0; + +err_free_unregister: + drm_connector_unregister(connector); +err_free_encoder: + drm_encoder_cleanup(encoder); +err_free_connector: + drm_connector_cleanup(connector); +err_free: + kfree(sou); + return ret; } int vmw_kms_sou_init_display(struct vmw_private *dev_priv) |