Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1299827imu; Wed, 28 Nov 2018 07:35:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/VPN4qizBF2dv5Pm+1LFDxa+YfWG5Ln6jf/ZzkzG2IE5RLNechRd5t4RYnfiXkKkaI2FW9R X-Received: by 2002:a62:644:: with SMTP id 65mr7078310pfg.161.1543419326720; Wed, 28 Nov 2018 07:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543419326; cv=none; d=google.com; s=arc-20160816; b=UqDJqeMv5bDPUWO8tjjA7wb5hFCz4/C+Ku+PgttdUfMTBVPSJC7O8oF1XGxJTQMY04 Y/p1VFPy5uvt0kXfSoV33/APYMcXnZwfw6fG9O1Bt2BSY7/bJVZ0Oc8FC+OxuDCs8kyp ZD5LcOFth66G7yxL7wrU0v4sJ7Z82uCm3Qvd1Wu/0RuLnq3OA9p86iBGmNG0CPpNELX+ 9f4tblmI5RvYPaRkKX6APwZGoJOK4xRQwGYohP7pXnvD3rPAbR6WCf3LQrcUi4qO5vx3 HHSY+Iob+OxcYupFZZ7aCLAZsqUcgWSiWywrbaS9Hd+YfoOqKl7gYAZ/YdOj7e9fk5mq +Yzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=Q4EAez3dyLdQL7NYvZFnS+Fz4/vQPkRhOPuIOX/yhKg=; b=NSmJs4q6bF+nC7lsfvuNElIO6NlEZrXLtJ6gd4UAFMnc48VjFn/fAfCDJl8cIF55bO txMLztPJB/RElbGdE3VHFfcR5hCrAAU6ofWfMjAPNJnYqnP6AotJJN2M8JzqYUqDUBYK v1rGqA9f7DSzaninBlzZ96OOs6RNRAJYFb4R/N4d8AhFZDxtuoRHnFFLHJBtqsJ9Y8iO G2FDeYC98NZcV5FwUFRHe6lPiripb6sDo7gqXVK4Egf2adUxBLiPZizO3Ba50vuJyHol ov3YQffpQD+7tBFa8rdRPbRpecD74t9BOAf6NqIjCBpR0c3fy8e+SZXbYwbseVu6cQC/ yqOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kdZFs2wL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si7520779plq.287.2018.11.28.07.35.03; Wed, 28 Nov 2018 07:35:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kdZFs2wL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbeK2Cem (ORCPT + 99 others); Wed, 28 Nov 2018 21:34:42 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39507 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728857AbeK2Cek (ORCPT ); Wed, 28 Nov 2018 21:34:40 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181128153236euoutp01e8207fbec633f349f03b74c7d16a7a24~rU4u6iiqZ2791927919euoutp01W for ; Wed, 28 Nov 2018 15:32:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181128153236euoutp01e8207fbec633f349f03b74c7d16a7a24~rU4u6iiqZ2791927919euoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543419156; bh=Q4EAez3dyLdQL7NYvZFnS+Fz4/vQPkRhOPuIOX/yhKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdZFs2wLmgvKLbNhPyCGspFtbJwsNmmkO3N/1BLHXCaCNWRdj5Nal2XWGc9pdYqM+ e0PapDaaqhAW2/hDvSE56ku6EXgFm9v5ZTbFlPRAOcP9y87+DaI3bUGZn6Ie9LvVz8 RRy4rekSlLiqNxUjJDpgAm+DBtweWh8ni/JcLXUo= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181128153236eucas1p11723aad7e1fbe51a680f257e18245b85~rU4uJAs1s2300023000eucas1p1v; Wed, 28 Nov 2018 15:32:36 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E4.A7.04441.315BEFB5; Wed, 28 Nov 2018 15:32:35 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181128153235eucas1p192a346be6aa9ca28a1000238db4c6fc8~rU4tXprlt2300523005eucas1p1m; Wed, 28 Nov 2018 15:32:35 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181128153234eusmtrp1e1ad245354ee7224408a12f537016f23~rU4tHQ--f0810708107eusmtrp1k; Wed, 28 Nov 2018 15:32:34 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-4e-5bfeb51391ba Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2A.10.04284.215BEFB5; Wed, 28 Nov 2018 15:32:34 +0000 (GMT) Received: from AMDC2034.DIGITAL.local (unknown [106.120.51.41]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181128153234eusmtip2e4d581bebb879a30b8e8cf7c1c3e9a02~rU4sdt2cB2100421004eusmtip2v; Wed, 28 Nov 2018 15:32:34 +0000 (GMT) From: Christoph Manszewski To: dri-devel@lists.freedesktop.org Cc: Christoph Manszewski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marek Szyprowski , Andrzej Hajda Subject: [PATCH 2/2] drm/exynos: mixer: Fix color range setting Date: Wed, 28 Nov 2018 16:32:12 +0100 Message-Id: <1543419132-16099-3-git-send-email-c.manszewski@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543419132-16099-1-git-send-email-c.manszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0hTYRjG+3YuOw5Xx03Yh4bCTKnMWyacqCzB4gQhQVKQYC09qeSmbWpp UJqZad4vuGxFF5djmtM5LQwFxZQlOsprxprkH3lJMp2SRTOPZ9Z/7/t7n+d7Xl4+AhHpMA8i SZHGKBWyZCkuQNv71iwB4jZHTHDVyj5qsmkIo4qHzDyqRW3AqP43WkCNrHzHqQpbGUrNfH6P UqXT8whlsTTzqcHb3/iUcXoMo4Y7NDiltnTxqJe9Vj6lrpzFj+2gjfoCnH61OoXRtvv9PLq1 7hZdYtIDetnodRo/LzgczyQnZTDKoPCLgsTZqiYkdURy/XH7b342WBQXAhcCkgdgdY4ZKwQC QkTqANS0jvK5xg5g/dCks1kGcD1Hh29ZrGY7wtYish7Adwsn/jlWp20YO8DJMPjJurRpcCd9 4J9yPWBFCNmGwk7zBI8diMmjsLf30YaIIFDSF77VxLNYSNLw+egy4MK84Mehgs0wF/IkLC+z IOw7kDTy4fqsnc+JIqHhRbHTIIZz/SYn3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t9QOKMSbklhZlVqUH19UmpNafIjRFOimicxSosn5wEjNK4k3NDU0t7A0NDc2NzazUBLn PW9QGSUkkJ5YkpqdmlqQWgTTx8TBKdXAaHxclfVae2D4Yt8vS+eWr+26L/GkbNaaM7ttc9PM F74VFv4lkS2hcEXGS68k4NGNDZ+FucRmsmQUlYla8BVO4Pyg58KlEhPO/+Bq+fOD1wKWMzxY ynH0V453Ff+vontOQlMd7c6kPDrkfCej8/rx83eCQ+KnzrgY1LrzYbs75wKbvU9S82ofKrEU ZyQaajEXFScCAFZUpN2cAgAA X-CMS-MailID: 20181128153235eucas1p192a346be6aa9ca28a1000238db4c6fc8 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181128153235eucas1p192a346be6aa9ca28a1000238db4c6fc8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181128153235eucas1p192a346be6aa9ca28a1000238db4c6fc8 References: <1543419132-16099-1-git-send-email-c.manszewski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/exynos/exynos_mixer.c | 17 ++++++++++++----- drivers/gpu/drm/exynos/regs-mixer.h | 9 +++++---- 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 bcc26c10095a..2a25822bd6a1 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -381,14 +381,16 @@ static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height) mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_SCAN_MASK); } -static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) +static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, struct drm_display_mode *mode) { + enum hdmi_quantization_range range = drm_default_rgb_quant_range(mode); u32 val; - if (height < 720) { - val = MXR_CFG_RGB601_0_255; + if (mode->vdisplay < 720) { + val = MXR_CFG_RGB601; } else { - val = MXR_CFG_RGB709_16_235; + val = MXR_CFG_RGB709; + /* Configure the BT.709 CSC matrix for full range RGB. */ mixer_reg_write(ctx, MXR_CM_COEFF_Y, MXR_CSC_CT( 0.184, 0.614, 0.063) | @@ -399,6 +401,11 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) MXR_CSC_CT( 0.440, -0.399, -0.040)); } + if (range == HDMI_QUANTIZATION_RANGE_FULL) + val |= MXR_CFG_QUANT_RANGE_FULL; + else + val |= MXR_CFG_QUANT_RANGE_LIMITED; + mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); } @@ -455,7 +462,7 @@ static void mixer_commit(struct mixer_context *ctx) struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay); - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); + mixer_cfg_rgb_fmt(ctx, mode); mixer_run(ctx); } 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 @@ /* bits for MXR_CFG */ #define MXR_CFG_LAYER_UPDATE (1 << 31) #define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29) -#define MXR_CFG_RGB601_0_255 (0 << 9) -#define MXR_CFG_RGB601_16_235 (1 << 9) -#define MXR_CFG_RGB709_0_255 (2 << 9) -#define MXR_CFG_RGB709_16_235 (3 << 9) +#define MXR_CFG_QUANT_RANGE_FULL (0 << 9) +#define MXR_CFG_QUANT_RANGE_LIMITED (1 << 9) +#define MXR_CFG_RGB601 (0 << 10) +#define MXR_CFG_RGB709 (1 << 10) + #define MXR_CFG_RGB_FMT_MASK 0x600 #define MXR_CFG_OUT_YUV444 (0 << 8) #define MXR_CFG_OUT_RGB888 (1 << 8) -- 2.7.4