summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 276c7440b8b1..d547e8061f6a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -167,6 +167,7 @@ static int vmw_ldu_add_active(struct vmw_private *vmw_priv,
if (vfb != ld->fb) {
if (ld->fb && ld->fb->unpin)
ld->fb->unpin(ld->fb);
+ vmw_svga_enable(vmw_priv);
if (vfb->pin)
vfb->pin(vfb);
ld->fb = vfb;
@@ -190,6 +191,68 @@ static int vmw_ldu_add_active(struct vmw_private *vmw_priv,
return 0;
}
+/**
+ * vmw_ldu_crtc_mode_set_nofb - Enable svga
+ *
+ * @crtc: CRTC associated with the new screen
+ *
+ * For LDU, just enable the svga
+ */
+static void vmw_ldu_crtc_mode_set_nofb(struct drm_crtc *crtc)
+{
+}
+
+/**
+ * vmw_ldu_crtc_helper_prepare - Noop
+ *
+ * @crtc: CRTC associated with the new screen
+ *
+ * Prepares the CRTC for a mode set, but we don't need to do anything here.
+ *
+ */
+static void vmw_ldu_crtc_helper_prepare(struct drm_crtc *crtc)
+{
+}
+
+/**
+ * vmw_ldu_crtc_helper_commit - Noop
+ *
+ * @crtc: CRTC associated with the new screen
+ *
+ * This is called after a mode set has been completed. Here's
+ * usually a good place to call vmw_ldu_add_active/vmw_ldu_del_active
+ * but since for LDU the display plane is closely tied to the
+ * CRTC, it makes more sense to do those at plane update time.
+ */
+static void vmw_ldu_crtc_helper_commit(struct drm_crtc *crtc)
+{
+ struct vmw_private *dev_priv;
+ struct vmw_legacy_display_unit *ldu;
+ struct vmw_framebuffer *vfb;
+ struct drm_framebuffer *fb;
+
+
+ ldu = vmw_crtc_to_ldu(crtc);
+ dev_priv = vmw_priv(crtc->dev);
+ fb = crtc->primary->fb;
+
+ vfb = (fb) ? vmw_framebuffer_to_vfb(fb) : NULL;
+
+ if (vfb)
+ vmw_ldu_add_active(dev_priv, ldu, vfb);
+ else
+ vmw_ldu_del_active(dev_priv, ldu);
+}
+
+/**
+ * vmw_ldu_crtc_helper_disable - Turns off CRTC
+ *
+ * @crtc: CRTC to be turned off
+ */
+static void vmw_ldu_crtc_helper_disable(struct drm_crtc *crtc)
+{
+}
+
static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
{
struct vmw_private *dev_priv;
@@ -346,6 +409,20 @@ static const struct drm_plane_funcs vmw_ldu_cursor_funcs = {
.atomic_destroy_state = vmw_du_plane_destroy_state,
};
+/*
+ * Atomic Helpers
+ */
+static const struct drm_crtc_helper_funcs vmw_ldu_crtc_helper_funcs = {
+ .prepare = vmw_ldu_crtc_helper_prepare,
+ .commit = vmw_ldu_crtc_helper_commit,
+ .disable = vmw_ldu_crtc_helper_disable,
+ .mode_set = drm_helper_crtc_mode_set,
+ .mode_set_nofb = vmw_ldu_crtc_mode_set_nofb,
+ .atomic_check = vmw_du_crtc_atomic_check,
+ .atomic_begin = vmw_du_crtc_atomic_begin,
+ .atomic_flush = vmw_du_crtc_atomic_flush,
+};
+
static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
{
@@ -445,6 +522,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
goto err_free_unregister;
}
+ drm_crtc_helper_add(crtc, &vmw_ldu_crtc_helper_funcs);
+
drm_mode_crtc_set_gamma_size(crtc, 256);
drm_object_attach_property(&connector->base,
OpenPOWER on IntegriCloud