All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Subject: [PATCH 07/14] drm: qxl: Atomic phase 1: Implement mode_set_nofb
Date: Wed, 15 Feb 2017 19:40:00 -0200	[thread overview]
Message-ID: <20170215214007.10004-8-krisman@collabora.co.uk> (raw)
In-Reply-To: <20170215214007.10004-1-krisman@collabora.co.uk>

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
---
 drivers/gpu/drm/qxl/qxl_display.c | 88 +++++++--------------------------------
 1 file changed, 16 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 8ccf62ae0efd..b23979fad1e2 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -462,77 +462,6 @@ static void qxl_monitors_config_set(struct qxl_device *qdev,
 
 }
 
-static int qxl_crtc_mode_set(struct drm_crtc *crtc,
-			       struct drm_display_mode *mode,
-			       struct drm_display_mode *adjusted_mode,
-			       int x, int y,
-			       struct drm_framebuffer *old_fb)
-{
-	struct drm_device *dev = crtc->dev;
-	struct qxl_device *qdev = dev->dev_private;
-	struct qxl_framebuffer *qfb;
-	struct qxl_bo *bo, *old_bo = NULL;
-	struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
-	bool recreate_primary = false;
-	int ret;
-	int surf_id;
-	if (!crtc->primary->fb) {
-		DRM_DEBUG_KMS("No FB bound\n");
-		return 0;
-	}
-
-	if (old_fb) {
-		qfb = to_qxl_framebuffer(old_fb);
-		old_bo = gem_to_qxl_bo(qfb->obj);
-	}
-	qfb = to_qxl_framebuffer(crtc->primary->fb);
-	bo = gem_to_qxl_bo(qfb->obj);
-	DRM_DEBUG("+%d+%d (%d,%d) => (%d,%d)\n",
-		  x, y,
-		  mode->hdisplay, mode->vdisplay,
-		  adjusted_mode->hdisplay,
-		  adjusted_mode->vdisplay);
-
-	if (bo->is_primary == false)
-		recreate_primary = true;
-
-	if (bo->surf.stride * bo->surf.height > qdev->vram_size) {
-		DRM_ERROR("Mode doesn't fit in vram size (vgamem)");
-		return -EINVAL;
-        }
-
-	ret = qxl_bo_pin(bo, bo->type, NULL);
-	if (ret != 0)
-		return -EINVAL;
-
-	if (recreate_primary) {
-		qxl_io_destroy_primary(qdev);
-		qxl_io_log(qdev,
-			   "recreate primary: %dx%d,%d,%d\n",
-			   bo->surf.width, bo->surf.height,
-			   bo->surf.stride, bo->surf.format);
-		qxl_io_create_primary(qdev, 0, bo);
-		bo->is_primary = true;
-	}
-
-	if (bo->is_primary) {
-		DRM_DEBUG_KMS("setting surface_id to 0 for primary surface %d on crtc %d\n", bo->surface_id, qcrtc->index);
-		surf_id = 0;
-	} else {
-		surf_id = bo->surface_id;
-	}
-
-	if (old_bo && old_bo != bo) {
-		old_bo->is_primary = false;
-		qxl_bo_unpin(old_bo);
-	}
-
-	qxl_monitors_config_set(qdev, qcrtc->index, x, y,
-				mode->hdisplay,
-				mode->vdisplay, surf_id);
-	return 0;
-}
-
 static void qxl_crtc_prepare(struct drm_crtc *crtc)
 {
 	DRM_DEBUG("current: %dx%d+%d+%d (%d).\n",
@@ -540,6 +469,20 @@ static void qxl_crtc_prepare(struct drm_crtc *crtc)
 		  crtc->x, crtc->y, crtc->enabled);
 }
 
+void qxl_mode_set_nofb(struct drm_crtc *crtc)
+{
+	struct qxl_device *qdev = crtc->dev->dev_private;
+	struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
+	struct drm_display_mode *mode = &crtc->mode;
+
+	DRM_DEBUG("Mode set (%d,%d)\n",
+		  mode->hdisplay, mode->vdisplay);
+
+	qxl_monitors_config_set(qdev, qcrtc->index, 0, 0,
+				mode->hdisplay,	mode->vdisplay, 0);
+
+}
+
 static void qxl_crtc_commit(struct drm_crtc *crtc)
 {
 	DRM_DEBUG("\n");
@@ -567,7 +510,8 @@ static const struct drm_crtc_helper_funcs qxl_crtc_helper_funcs = {
 	.dpms = qxl_crtc_dpms,
 	.disable = qxl_crtc_disable,
 	.mode_fixup = qxl_crtc_mode_fixup,
-	.mode_set = qxl_crtc_mode_set,
+	.mode_set = drm_helper_crtc_mode_set,
+	.mode_set_nofb = qxl_mode_set_nofb,
 	.prepare = qxl_crtc_prepare,
 	.commit = qxl_crtc_commit,
 	.atomic_flush = qxl_crtc_atomic_flush,
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-02-15 21:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 21:39 [PATCH 00/14] qxl atomic modesetting Gabriel Krisman Bertazi
2017-02-15 21:39 ` [PATCH 01/14] drm: qxl: Drop device flags attribute Gabriel Krisman Bertazi
2017-02-17 19:46   ` Gustavo Padovan
2017-02-15 21:39 ` [PATCH 02/14] drm: qxl: Consolidate bo reservation when pinning Gabriel Krisman Bertazi
2017-02-17 19:58   ` Gustavo Padovan
2017-02-15 21:39 ` [PATCH 03/14] drm: qxl: Don't initialize vblank support Gabriel Krisman Bertazi
2017-02-15 21:39 ` [PATCH 04/14] drm: qxl: Expose creation of universal primary plane Gabriel Krisman Bertazi
2017-02-15 21:39 ` [PATCH 05/14] drm: qxl: Atomic phase 1: convert cursor to universal plane Gabriel Krisman Bertazi
2017-02-15 21:39 ` [PATCH 06/14] drm: qxl: Atomic phase 1: Use drm_plane_helpers for primary plane Gabriel Krisman Bertazi
2017-02-15 21:40 ` Gabriel Krisman Bertazi [this message]
2017-02-15 21:40 ` [PATCH 08/14] drm: qxl: Atomic phase 1: Don't unpin primary when disabling crtc Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 09/14] drm: qxl: Atomic phase 2: Wire up state object handlers Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 10/14] drm: qxl: Atomic phase 2: Use drm_atomic_set_fb_for_plane helper Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 11/14] drm: qxl: Atomic phase 3: Use atomic handlers for planes Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 12/14] drm: qxl: Atomic phase 3: Wire up atomic set_config helper Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 13/14] drm: qxl: Atomic phase 3: Wire up atomic page_flip helper Gabriel Krisman Bertazi
2017-02-15 21:40 ` [PATCH 14/14] drm: qxl: Enable atomic modesetting ioctl Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170215214007.10004-8-krisman@collabora.co.uk \
    --to=krisman@collabora.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.