From patchwork Mon Feb 13 12:49:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihail Atanassov X-Patchwork-Id: 9569511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92565601E7 for ; Mon, 13 Feb 2017 13:03:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 717F526530 for ; Mon, 13 Feb 2017 13:03:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 665A826BE9; Mon, 13 Feb 2017 13:03:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4956A28354 for ; Mon, 13 Feb 2017 13:03:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BB196E3BC; Mon, 13 Feb 2017 13:03:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0084.outbound.protection.outlook.com [104.47.2.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49C466E3BC for ; Mon, 13 Feb 2017 13:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sva+/N3oeXQieOBFvmhg0ENv/TkfLTHSVy/zFskQVuA=; b=JCRAtdf+SdpcimJslm33VUu1MhNESFGZiELhJ3MDsTZQRvqiMIb3cBFcae6WA/fzfzYtYeUGiH9x0e0IKyP1rIdin+byP3kZr4ayr8wOSJ/FLfr2Qi1mZT9gcrd41INIKzUTR4heIotk7DsTxSElfct/PFO246TpaBb23y3jVLQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Mihail.Atanassov@arm.com; Received: from e110433-lin.cambridge.arm.com (217.140.96.140) by AM4PR08MB0881.eurprd08.prod.outlook.com (10.164.83.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Mon, 13 Feb 2017 12:49:06 +0000 From: Mihail Atanassov To: Subject: [PATCH v2] drm: mali-dp: Add CTM support Date: Mon, 13 Feb 2017 12:49:03 +0000 Message-ID: <1486990143-13363-1-git-send-email-mihail.atanassov@arm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: DB5PR08CA0011.eurprd08.prod.outlook.com (10.163.102.149) To AM4PR08MB0881.eurprd08.prod.outlook.com (10.164.83.27) X-MS-Office365-Filtering-Correlation-Id: 97a1fb3a-aeb8-4f54-5e35-08d4540eb267 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:AM4PR08MB0881; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0881; 3:NkKI4MvVjIt3WeoaaZbirmhus2Jd2eq+iO+1Cfylbui05GfGk76exfeoVmvM3j8523xzu6ikCGmhCJPrwre8SfXk8OwJVg2lXKs2+YamQ5FT2QpxYTBVZ5HtKu8svEB/PxyG+JVs6QRRtgMoH2RP4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LDmpql3rPnJrTjdMqdEU= NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(20161123562025)(6072148); SRVR:AM4PR08MB0881; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB0881; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0881; 4:ajaOiFaHVIG/ancBXVK4qCrcyGmyK5cupxPySYH6ZgBiWixihhRJSa3HniBkRxwpaFrbXXQhzkp3m2UnSzNjxhNqBeHhOy8nk/J1RwVl8OD15UO9+ouCrKIPPf/o/TB/EPS1Pi1nTz5XxRqrt9EF6uJxzo7UeKrcv4Of1prrgMI5myRrOaOn5YCAE333WffP/NPZSRGntStuHdMDUkiAHEA9TE55in3wA4YsmEBgE9Tf1ur6pAJCsVBkjne9FkYYnMcK7jOAUVj2JcG4g2wmqHAp96TeQFR6oRHuT4YW8GkUpcVbb3U/ncGKeqIciGBDnXn2SMKEaphQuZ6lNy7mWmJ1AdlxeSHIm10jrG3KZs8J791T4lSt4CEtKvhpxtBH83RYJf8ci8Fkx9gX5wm1NUYX+qr+0rG5FpeoW8ZgYvTxz6uRInntsNF6s7TwJhj4WZVjsxJgOAPw8uKFKXsTnkK8cr9JlzCoZXg5r8whWoC1ct1DXJ5tdQvaOJ2T1tA+qVLj/HC2fp2l912lvwqcDsdkexkKVvyvBoRPSJegMndZEuwyJGsGgLE+URUDd01LKsbE2HwmG7HAQ1YsVSoRMnpPqCblMeFOhKhjeTERIryPwO/2iLIZFoeakLznJ/mGknx0NS/AYHFlSo3YONlZ4QpiSlKkkAwZwYcb/lgR3b99mMfkRI1JhahxtjLPrDJncvphGwuzEo3lK89P5/EyUg== X-Forefront-PRVS: 02176E2458 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39840400002)(39850400002)(39410400002)(39450400003)(199003)(189002)(25786008)(5003940100001)(4326007)(36756003)(92566002)(3846002)(6116002)(189998001)(47776003)(66066001)(6306002)(33646002)(54906002)(5890100001)(97736004)(5660300001)(2906002)(50466002)(48376002)(6486002)(105586002)(106356001)(50986999)(53936002)(50226002)(42186005)(81156014)(8676002)(81166006)(101416001)(6916009)(68736007)(305945005)(6666003)(86362001)(575784001)(2351001)(7736002)(110136004)(38730400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0881; H:e110433-lin.cambridge.arm.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR08MB0881; 23:2KZk3dK78bpyYnwVmuAb9eIUlnIaiOe5jESn1GK4Y?= =?us-ascii?Q?hg6tx9Si5+Ts7bqasIewx1pbi2wOC29ccwn28n2H48iVJYRDxeN58yEMCgiG?= =?us-ascii?Q?dadpVa86Nq0OkUgoEhV9oJk314DvoN/NC2Eo3moahJal7Cr9UEJew1v1Og3e?= =?us-ascii?Q?iWCKOaHuvTJSS/nj2KkqxIMYwZAxi3qCRRY/rfnUPeTjF+mg+he3oGn6piB5?= =?us-ascii?Q?z4JoqoYndb5+yfzp+l+f3EWHKPehdtjUAeiUjjegZmSExBBohxejfwP085EZ?= =?us-ascii?Q?fAif/Kow+Y7E6OYiEd4RxHbFk8IPaWky8XF+YlfnXx/LyN9kOo1Zny5jyimo?= =?us-ascii?Q?R6Ntrqcwpdi+qfYjlQ9uxo5CsZXY8mRYi6rLgO7JcRpJHSzaUJ91rTbmuS4K?= =?us-ascii?Q?IIN9DIi1STeVQO+v563rZUeiFiL2oplKv/N9fj8qYrHGyIiB88Ze3ftfBnNe?= =?us-ascii?Q?f5A1b5roDfmEu9bjkPZ0xWrNRV0QRNf4Ck28vucb45z9g8gtjjRlM7wPTmsR?= =?us-ascii?Q?ZGAzI7t1+WphxQVYK4DB24lK0UGDHcC3lJy7jnvGR5O766flrwtVhPH6RqMH?= =?us-ascii?Q?6riQcOfuj3CKhK2WjJEgrSxed6GyxiiYq+sa0rLQVhKG0mO9GLKf7UC/qFjc?= =?us-ascii?Q?fXxZxiWJaLXlI5OyhBM83Ffnhl60gfywKURjKzZEpnG1+SfZmRjnShWWYUpS?= =?us-ascii?Q?pNSPGczhas+/7mJvBcz9HjMXRGeqSsF9wFf/yLQVYIMZlusBfyN9/gtNKhRb?= =?us-ascii?Q?cevHzzi2UeVC+dRzXc8JYigM50Cw+4yeRFdqzc25aX5Fdnm7/ha/oAPihC4f?= =?us-ascii?Q?TvHCBdmiR6fYMKfA17+U3TrCyNlXIN1skI+EwR2/JmhXxrtdr7Plekj+MT+E?= =?us-ascii?Q?dfnZ8/Hq8oAmeGigYPIFpzajVIyGioStbclKoLXfge7wFjiNMcFvdiI+OUgv?= =?us-ascii?Q?Yk6vV91h78NBdpVtjHbWrs2MlZWjh/YLwjUE86mwY2Qzx2I8yS50xTe/C8Xx?= =?us-ascii?Q?1D4qhb43sscF4laxHq2/wDvB5soayX7SNwTqjPisySry6VZGGok32IxobmcA?= =?us-ascii?Q?MrZhL05vH3sKToxZVJ/+2z/lTRTQAglHOEY4IP+AUVzQvql/IP0Ie+MlHGay?= =?us-ascii?Q?tXWsoMu5k6TyoK9GKlZvf4wmadYqoG3gVXX63tkIkT0QtH59TM5N5Jraafcs?= =?us-ascii?Q?OCFxOTPs/RpIobVaWCX6TXLum5AGjYRLO74?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0881; 6:JX33UMzPt6W0lMNdxph8BPL3WknxYa3KV+IX9MbM4bodv83fwPCN8GWwyL1h3j0HwAMMDKEKDK0asUOXpJlPsCODCDhQw4kj/XRfQ8Uow4OZplRK1kpqcInmu3fNWzkNi71Mv6gHF5mTitmfi6bNXGeefTIAN/WAuTYZ5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phaDg4xiLE91cLY75OTUzqPQeLVCBUsJYmHKs+IAN0JctUhDnWe4/2Zi/3K2lA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2017 12:49:06.1923 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0881 Cc: Liviu Dudau , linux-kernel@vger.kernel.org, Mali DP Maintainers , nd@arm.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP All DPs have a COLORADJ matrix which is applied prior to output gamma. Attach that to the CTM property. Also, ensure the input CTM's coefficients can fit in the DP registers' Q3.12 format. Signed-off-by: Mihail Atanassov --- Link to v1: https://lkml.org/lkml/2017/2/1/254 Changes since v1: - Rebased and fixed conflicts - Improved clarity of overflow check (+comment) - Moved call to malidp_atomic_commit_update_coloradj in the existing crtc for-each loop This patch depends on "[PATCH v3 2/2] drm: mali-dp: enable gamma support", sent out on 7 Feb (https://lkml.org/lkml/2017/2/7/547). drivers/gpu/drm/arm/malidp_crtc.c | 58 +++++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_drv.c | 36 +++++++++++++++++++++++- drivers/gpu/drm/arm/malidp_drv.h | 1 + drivers/gpu/drm/arm/malidp_regs.h | 2 ++ 4 files changed, 94 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 6a46520..7414540 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -192,6 +192,58 @@ static int malidp_crtc_atomic_check_gamma(struct drm_crtc *crtc, return 0; } +/* + * Check if there is a new CTM and if it contains valid input. Valid here means + * that the number is inside the representable range for a Q3.12 number, + * excluding truncating the fractional part of the input data. + * + * The COLORADJ registers can be changed atomically. + */ +static int malidp_crtc_atomic_check_ctm(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + struct malidp_crtc_state *mc = to_malidp_crtc_state(state); + struct drm_color_ctm *ctm; + int i; + + if (!state->color_mgmt_changed) + return 0; + + if (!state->ctm) + return 0; + + if (crtc->state->ctm && (crtc->state->ctm->base.id == + state->ctm->base.id)) + return 0; + + /* + * The size of the ctm is checked in + * drm_atomic_replace_property_blob_from_id. + */ + ctm = (struct drm_color_ctm *)state->ctm->data; + for (i = 0; i < ARRAY_SIZE(ctm->matrix); ++i) { + /* Convert from S31.32 to Q3.12. */ + s64 val = ctm->matrix[i]; + u32 mag = ((((u64)val) & ~BIT_ULL(63)) >> 20) & + GENMASK_ULL(14, 0); + + /* + * Convert to 2s complement and check the destination's top bit + * for overflow. NB: Can't check before converting or it'd + * incorrectly reject the case: + * sign == 1 + * mag == 0x2000 + */ + if (val & BIT_ULL(63)) + mag = ~mag + 1; + if (!!(val & BIT_ULL(63)) != !!(mag & BIT(14))) + return -EINVAL; + mc->coloradj_coeffs[i] = mag; + } + + return 0; +} + static int malidp_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { @@ -269,6 +321,7 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc, } ret = malidp_crtc_atomic_check_gamma(crtc, state); + ret = ret ? ret : malidp_crtc_atomic_check_ctm(crtc, state); return ret; } @@ -288,6 +341,7 @@ static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc) __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); memcpy(state->gamma_coeffs, cs->gamma_coeffs, sizeof(state->gamma_coeffs)); + memcpy(state->coloradj_coeffs, cs->coloradj_coeffs, sizeof(state->coloradj_coeffs)); return &state->base; } @@ -358,8 +412,8 @@ int malidp_crtc_init(struct drm_device *drm) drm_crtc_helper_add(&malidp->crtc, &malidp_crtc_helper_funcs); drm_mode_crtc_set_gamma_size(&malidp->crtc, MALIDP_GAMMA_LUT_SIZE); - /* No inverse-gamma and color adjustments yet. */ - drm_crtc_enable_color_mgmt(&malidp->crtc, 0, false, MALIDP_GAMMA_LUT_SIZE); + /* No inverse-gamma: it is per-plane. */ + drm_crtc_enable_color_mgmt(&malidp->crtc, 0, true, MALIDP_GAMMA_LUT_SIZE); return 0; crtc_cleanup_planes: diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index ce741c3..15f0f91 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -77,6 +77,37 @@ static void malidp_atomic_commit_update_gamma(struct drm_crtc *crtc, } } +static +void malidp_atomic_commit_update_coloradj(struct drm_crtc *crtc, + struct drm_crtc_state *old_state) +{ + struct malidp_drm *malidp = crtc_to_malidp_device(crtc); + struct malidp_hw_device *hwdev = malidp->dev; + int i; + + if (!crtc->state->color_mgmt_changed) + return; + + if (!crtc->state->ctm) { + malidp_hw_clearbits(hwdev, MALIDP_DISP_FUNC_CADJ, + MALIDP_DE_DISPLAY_FUNC); + } else { + struct malidp_crtc_state *mc = + to_malidp_crtc_state(crtc->state); + + if (!old_state->ctm || (crtc->state->ctm->base.id != + old_state->ctm->base.id)) + for (i = 0; i < MALIDP_COLORADJ_NUM_COEFFS; ++i) + malidp_hw_write(hwdev, + mc->coloradj_coeffs[i], + hwdev->map.coeffs_base + + MALIDP_COLOR_ADJ_COEF + 4 * i); + + malidp_hw_setbits(hwdev, MALIDP_DISP_FUNC_CADJ, + MALIDP_DE_DISPLAY_FUNC); + } +} + /* * set the "config valid" bit and wait until the hardware acts on it */ @@ -139,10 +170,13 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_disables(drm, state); - for_each_crtc_in_state(state, crtc, old_crtc_state, i) + for_each_crtc_in_state(state, crtc, old_crtc_state, i) { malidp_atomic_commit_update_gamma(crtc, old_crtc_state); + malidp_atomic_commit_update_coloradj(crtc, old_crtc_state); + } drm_atomic_helper_commit_modeset_enables(drm, state); + drm_atomic_helper_commit_planes(drm, state, 0); malidp_atomic_commit_hw_done(state); diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h index fbf6187..3bd4c76 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -50,6 +50,7 @@ struct malidp_plane_state { struct malidp_crtc_state { struct drm_crtc_state base; u32 gamma_coeffs[MALIDP_COEFFTAB_NUM_COEFFS]; + u32 coloradj_coeffs[MALIDP_COLORADJ_NUM_COEFFS]; }; #define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base) diff --git a/drivers/gpu/drm/arm/malidp_regs.h b/drivers/gpu/drm/arm/malidp_regs.h index eeba027..8c3f3ff 100644 --- a/drivers/gpu/drm/arm/malidp_regs.h +++ b/drivers/gpu/drm/arm/malidp_regs.h @@ -64,6 +64,7 @@ /* bit masks that are common between products */ #define MALIDP_CFG_VALID (1 << 0) #define MALIDP_DISP_FUNC_GAMMA (1 << 0) +#define MALIDP_DISP_FUNC_CADJ (1 << 4) #define MALIDP_DISP_FUNC_ILACED (1 << 8) /* register offsets for IRQ management */ @@ -99,6 +100,7 @@ #define MALIDP_PRODUCT_ID(__core_id) ((u32)(__core_id) >> 16) +#define MALIDP_COLORADJ_NUM_COEFFS 12 #define MALIDP_COEFFTAB_NUM_COEFFS 64 /* register offsets relative to MALIDP5x0_COEFFS_BASE */ #define MALIDP_COLOR_ADJ_COEF 0x00000