Intel-GFX Archive on lore.kernel.org
 help / color / Atom feed
From: Peter Clifton <pcjc2@cam.ac.uk>
To: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
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> (raw)
In-Reply-To: <1272320445.23864.4.camel@pcjc2lap>

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

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-24 16:25 8-bit vs. 10-bit palette mode, and LVDS dithering Peter Clifton
2010-04-26 14:29 ` Adam Jackson
2010-04-26 21:19   ` [PATCH] drm/intel: Set 8-bit gamma mode for the palette Peter Clifton
2010-04-27 13:53     ` Adam Jackson
2010-04-26 22:22   ` 8-bit vs. 10-bit palette mode, and LVDS dithering Peter Clifton
2010-04-26 22:24     ` Peter Clifton [this message]
2010-04-26 22:24     ` [PATCH 2/3] drm/intel: Attempt to use 10-bit gamma palette mode Peter Clifton
2010-04-27  1:09       ` Andrew Lutomirski
2010-04-27  6:44         ` Peter Clifton
2010-04-26 22:24     ` [PATCH 3/3] drm/intel: Use 10-bit palette properly, only store 129 entries Peter Clifton
2010-04-27 14:06       ` Adam Jackson

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=1272320658-2157-1-git-send-email-pcjc2@cam.ac.uk \
    --to=pcjc2@cam.ac.uk \
    --cc=intel-gfx@lists.freedesktop.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

Intel-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/intel-gfx/0 intel-gfx/git/0.git
	git clone --mirror https://lore.kernel.org/intel-gfx/1 intel-gfx/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 intel-gfx intel-gfx/ https://lore.kernel.org/intel-gfx \
		intel-gfx@lists.freedesktop.org
	public-inbox-index intel-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.intel-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git