diff options
author | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2012-01-21 17:13:26 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-03-13 03:14:56 -0400 |
commit | df26bc9c320602539b1b5b3d85786e4c8de7bf43 (patch) | |
tree | a7f52151883a1c54a88e7549552effe65b8c0b35 /drivers/gpu/drm/nouveau/nv50_crtc.c | |
parent | 990449c77cafb77e7468722262c049675ab03e30 (diff) |
drm/nv50/display: expose color vibrance control
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_crtc.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 8f6c2ace3adf..701b927998bf 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -170,6 +170,41 @@ nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool update) | |||
170 | return ret; | 170 | return ret; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int | ||
174 | nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) | ||
175 | { | ||
176 | struct drm_device *dev = nv_crtc->base.dev; | ||
177 | struct nouveau_channel *evo = nv50_display(dev)->master; | ||
178 | int ret; | ||
179 | int adj; | ||
180 | u32 hue, vib; | ||
181 | |||
182 | NV_DEBUG_KMS(dev, "vibrance = %i, hue = %i\n", | ||
183 | nv_crtc->color_vibrance, nv_crtc->vibrant_hue); | ||
184 | |||
185 | ret = RING_SPACE(evo, 2 + (update ? 2 : 0)); | ||
186 | if (ret) { | ||
187 | NV_ERROR(dev, "no space while setting color vibrance\n"); | ||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | adj = (nv_crtc->color_vibrance > 0) ? 50 : 0; | ||
192 | vib = ((nv_crtc->color_vibrance * 2047 + adj) / 100) & 0xfff; | ||
193 | |||
194 | hue = ((nv_crtc->vibrant_hue * 2047) / 100) & 0xfff; | ||
195 | |||
196 | BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, COLOR_CTRL), 1); | ||
197 | OUT_RING (evo, (hue << 20) | (vib << 8)); | ||
198 | |||
199 | if (update) { | ||
200 | BEGIN_RING(evo, 0, NV50_EVO_UPDATE, 1); | ||
201 | OUT_RING (evo, 0); | ||
202 | FIRE_RING (evo); | ||
203 | } | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
173 | struct nouveau_connector * | 208 | struct nouveau_connector * |
174 | nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) | 209 | nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) |
175 | { | 210 | { |
@@ -577,8 +612,6 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
577 | OUT_RING (evo, fb->base.depth == 8 ? | 612 | OUT_RING (evo, fb->base.depth == 8 ? |
578 | NV50_EVO_CRTC_CLUT_MODE_OFF : NV50_EVO_CRTC_CLUT_MODE_ON); | 613 | NV50_EVO_CRTC_CLUT_MODE_OFF : NV50_EVO_CRTC_CLUT_MODE_ON); |
579 | 614 | ||
580 | BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, COLOR_CTRL), 1); | ||
581 | OUT_RING (evo, NV50_EVO_CRTC_COLOR_CTRL_COLOR); | ||
582 | BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, FB_POS), 1); | 615 | BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, FB_POS), 1); |
583 | OUT_RING (evo, (y << 16) | x); | 616 | OUT_RING (evo, (y << 16) | x); |
584 | 617 | ||
@@ -661,6 +694,7 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode, | |||
661 | 694 | ||
662 | nv_crtc->set_dither(nv_crtc, false); | 695 | nv_crtc->set_dither(nv_crtc, false); |
663 | nv_crtc->set_scale(nv_crtc, false); | 696 | nv_crtc->set_scale(nv_crtc, false); |
697 | nv_crtc->set_color_vibrance(nv_crtc, false); | ||
664 | 698 | ||
665 | return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false); | 699 | return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false); |
666 | } | 700 | } |
@@ -721,6 +755,9 @@ nv50_crtc_create(struct drm_device *dev, int index) | |||
721 | if (!nv_crtc) | 755 | if (!nv_crtc) |
722 | return -ENOMEM; | 756 | return -ENOMEM; |
723 | 757 | ||
758 | nv_crtc->color_vibrance = 50; | ||
759 | nv_crtc->vibrant_hue = 0; | ||
760 | |||
724 | /* Default CLUT parameters, will be activated on the hw upon | 761 | /* Default CLUT parameters, will be activated on the hw upon |
725 | * first mode set. | 762 | * first mode set. |
726 | */ | 763 | */ |
@@ -751,6 +788,7 @@ nv50_crtc_create(struct drm_device *dev, int index) | |||
751 | /* set function pointers */ | 788 | /* set function pointers */ |
752 | nv_crtc->set_dither = nv50_crtc_set_dither; | 789 | nv_crtc->set_dither = nv50_crtc_set_dither; |
753 | nv_crtc->set_scale = nv50_crtc_set_scale; | 790 | nv_crtc->set_scale = nv50_crtc_set_scale; |
791 | nv_crtc->set_color_vibrance = nv50_crtc_set_color_vibrance; | ||
754 | 792 | ||
755 | drm_crtc_init(dev, &nv_crtc->base, &nv50_crtc_funcs); | 793 | drm_crtc_init(dev, &nv_crtc->base, &nv50_crtc_funcs); |
756 | drm_crtc_helper_add(&nv_crtc->base, &nv50_crtc_helper_funcs); | 794 | drm_crtc_helper_add(&nv_crtc->base, &nv50_crtc_helper_funcs); |