aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@infradead.org>2010-08-02 20:33:19 -0400
committerDave Airlie <airlied@redhat.com>2010-08-09 20:47:00 -0400
commit7203425a943eb3e189ba6b512827e0deb5f23872 (patch)
treee0fdc7ed583f6990bbffde67f4f45b1f11b5a39e /drivers/gpu
parent38fcbb674d7cc37b38473a89e8045ee80364e4f9 (diff)
drm: expand gamma_set
Expand the crtc_gamma_set function to accept a starting offset. The reason for this is to eventually use this function for setcolreg from drm_fb_helper.c. The fbdev colormap function can start at any offset in the color map. Signed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c9
-rw-r--r--drivers/gpu/drm/nouveau/nv04_crtc.c10
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c2
6 files changed, 15 insertions, 27 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index bdd0d903872..37e0b4fa482 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2541,7 +2541,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
2541 goto out; 2541 goto out;
2542 } 2542 }
2543 2543
2544 crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); 2544 crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
2545 2545
2546out: 2546out:
2547 mutex_unlock(&dev->mode_config.mutex); 2547 mutex_unlock(&dev->mode_config.mutex);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ec8336a4b7d..6bb5ffc76ce 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4330,15 +4330,12 @@ void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
4330} 4330}
4331 4331
4332static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 4332static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
4333 u16 *blue, uint32_t size) 4333 u16 *blue, uint32_t start, uint32_t size)
4334{ 4334{
4335 int end = (start + size > 256) ? 256 : start + size, i;
4335 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 4336 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4336 int i;
4337
4338 if (size != 256)
4339 return;
4340 4337
4341 for (i = 0; i < 256; i++) { 4338 for (i = start; i < end; i++) {
4342 intel_crtc->lut_r[i] = red[i] >> 8; 4339 intel_crtc->lut_r[i] = red[i] >> 8;
4343 intel_crtc->lut_g[i] = green[i] >> 8; 4340 intel_crtc->lut_g[i] = green[i] >> 8;
4344 intel_crtc->lut_b[i] = blue[i] >> 8; 4341 intel_crtc->lut_b[i] = blue[i] >> 8;
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index 96f46c421fa..497df8765f2 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -742,15 +742,13 @@ nv_crtc_gamma_load(struct drm_crtc *crtc)
742} 742}
743 743
744static void 744static void
745nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size) 745nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start,
746 uint32_t size)
746{ 747{
748 int end = (start + size > 256) ? 256 : start + size, i;
747 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 749 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
748 int i;
749
750 if (size != 256)
751 return;
752 750
753 for (i = 0; i < 256; i++) { 751 for (i = start; i < end; i++) {
754 nv_crtc->lut.r[i] = r[i]; 752 nv_crtc->lut.r[i] = r[i];
755 nv_crtc->lut.g[i] = g[i]; 753 nv_crtc->lut.g[i] = g[i];
756 nv_crtc->lut.b[i] = b[i]; 754 nv_crtc->lut.b[i] = b[i];
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index dbd9a63bc7f..bfd4ca2fe7e 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -398,15 +398,12 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
398 398
399static void 399static void
400nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 400nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
401 uint32_t size) 401 uint32_t start, uint32_t size)
402{ 402{
403 int end = (start + size > 256) ? 256 : start + size, i;
403 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 404 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
404 int i;
405
406 if (size != 256)
407 return;
408 405
409 for (i = 0; i < 256; i++) { 406 for (i = start; i < end; i++) {
410 nv_crtc->lut.r[i] = r[i]; 407 nv_crtc->lut.r[i] = r[i];
411 nv_crtc->lut.g[i] = g[i]; 408 nv_crtc->lut.g[i] = g[i];
412 nv_crtc->lut.b[i] = b[i]; 409 nv_crtc->lut.b[i] = b[i];
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 6130ec9ed50..5764f4d3b4f 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -161,17 +161,13 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
161} 161}
162 162
163static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 163static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
164 u16 *blue, uint32_t size) 164 u16 *blue, uint32_t start, uint32_t size)
165{ 165{
166 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 166 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
167 int i; 167 int end = (start + size > 256) ? 256 : start + size, i;
168
169 if (size != 256) {
170 return;
171 }
172 168
173 /* userspace palettes are always correct as is */ 169 /* userspace palettes are always correct as is */
174 for (i = 0; i < 256; i++) { 170 for (i = start; i < end; i++) {
175 radeon_crtc->lut_r[i] = red[i] >> 6; 171 radeon_crtc->lut_r[i] = red[i] >> 6;
176 radeon_crtc->lut_g[i] = green[i] >> 6; 172 radeon_crtc->lut_g[i] = green[i] >> 6;
177 radeon_crtc->lut_b[i] = blue[i] >> 6; 173 radeon_crtc->lut_b[i] = blue[i] >> 6;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index cfaf690a5b2..2ff5cf78235 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -79,7 +79,7 @@ static void vmw_ldu_crtc_restore(struct drm_crtc *crtc)
79 79
80static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc, 80static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc,
81 u16 *r, u16 *g, u16 *b, 81 u16 *r, u16 *g, u16 *b,
82 uint32_t size) 82 uint32_t start, uint32_t size)
83{ 83{
84} 84}
85 85