All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: airlied@linux.ie
Cc: jbarnes@virtuousgeek.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH 4/5] kdb,kms: Save and restore the LUT on atomic KMS enter/exit
Date: Tue, 12 Oct 2010 07:50:00 -0500	[thread overview]
Message-ID: <1286887801-8179-5-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1286887801-8179-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.

There is a short cut used by this patch where gamma_store is used as
the save space.  If this turns out to be a problem in the future a
pre-allocated chunk of memory will be required for each crtc to save
and restore the LUT information.

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/drm_fb_helper.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 625a2d5..bec6b8c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -242,6 +242,34 @@ static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
 	return 0;
 }
 
+static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_helper *helper)
+{
+	int size;
+	uint16_t *r_base, *g_base, *b_base;
+	int i;
+
+	size = crtc->gamma_size * (sizeof(uint16_t));
+	r_base = crtc->gamma_store;
+	g_base = r_base + size;
+	b_base = g_base + size;
+
+	for (i = 0; i < size; i++)
+		helper->funcs->gamma_get(crtc, &r_base[i], &g_base[i], &b_base[i], i);
+}
+
+static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
+{
+	int size;
+	uint16_t *r_base, *g_base, *b_base;
+
+	size = crtc->gamma_size * (sizeof(uint16_t));
+	r_base = crtc->gamma_store;
+	g_base = r_base + size;
+	b_base = g_base + size;
+
+	crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, size);
+}
+
 int drm_fb_helper_debug_enter(struct fb_info *info)
 {
 	struct drm_fb_helper *helper = info->par;
@@ -260,12 +288,13 @@ int drm_fb_helper_debug_enter(struct fb_info *info)
 				continue;
 
 			funcs =	mode_set->crtc->helper_private;
+
+			drm_fb_helper_save_lut_atomic(mode_set->crtc, helper);
 			funcs->mode_set_base_atomic(mode_set->crtc,
 						    mode_set->fb,
 						    mode_set->x,
 						    mode_set->y,
 						    1);
-
 		}
 	}
 
@@ -309,6 +338,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
 			continue;
 		}
 
+		drm_fb_helper_restore_lut_atomic(mode_set->crtc);
 		funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
 					    crtc->y, 0);
 	}
-- 
1.6.3.3


  parent reply	other threads:[~2010-10-12 12:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 12:49 [PATCH 0/5] V2 - atomic kernel mode setting for radeon, nouveau, plus fixes Jason Wessel
2010-10-12 12:49 ` [PATCH 1/5] drm/radeon/kms: Implement KDB debug hooks for radeon KMS Jason Wessel
2010-10-12 12:49 ` [PATCH 2/5] drm/nouveau/kms: Implement KDB debug hooks for nouveau KMS Jason Wessel
2010-10-12 12:49 ` [PATCH 3/5] drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API Jason Wessel
2010-10-12 15:38   ` Jesse Barnes
2010-10-12 15:46     ` Jason Wessel
2010-10-12 15:56       ` Jesse Barnes
2010-10-12 15:56         ` Jesse Barnes
2010-10-12 12:50 ` Jason Wessel [this message]
2010-10-12 12:50 ` [PATCH 5/5] drm/nouveau/kms: Avoid a hang entering KDB with VT accel on Jason Wessel
2010-10-12 18:15 [PATCH 0/5] V3 - atomic kernel mode setting for radeon, nouveau, plus fixes Jason Wessel
2010-10-12 18:15 ` [PATCH 4/5] kdb,kms: Save and restore the LUT on atomic KMS enter/exit Jason Wessel
2010-10-12 18:15   ` [PATCH 4/5] kdb, kms: " 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=1286887801-8179-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=linux-kernel@vger.kernel.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.