From patchwork Sun Sep 26 11:47:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wessel X-Patchwork-Id: 211012 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8R6XBmv030405 for ; Mon, 27 Sep 2010 06:33:34 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24F679ED74 for ; Sun, 26 Sep 2010 23:33:11 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by gabe.freedesktop.org (Postfix) with ESMTP id 934F89E827 for ; Sun, 26 Sep 2010 08:13:56 -0700 (PDT) Received: from ALA-MAIL03.corp.ad.wrs.com (ala-mail03 [147.11.57.144]) by mail.windriver.com (8.14.3/8.14.3) with ESMTP id o8QBla9U000964; Sun, 26 Sep 2010 04:47:36 -0700 (PDT) Received: from ala-mail06.corp.ad.wrs.com ([147.11.57.147]) by ALA-MAIL03.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 26 Sep 2010 04:47:36 -0700 Received: from localhost.localdomain ([172.25.32.37]) by ala-mail06.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 26 Sep 2010 04:47:36 -0700 From: Jason Wessel To: airlied@linux.ie 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 Message-Id: <1285501647-379-5-git-send-email-jason.wessel@windriver.com> X-Mailer: git-send-email 1.6.4.rc1 In-Reply-To: <1285501647-379-1-git-send-email-jason.wessel@windriver.com> References: <1285501647-379-1-git-send-email-jason.wessel@windriver.com> X-OriginalArrivalTime: 26 Sep 2010 11:47:36.0643 (UTC) FILETIME=[9D449930:01CB5D70] X-Mailman-Approved-At: Sun, 26 Sep 2010 23:30:54 -0700 Cc: kgdb-bugreport@lists.sourceforge.net, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Sep 2010 06:33:34 +0000 (UTC) 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,