All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: airlied@linux.ie
Cc: kgdb-bugreport@lists.sourceforge.net, jbarnes@virtuousgeek.org,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 4/5] radeon, kdb, kms: Save and restore the LUT on atomic KMS enter/exit
Date: Sun, 26 Sep 2010 06:47:26 -0500	[thread overview]
Message-ID: <1285501647-379-5-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1285501647-379-1-git-send-email-jason.wessel@windriver.com>

When changing VTs non-atomically the kernel works in conjunction with
the Xserver in user space and receives the LUT information from the
Xserver via a system call.  When changing modes atomically for kdb,
this information must be saved and restored without disturbing user
space as if nothing ever happened.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/radeon/radeon_display.c     |   32 +++++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |    5 ++++
 drivers/gpu/drm/radeon/radeon_mode.h        |    3 ++
 3 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 127a395..fb47c82 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -138,6 +138,38 @@ void radeon_crtc_load_lut(struct drm_crtc *crtc)
 		legacy_crtc_load_lut(crtc);
 }
 
+void radeon_crtc_save_lut(struct drm_crtc *crtc)
+{
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+	int i;
+
+	if (!crtc->enabled)
+		return;
+
+	for (i = 0; i < 256; i++) {
+		radeon_crtc->lut_r_copy[i] = radeon_crtc->lut_r[i];
+		radeon_crtc->lut_g_copy[i] = radeon_crtc->lut_g[i];
+		radeon_crtc->lut_b_copy[i] = radeon_crtc->lut_b[i];
+	}
+}
+
+void radeon_crtc_restore_lut(struct drm_crtc *crtc)
+{
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+	int i;
+
+	if (!crtc->enabled)
+		return;
+
+	for (i = 0; i < 256; i++) {
+		radeon_crtc->lut_r[i] = radeon_crtc->lut_r_copy[i];
+		radeon_crtc->lut_g[i] = radeon_crtc->lut_g_copy[i];
+		radeon_crtc->lut_b[i] = radeon_crtc->lut_b_copy[i];
+	}
+
+	radeon_crtc_load_lut(crtc);
+}
+
 /** Sets the color ramps on behalf of fbcon */
 void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
 			      u16 blue, int regno)
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 8752d34..4295478 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -355,6 +355,11 @@ int radeon_crtc_set_base_atomic(struct drm_crtc *crtc,
 				struct drm_framebuffer *fb,
 				int x, int y, int enter)
 {
+	if (enter)
+		radeon_crtc_save_lut(crtc);
+	else
+		radeon_crtc_restore_lut(crtc);
+
 	return radeon_crtc_do_set_base(crtc, fb, x, y, 1);
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index c4116d3..2f78615 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -267,6 +267,7 @@ struct radeon_crtc {
 	struct drm_crtc base;
 	int crtc_id;
 	u16 lut_r[256], lut_g[256], lut_b[256];
+	u16 lut_r_copy[256], lut_g_copy[256], lut_b_copy[256];
 	bool enabled;
 	bool can_tile;
 	uint32_t crtc_offset;
@@ -512,6 +513,8 @@ extern int atombios_get_encoder_mode(struct drm_encoder *encoder);
 extern void radeon_encoder_set_active_device(struct drm_encoder *encoder);
 
 extern void radeon_crtc_load_lut(struct drm_crtc *crtc);
+extern void radeon_crtc_save_lut(struct drm_crtc *crtc);
+extern void radeon_crtc_restore_lut(struct drm_crtc *crtc);
 extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
 				   struct drm_framebuffer *old_fb);
 extern int atombios_crtc_set_base_atomic(struct drm_crtc *crtc,
-- 
1.6.3.3


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

  parent reply	other threads:[~2010-09-26 11:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26 11:47 [PATCH 0/5] atomic kernel mode setting for radeon and nouveau Jason Wessel
2010-09-26 11:47 ` [PATCH 1/5] drm/radeon/kms: Implement KDB debug hooks for radeon KMS Jason Wessel
2010-09-26 11:47 ` [PATCH 2/5] drm/nouveau/kms: Implement KDB debug hooks for nouveau KMS Jason Wessel
2010-09-26 11:47 ` [PATCH 3/5] drm, kdb, kms: Add an enter argument to mode_set_base_atomic() API Jason Wessel
2010-09-26 11:47 ` Jason Wessel [this message]
2010-09-26 11:47 ` [PATCH 5/5] drm/nouveau/kms: Avoid a hang entering KDB with VT accel on Jason Wessel

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=1285501647-379-5-git-send-email-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    /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.