aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Manszewski <c.manszewski@samsung.com>2018-11-28 10:32:12 -0500
committerInki Dae <inki.dae@samsung.com>2018-12-05 03:35:21 -0500
commit13e810f199b48383523707aa69fb9673d688055a (patch)
treebd89011db6faa6e102536dd447390acadca678ab
parente9e5ba93cb1f61c16298aade49ec2537d497f0d6 (diff)
drm/exynos: mixer: Fix color range setting
Color format and color range was set based on resolution. Change that, by splitting range and format. Leave color format setting as it is, set color range based on drm_display_mode using drm_default_quant_range helper function. Tested on Odroid-U3 with Exynos 4412 CPU, kernel next-20181128 using modetest. Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c17
-rw-r--r--drivers/gpu/drm/exynos/regs-mixer.h9
2 files changed, 17 insertions, 9 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 9cdae10fd36d..0573eab0e190 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -380,14 +380,16 @@ static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height)
380 mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_SCAN_MASK); 380 mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_SCAN_MASK);
381} 381}
382 382
383static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) 383static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, struct drm_display_mode *mode)
384{ 384{
385 enum hdmi_quantization_range range = drm_default_rgb_quant_range(mode);
385 u32 val; 386 u32 val;
386 387
387 if (height < 720) { 388 if (mode->vdisplay < 720) {
388 val = MXR_CFG_RGB601_0_255; 389 val = MXR_CFG_RGB601;
389 } else { 390 } else {
390 val = MXR_CFG_RGB709_16_235; 391 val = MXR_CFG_RGB709;
392
391 /* Configure the BT.709 CSC matrix for full range RGB. */ 393 /* Configure the BT.709 CSC matrix for full range RGB. */
392 mixer_reg_write(ctx, MXR_CM_COEFF_Y, 394 mixer_reg_write(ctx, MXR_CM_COEFF_Y,
393 MXR_CSC_CT( 0.184, 0.614, 0.063) | 395 MXR_CSC_CT( 0.184, 0.614, 0.063) |
@@ -398,6 +400,11 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height)
398 MXR_CSC_CT( 0.440, -0.399, -0.040)); 400 MXR_CSC_CT( 0.440, -0.399, -0.040));
399 } 401 }
400 402
403 if (range == HDMI_QUANTIZATION_RANGE_FULL)
404 val |= MXR_CFG_QUANT_RANGE_FULL;
405 else
406 val |= MXR_CFG_QUANT_RANGE_LIMITED;
407
401 mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); 408 mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK);
402} 409}
403 410
@@ -454,7 +461,7 @@ static void mixer_commit(struct mixer_context *ctx)
454 struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; 461 struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode;
455 462
456 mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay); 463 mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay);
457 mixer_cfg_rgb_fmt(ctx, mode->vdisplay); 464 mixer_cfg_rgb_fmt(ctx, mode);
458 mixer_run(ctx); 465 mixer_run(ctx);
459} 466}
460 467
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h
index d2b8194a07bf..5ff095b0c1b3 100644
--- a/drivers/gpu/drm/exynos/regs-mixer.h
+++ b/drivers/gpu/drm/exynos/regs-mixer.h
@@ -85,10 +85,11 @@
85/* bits for MXR_CFG */ 85/* bits for MXR_CFG */
86#define MXR_CFG_LAYER_UPDATE (1 << 31) 86#define MXR_CFG_LAYER_UPDATE (1 << 31)
87#define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29) 87#define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29)
88#define MXR_CFG_RGB601_0_255 (0 << 9) 88#define MXR_CFG_QUANT_RANGE_FULL (0 << 9)
89#define MXR_CFG_RGB601_16_235 (1 << 9) 89#define MXR_CFG_QUANT_RANGE_LIMITED (1 << 9)
90#define MXR_CFG_RGB709_0_255 (2 << 9) 90#define MXR_CFG_RGB601 (0 << 10)
91#define MXR_CFG_RGB709_16_235 (3 << 9) 91#define MXR_CFG_RGB709 (1 << 10)
92
92#define MXR_CFG_RGB_FMT_MASK 0x600 93#define MXR_CFG_RGB_FMT_MASK 0x600
93#define MXR_CFG_OUT_YUV444 (0 << 8) 94#define MXR_CFG_OUT_YUV444 (0 << 8)
94#define MXR_CFG_OUT_RGB888 (1 << 8) 95#define MXR_CFG_OUT_RGB888 (1 << 8)