From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Clifton Subject: [PATCH 1/3] drm/intel: Store full 16 bits of colors passed to gamma LUT Date: Mon, 26 Apr 2010 23:24:16 +0100 Message-ID: <1272320658-2157-1-git-send-email-pcjc2@cam.ac.uk> References: <1272320445.23864.4.camel@pcjc2lap> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from ppsw-32.csi.cam.ac.uk (ppsw-32.csi.cam.ac.uk [131.111.8.132]) by gabe.freedesktop.org (Postfix) with ESMTP id 764879E75E for ; Mon, 26 Apr 2010 15:24:28 -0700 (PDT) In-Reply-To: <1272320445.23864.4.camel@pcjc2lap> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org Store the full precision, even if we only use the high byte when programming the palette registers. --- drivers/gpu/drm/i915/intel_display.c | 30 +++++++++++++++--------------- drivers/gpu/drm/i915/intel_drv.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 006e5a5..456f738 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3452,9 +3452,9 @@ void intel_crtc_load_lut(struct drm_crtc *crtc) for (i = 0; i < 256; i++) { I915_WRITE(pal_reg + 4 * i, - (intel_crtc->lut_r[i] << 16) | - (intel_crtc->lut_g[i] << 8) | - intel_crtc->lut_b[i]); + ((intel_crtc->lut_r[i] >> 8) << 16) | + ((intel_crtc->lut_g[i] >> 8) << 8) | + (intel_crtc->lut_b[i] >> 8)); } } @@ -3609,9 +3609,9 @@ void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, { struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - intel_crtc->lut_r[regno] = red >> 8; - intel_crtc->lut_g[regno] = green >> 8; - intel_crtc->lut_b[regno] = blue >> 8; + intel_crtc->lut_r[regno] = red; + intel_crtc->lut_g[regno] = green; + intel_crtc->lut_b[regno] = blue; } void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, @@ -3619,9 +3619,9 @@ void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, { struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - *red = intel_crtc->lut_r[regno] << 8; - *green = intel_crtc->lut_g[regno] << 8; - *blue = intel_crtc->lut_b[regno] << 8; + *red = intel_crtc->lut_r[regno]; + *green = intel_crtc->lut_g[regno]; + *blue = intel_crtc->lut_b[regno]; } static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, @@ -3634,9 +3634,9 @@ static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, return; for (i = 0; i < 256; i++) { - intel_crtc->lut_r[i] = red[i] >> 8; - intel_crtc->lut_g[i] = green[i] >> 8; - intel_crtc->lut_b[i] = blue[i] >> 8; + intel_crtc->lut_r[i] = red[i]; + intel_crtc->lut_g[i] = green[i]; + intel_crtc->lut_b[i] = blue[i]; } intel_crtc_load_lut(crtc); @@ -4294,9 +4294,9 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) intel_crtc->pipe = pipe; intel_crtc->plane = pipe; for (i = 0; i < 256; i++) { - intel_crtc->lut_r[i] = i; - intel_crtc->lut_g[i] = i; - intel_crtc->lut_b[i] = i; + intel_crtc->lut_r[i] = i << 8 | i; + intel_crtc->lut_g[i] = i << 8 | i; + intel_crtc->lut_b[i] = i << 8 | i; } /* Swap pipes & planes for FBC on pre-965 */ diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3dcf5cc..6f09806 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -143,7 +143,7 @@ struct intel_crtc { enum plane plane; struct drm_gem_object *cursor_bo; uint32_t cursor_addr; - u8 lut_r[256], lut_g[256], lut_b[256]; + u16 lut_r[256], lut_g[256], lut_b[256]; int dpms_mode; bool busy; /* is scanout buffer being updated frequently? */ struct timer_list idle_timer; -- 1.7.0.4