aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2010-10-13 15:09:43 -0400
committerDave Airlie <airlied@redhat.com>2010-10-19 00:13:26 -0400
commit99231028ff713820829b798d056c08a584281c25 (patch)
tree3fb4eb0c99c545c21c9d8e317ce34763248ec705 /drivers/gpu/drm
parent38ed0fcacd6176cdadd070df42c29f94c546aec5 (diff)
kdb, kms: Save and restore the LUT on atomic KMS enter/exit
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 Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 625a2d551d6a..8208e190faaa 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -242,6 +242,30 @@ static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
242 return 0; 242 return 0;
243} 243}
244 244
245static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_helper *helper)
246{
247 uint16_t *r_base, *g_base, *b_base;
248 int i;
249
250 r_base = crtc->gamma_store;
251 g_base = r_base + crtc->gamma_size;
252 b_base = g_base + crtc->gamma_size;
253
254 for (i = 0; i < crtc->gamma_size; i++)
255 helper->funcs->gamma_get(crtc, &r_base[i], &g_base[i], &b_base[i], i);
256}
257
258static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
259{
260 uint16_t *r_base, *g_base, *b_base;
261
262 r_base = crtc->gamma_store;
263 g_base = r_base + crtc->gamma_size;
264 b_base = g_base + crtc->gamma_size;
265
266 crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
267}
268
245int drm_fb_helper_debug_enter(struct fb_info *info) 269int drm_fb_helper_debug_enter(struct fb_info *info)
246{ 270{
247 struct drm_fb_helper *helper = info->par; 271 struct drm_fb_helper *helper = info->par;
@@ -260,6 +284,7 @@ int drm_fb_helper_debug_enter(struct fb_info *info)
260 continue; 284 continue;
261 285
262 funcs = mode_set->crtc->helper_private; 286 funcs = mode_set->crtc->helper_private;
287 drm_fb_helper_save_lut_atomic(mode_set->crtc, helper);
263 funcs->mode_set_base_atomic(mode_set->crtc, 288 funcs->mode_set_base_atomic(mode_set->crtc,
264 mode_set->fb, 289 mode_set->fb,
265 mode_set->x, 290 mode_set->x,
@@ -309,6 +334,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
309 continue; 334 continue;
310 } 335 }
311 336
337 drm_fb_helper_restore_lut_atomic(mode_set->crtc);
312 funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x, 338 funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
313 crtc->y, 0); 339 crtc->y, 0);
314 } 340 }