From patchwork Tue Jan 23 16:49:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Halder X-Patchwork-Id: 10180749 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 EE73C6037F for ; Tue, 23 Jan 2018 16:49:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0FC128710 for ; Tue, 23 Jan 2018 16:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5A4B28713; Tue, 23 Jan 2018 16:49:46 +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 5B05628716 for ; Tue, 23 Jan 2018 16:49:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36F8089991; Tue, 23 Jan 2018 16:49:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0084.outbound.protection.outlook.com [104.47.1.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4688889991 for ; Tue, 23 Jan 2018 16:49:42 +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=4JL3zycJzBicCzj9zLu0m1d91iN8k3XDgPRpErmhzAI=; b=BcTVipLnpBzSXtyOxETpxCHL78NOd+wToFEW+gdaGstMjPDml/AhHeABGI9wHgrLiLKdjSrnBZYS72BVu3OjN4IDzbKTq550kHeq4u0CzqrOn+pPXiMfKmH/meCzlOd/K3giOUzRlQhVzdBSVfAr8R3/3mUH6iQEucWW9hEmEcM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ayan.Halder@arm.com; Received: from e113505-lin.cambridge.arm.com (217.140.96.140) by VI1PR0802MB2414.eurprd08.prod.outlook.com (2603:10a6:800:ba::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 16:49:38 +0000 From: Ayan Kumar Halder To: liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] drm/arm/malidp: Disable pixel alpha blending for colors that do not have alpha Date: Tue, 23 Jan 2018 16:49:29 +0000 Message-Id: <1516726169-12000-1-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: DB6PR0202CA0037.eurprd02.prod.outlook.com (2603:10a6:4:a5::23) To VI1PR0802MB2414.eurprd08.prod.outlook.com (2603:10a6:800:ba::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4682049b-9160-40f5-8e19-08d562814ad7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0802MB2414; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2414; 3:qYhNeqWMpAmtZCGecx6IpdolCNA1ZyKKgs8/Pn6zIOhC4lhSQLJYaRXs9pgHRurol5/clAcklz9HSGnsk1+Qc7GTrAemVlVb36dZC+dCAT5+L2B7n7UdE/iG2q3E5Sta2jYhd5oiL/Sw09ChBsTTWOfKY7yWsATHlmhJK55WIdvOhGD/kD9o/Es36d1G7so76V5R5rsBQM8nEJhDdVLkGcZ4GAbIqYHMmyGWp7QT8t2AHedfhZeDxtaXYFsWKhul; 25:KO8dN1mlnARI26Iw+ohjJMo5E2hgk6+Tl4LZswPTFfw5wL9GryNntwPkTwZjWrfUUznUeYTxEfGetaAmEC/St3LU+Br5UY6KLjKPb34L8iEIX38TwSrfYVY6MoCkj1TMDBga9hnHetn7JH8PeVLhl3OI4K3mOavO9WzFYrUErNhO57cxhLU16QyVz3oGi04doDnBUFFIvIiYmpLk9tRTCnj0PfYAR1hG0jYILihp9NwCuUE8rN0+EnpTyNLepQGbzZKfH58S2klTgKsElEzVydi0orAsYuv+CSPBHwSA504VcViJgBJG2GTOFSgqznknNu8KWtudlGmecxKoUY7WxQ==; 31:vWLi9w5e0TACR67dxCBVLpSq2p5aPWbMiPWBvxSkJq44xSAqEL9XZ9t/EYIO9yIYetvwD8tvf5j6AtYfJMqRJTM5y548Sl+3I2WQjYjSIYtC34gv+8XNJHfSXWaYiHE0E9ej314K+uvxv1nFSBzg0MmsXl1obYHmunvueKlpmOAlq8YwYICzJEsMvWCfTuQioxoqUL0CcJwASGQn+Ax0EYfUQZhbO25YEn15RUytr5M= X-MS-TrafficTypeDiagnostic: VI1PR0802MB2414: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2414; 20:/+ghFOcYik8piqep2UoFM8nJrRr5OccPMjX/rWwxzdLnwTHb0ZZZ4U/80B4OrxISwKkLZ5E/KTUGC2NBc8g2aSjs3AU+19IsQLexrL45YS1nNiZepLyEyp6IYjuo0ZbJXXtGpFFWSVmvkyDFOHxci00SjYE7+Nbmh2vVKPJ9jzw=; 4:hMxpw4ODFSvghC/klC74srZ2wXyJwrD01oEkjDkumxLsigo5eRmUHWa04mWq9keg5Ceqor2eMXCDnkTPXie4u9gmS582OeTqFZBHCGPChK8BD683ra47ZvmGAP721T41exSafFp4BTIrK88EAVs/Blu2gsyqXVKNwWRWt0k9w+Ae0o7pC5K7aP1QGetic0cTJXG8bgAqscjq4Axr/E3YYLnpkt/QwPqBRKz+bqlejDb7kiKYKaCjbA4g+Pmku8Eed8AK9zUka8rBu3hQdsYWPHbrFDBSQh7jZnrWZtqA6IWdAvc4QQgiLMx8FR1n9sFM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231023)(2400081)(944501161)(6055026)(6041288)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0802MB2414; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0802MB2414; X-Forefront-PRVS: 05610E64EE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(396003)(39860400002)(366004)(199004)(189003)(5660300001)(7696005)(36756003)(52116002)(6666003)(53936002)(59450400001)(51416003)(66066001)(68736007)(478600001)(50226002)(25786009)(81156014)(47776003)(8936002)(81166006)(106356001)(8676002)(48376002)(4326008)(2906002)(316002)(97736004)(105586002)(386003)(50466002)(305945005)(7736002)(6486002)(16586007)(26005)(72206003)(16526018)(86362001)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2414; H:e113505-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; VI1PR0802MB2414; 23:NQeUJKLHWIAJG/Y+zqh+hhkqHAZlpfysyNQWCNl?= =?us-ascii?Q?ZpysEp/rRFIQ3d9bQc/kaByQDDKpMtHFZUMyN0vr8DJFK27DD5xtpz8uf2eg?= =?us-ascii?Q?zkSjf7SHWNZldq3yHVa4Oft2JyMem5XXTOxhHHetNxqLmGtK9hUYwQQzPLjt?= =?us-ascii?Q?rOwsGjYrwQP65zm5EBfwbiN+zqOtFJSx6hM44/BElL2+4pG22iti0CimkQ+O?= =?us-ascii?Q?20wpFlHagglgH7NlKR572Q6hOZEOiCvHaXyxkjtmxcDoPZRHEgoxNoSlAwAX?= =?us-ascii?Q?useBzTkyRN2nOzZYW5XDD+cAZNCdLuyBdvXLUHNqFpRru1Xs7Ie/+PLmmy6m?= =?us-ascii?Q?m4bks8v/qwKLNQ/lwdbvETP6anmEyh1ljh2SlOpAC7t/L3fL6t12tekkWr9k?= =?us-ascii?Q?3Xu7bCXbF5BSVwg2k9PsGmwbFac8zrImJ5GkdR20U9AK23agEBpBHO5Jenqf?= =?us-ascii?Q?SED0TkyehA7RkydafLlPkamnmkmuMyNxwoWyWLyXqjfddcKN5HoQr8OtLgBD?= =?us-ascii?Q?euVqanizbwkh5ISZbLPjfBR2l2aFPX4BmXfhwfsBt7IhUNzLYuMG5D3zEzR4?= =?us-ascii?Q?FgZ053QG6jWcIcSYo+YOLVwD+WijKdhabXvMGKf5+KqNwX2k5pXazDioScie?= =?us-ascii?Q?WZnZFV3cEEk7HmvG+XOsO6lvXxYzDDOs/3WvjR3A6JBIzhpwD4yZP3upxgSp?= =?us-ascii?Q?AB4WTHMC3xa/XTRARl4/LT4ZqufwWmMg+RNz79gWO8Mw3FpVc56oHnjc8mwx?= =?us-ascii?Q?35blwWSCgnY0QGhrmLiSdBShIPaLc/6+rlEGML/+r4cBPoiBb+krRUE0qgSB?= =?us-ascii?Q?PenO5eizp351XILHymRxeRG81m9nVM2KUpb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WeRlGqGoRqvefRI/w2hq53hpPstIXphco+yQtLlpfRj0WV5xS5bJLNiNsM4Mv5JoRb4wK/jC2Kv+ebGvQLjfGRvKBDzJwhG79gPw7/CCmsLALJzE1cTJGRvlhvgqdeGgmyHnlTj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 16:49:38.3580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4682049b-9160-40f5-8e19-08d562814ad7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2414 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , nd@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ayan Halder Mali dp needs to disable pixel alpha blending (use layer alpha blending) to display color formats that do not contain alpha bits per pixel This patch depends on: "[PATCH v2 01/19] drm/fourcc: Add a alpha field to drm_format_info" Signed-off-by: Ayan Kumar Halder Acked-by: Liviu Dudau --- Change in v2: - Use struct drm_format_info->has_alpha (boolean) to determine if a color format has alpha channel drivers/gpu/drm/arm/malidp_planes.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index e741979..3b445d9 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -35,6 +35,9 @@ #define LAYER_COMP_MASK (0x3 << 12) #define LAYER_COMP_PIXEL (0x3 << 12) #define LAYER_COMP_PLANE (0x2 << 12) +#define LAYER_ALPHA_OFFSET (16) +#define LAYER_ALPHA_MASK (0xff) +#define LAYER_ALPHA(x) (((x) & LAYER_ALPHA_MASK) << LAYER_ALPHA_OFFSET) #define MALIDP_LAYER_COMPOSE 0x008 #define MALIDP_LAYER_SIZE 0x00c #define LAYER_H_VAL(x) (((x) & 0x1fff) << 0) @@ -268,6 +271,7 @@ static void malidp_de_plane_update(struct drm_plane *plane, struct malidp_plane_state *ms = to_malidp_plane_state(plane->state); u32 src_w, src_h, dest_w, dest_h, val; int i; + bool format_has_alpha = plane->state->fb->format->has_alpha; mp = to_malidp_plane(plane); @@ -319,12 +323,25 @@ static void malidp_de_plane_update(struct drm_plane *plane, if (plane->state->rotation & DRM_MODE_REFLECT_Y) val |= LAYER_V_FLIP; - /* - * always enable pixel alpha blending until we have a way to change - * blend modes - */ val &= ~LAYER_COMP_MASK; - val |= LAYER_COMP_PIXEL; + if (format_has_alpha) { + + /* + * always enable pixel alpha blending until we have a way + * to change blend modes + */ + val |= LAYER_COMP_PIXEL; + } else { + + /* + * do not enable pixel alpha blending as the color channel + * does not have any alpha information + */ + val |= LAYER_COMP_PLANE; + + /* Set layer alpha coefficient to 0xff ie fully opaque */ + val |= LAYER_ALPHA(0xff); + } val &= ~LAYER_FLOWCFG(LAYER_FLOWCFG_MASK); if (plane->state->crtc) {