[Intel-gfx] [PATCH 1/3] drm/intel: Store full 16 bits of colors passed to gamma LUT
Peter Clifton
pcjc2 at cam.ac.uk
Tue Apr 27 00:24:16 CEST 2010
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
More information about the Intel-gfx
mailing list