diff options
author | Sinclair Yeh <syeh@vmware.com> | 2017-03-23 22:18:32 +0100 |
---|---|---|
committer | Sinclair Yeh <syeh@vmware.com> | 2017-03-31 22:37:03 +0200 |
commit | 060e2ad57041b42ccecd0047ef4d893f200692c2 (patch) | |
tree | c81a5a4b61edb5017d0aa1b3c79f102c271f98e7 /drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |
parent | drm/vmwgfx: Add and connect CRTC helper functions (diff) | |
download | linux-060e2ad57041b42ccecd0047ef4d893f200692c2.tar.xz linux-060e2ad57041b42ccecd0047ef4d893f200692c2.zip |
drm/vmwgfx: Add and connect plane helper functions
Refactor previous FB and cursor plane update code into their
atomic counterparts: check, update, prepare, cleanup, and disable.
These helpers won't be called until we flip on the atomic support
flag or set drm_crtc_funcs->set_config to using the atomic
helper.
v2:
* Removed unnecessary pinning of cursor surface
* Added a few function headers
v3:
* Set clip region equal to the destination region
* Fixed surface pinning policy
* Enable SVGA mode in vmw_sou_primary_plane_prepare_fb
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_ldu.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index d547e8061f6a..1d734de1e6e1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c @@ -234,7 +234,7 @@ static void vmw_ldu_crtc_helper_commit(struct drm_crtc *crtc) ldu = vmw_crtc_to_ldu(crtc); dev_priv = vmw_priv(crtc->dev); - fb = crtc->primary->fb; + fb = crtc->primary->state->fb; vfb = (fb) ? vmw_framebuffer_to_vfb(fb) : NULL; @@ -242,6 +242,8 @@ static void vmw_ldu_crtc_helper_commit(struct drm_crtc *crtc) vmw_ldu_add_active(dev_priv, ldu, vfb); else vmw_ldu_del_active(dev_priv, ldu); + + vmw_ldu_commit_list(dev_priv); } /** @@ -391,6 +393,46 @@ static const struct drm_connector_funcs vmw_legacy_connector_funcs = { * Legacy Display Plane Functions */ +/** + * vmw_ldu_primary_plane_cleanup_fb - Unpin fb + * + * @plane: display plane + * @old_state: Contains the FB to clean up + * + * Unpins the display surface + * + * Returns 0 on success + */ +static void +vmw_ldu_primary_plane_cleanup_fb(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ +} + + +/** + * vmw_ldu_primary_plane_prepare_fb - + * + * @plane: display plane + * @new_state: info on the new plane state, including the FB + * + * Returns 0 on success + */ +static int +vmw_ldu_primary_plane_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + return 0; +} + + +static void +vmw_ldu_primary_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ +} + + static const struct drm_plane_funcs vmw_ldu_plane_funcs = { .update_plane = drm_primary_helper_update, .disable_plane = drm_primary_helper_disable, @@ -412,6 +454,22 @@ static const struct drm_plane_funcs vmw_ldu_cursor_funcs = { /* * Atomic Helpers */ +static const struct +drm_plane_helper_funcs vmw_ldu_cursor_plane_helper_funcs = { + .atomic_check = vmw_du_cursor_plane_atomic_check, + .atomic_update = vmw_du_cursor_plane_atomic_update, + .prepare_fb = vmw_du_cursor_plane_prepare_fb, + .cleanup_fb = vmw_du_plane_cleanup_fb, +}; + +static const struct +drm_plane_helper_funcs vmw_ldu_primary_plane_helper_funcs = { + .atomic_check = vmw_du_primary_plane_atomic_check, + .atomic_update = vmw_ldu_primary_plane_atomic_update, + .prepare_fb = vmw_ldu_primary_plane_prepare_fb, + .cleanup_fb = vmw_ldu_primary_plane_cleanup_fb, +}; + static const struct drm_crtc_helper_funcs vmw_ldu_crtc_helper_funcs = { .prepare = vmw_ldu_crtc_helper_prepare, .commit = vmw_ldu_crtc_helper_commit, @@ -471,6 +529,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) goto err_free; } + drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs); + /* Initialize cursor plane */ vmw_du_plane_reset(cursor); @@ -485,6 +545,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) goto err_free; } + drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs); + + + vmw_du_connector_reset(connector); ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); if (ret) { |