Intel-GFX Archive on lore.kernel.org
 help / color / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Check for a change in fb size, and reconfigure the pipe
Date: Tue, 13 Nov 2012 12:15:10 +0000
Message-ID: <1352808910-31946-1-git-send-email-chris@chris-wilson.co.uk> (raw)

In the slightly unusual case where the pipe is programmed to the same
modeline, but the framebuffer is a new size, we need to resetup the
panel fitter as appropriate and this requires a full modeset. This can
only occur currently as part of the BIOS takeover where there are
slightly different semantics governing how the panel fitter and
framebuffer is programmed relative to the modeline.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f3bec25..de00421 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8114,16 +8114,27 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 	/* We should be able to check here if the fb has the same properties
 	 * and then just flip_or_move it */
 	if (set->crtc->fb != set->fb) {
+		const struct drm_framebuffer *old = set->crtc->fb;
+		const struct drm_framebuffer *new = set->fb;
+
 		/* If we have no fb then treat it as a full mode set */
-		if (set->crtc->fb == NULL) {
+		if (old == NULL) {
 			DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
 			config->mode_changed = true;
-		} else if (set->fb == NULL) {
+		} else if (new == NULL) {
 			config->mode_changed = true;
-		} else if (set->fb->depth != set->crtc->fb->depth) {
+		/* check for a change in fb size, need to adjust fitting */
+		} else if (new->width != old->width ||
+			   new->height != old->height) {
+			DRM_DEBUG_KMS("fb is changing size (%d, %d) -> (%d, %d), full mode set\n",
+				      old->width, old->height, new->width, new->height);
 			config->mode_changed = true;
-		} else if (set->fb->bits_per_pixel !=
-			   set->crtc->fb->bits_per_pixel) {
+		/* check for a change in fb format, need to reprogram the pipe */
+		} else if (new->depth != old->depth ||
+			   new->bits_per_pixel != old->bits_per_pixel) {
+			DRM_DEBUG_KMS("fb is changing format (%d/%d) -> (%d/%d), full mode set\n",
+				      old->depth, old->bits_per_pixel,
+				      new->depth, new->bits_per_pixel);
 			config->mode_changed = true;
 		} else
 			config->fb_changed = true;
-- 
1.7.10.4

             reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 12:15 Chris Wilson [this message]
2012-11-13 12:42 ` Ville Syrjälä
2012-11-13 12:48   ` Chris Wilson
2012-11-13 13:15     ` Ville Syrjälä
2012-11-13 13:33       ` Chris Wilson
2012-11-13 13:59         ` Ville Syrjälä

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=1352808910-31946-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@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

Intel-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/intel-gfx/0 intel-gfx/git/0.git
	git clone --mirror https://lore.kernel.org/intel-gfx/1 intel-gfx/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 intel-gfx intel-gfx/ https://lore.kernel.org/intel-gfx \
		intel-gfx@lists.freedesktop.org
	public-inbox-index intel-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.intel-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git