summaryrefslogtreecommitdiff
path: root/vmwgfx_ldu.c
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2016-12-30 13:59:17 -0800
committerSinclair Yeh <syeh@vmware.com>2017-02-23 12:55:02 -0800
commita32ae41afbff9c566057405dc860b9ec48e47e93 (patch)
tree5e2c13e65913e2b2c396c5946a5c30c6765476fd /vmwgfx_ldu.c
parent9e950224a7e3ae935dd6886bd184bafb9da5eb99 (diff)
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 Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'vmwgfx_ldu.c')
-rw-r--r--vmwgfx_ldu.c66
1 files changed, 65 insertions, 1 deletions
diff --git a/vmwgfx_ldu.c b/vmwgfx_ldu.c
index 145a002..3d2d1ae 100644
--- a/vmwgfx_ldu.c
+++ b/vmwgfx_ldu.c
@@ -260,7 +260,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;
@@ -268,6 +268,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);
}
/**
@@ -429,6 +431,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,
+ const 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,
+ const 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,
@@ -450,6 +492,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,
@@ -509,6 +567,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);
@@ -523,6 +583,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) {