summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-07-11 19:04:26 +0200
committerMichel Dänzer <michel@daenzer.net>2018-07-12 18:09:53 +0200
commit4b3e5f81c6032003237bb05c3ab96423c39524fc (patch)
tree38a464aa18dd7a058d666d01ab3db1e8f69f4867
parent16ddc109660dbe813c457765eda66422fb745a3e (diff)
Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
Instead of from drmmode_set_mode_major. There's no need to re-set the gamma LUT on every modeset, the kernel should preserve it. (Ported from amdgpu commit baea4fa492f635cdfe746a84be2e337d9aeae8a9) Acked-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/drmmode_display.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e301c0e6..03c850f8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -887,9 +887,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
else
drmmode_crtc->scanout_id = 0;
- drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
-
if (drmmode_crtc->prime_scanout_pixmap) {
drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
&fb, &x, &y);
@@ -2854,6 +2851,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
if (xf86_config->num_crtc) {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -2862,13 +2860,23 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
return FALSE;
/* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */
- if (pScrn->depth != 30 &&
- !xf86HandleColormaps(pScreen, 256, 10,
- NULL, NULL,
- CMAP_PALETTED_TRUECOLOR
- | CMAP_RELOAD_ON_MODE_SWITCH))
- return FALSE;
+ if (pScrn->depth != 30) {
+ if (!xf86HandleColormaps(pScreen, 256, 10, NULL, NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH))
+ return FALSE;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+ drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red,
+ crtc->gamma_green,
+ crtc->gamma_blue,
+ crtc->gamma_size);
+ }
+ }
}
+
return TRUE;
}