From patchwork Tue Oct 12 18:15:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wessel X-Patchwork-Id: 248741 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 o9CIGU9i003819 for ; Tue, 12 Oct 2010 18:16:52 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6535D9ECFB for ; Tue, 12 Oct 2010 11:16:29 -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 CEFFA9E844 for ; Tue, 12 Oct 2010 11:16:16 -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 o9CIGD3Z012305; Tue, 12 Oct 2010 11:16:13 -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); Tue, 12 Oct 2010 11:16:12 -0700 Received: from localhost.localdomain ([172.25.32.37]) by ala-mail06.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 12 Oct 2010 11:16:12 -0700 From: Jason Wessel To: airlied@linux.ie Subject: [PATCH 4/5] kdb, kms: Save and restore the LUT on atomic KMS enter/exit Date: Tue, 12 Oct 2010 13:15:47 -0500 Message-Id: <1286907348-25817-5-git-send-email-jason.wessel@windriver.com> X-Mailer: git-send-email 1.6.4.rc1 In-Reply-To: <1286907348-25817-1-git-send-email-jason.wessel@windriver.com> References: <1286907348-25817-1-git-send-email-jason.wessel@windriver.com> X-OriginalArrivalTime: 12 Oct 2010 18:16:12.0829 (UTC) FILETIME=[8D683CD0:01CB6A39] Cc: Jason Wessel , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.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]); Tue, 12 Oct 2010 18:16:52 +0000 (UTC) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 74bac82..5c8fbfa 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 < crtc->gamma_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,6 +288,8 @@ 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, @@ -309,6 +339,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, LEAVE_ATOMIC_MODE_SET); }