Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964908AbeALQdV (ORCPT + 1 other); Fri, 12 Jan 2018 11:33:21 -0500 Received: from mail-eopbgr50066.outbound.protection.outlook.com ([40.107.5.66]:27381 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964779AbeALQdU (ORCPT ); Fri, 12 Jan 2018 11:33:20 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ayan.Halder@arm.com; From: Ayan 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 Cc: nd@arm.com, Ayan Halder Subject: [PATCH] drm/arm/malidp: Disable pixel alpha blending for colors that do not have alpha Date: Fri, 12 Jan 2018 16:33:07 +0000 Message-Id: <1515774787-19324-1-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) To HE1PR0802MB2411.eurprd08.prod.outlook.com (2603:10a6:3:dd::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74e04459-dfd5-4fcd-f013-08d559da2f3b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020084)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020);SRVR:HE1PR0802MB2411; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2411;3:oFdpfzl2eb2Ix6B6cLzlJEZ0FISYM3sHXsjSnIK2gTla9SDto1Xzao8hsm4/NAgXfAxddrdg8GwSolMPbgyKzlulCwB0vNIB4cpXkawqBYYFYExo6uPWDlX3oDmBF9foDsWbSDg9CxKqjEniaKf5p8zlF3bXldoDtyYbkzI7yD0XZXb3xhxhfkp9du8DI3YF4mkmDGMMfkZSfkHmC6l23M/DPviZDCacLeDuhdk/U2OC2MjhkEiOPNGmqXG5eAQK;25:TCHWShtsMpT90V9EUPppuFPULsf1msT3F+RImnIPBCdv3zZi6RsYXyuJzGqi4GXPGCK3v2+OXfmx4viUPRzEddCVYcSmrxZZmiGB0XdDvwgW4BFdi8YoNKGrBIgMrZKJ3EYCaRjW4rABIB/FqOJYINCH4sb5Y6vdUPa+YXu95htIqzGZ0R0Y3bijmyIg8Dk/f+0ySapUKENXz5JUtlcuXb2C9pnpnS3G/samegfxsG7qqJRBfb7uEeGvqhocenimTdoiJKObX28jFc39bG+GDM7rI5ROsZE8tvuR5gXvR/i7z4luNap/EP3DwN5SnX0v4aR5e32/XDrxoxdHorIjAQ==;31:r+5GJvBYZNpZRTo63nqA1xb/NZdV2elUrW+QerpeJDnZlYaJm2MF3aSo+9H3at47Klb+LZJbq+/CXoY9js07h688apMF1x/HrFcR57VSykbNcU76yuQqVERyGKTfDnzhTD6Xq+IJLDfEJ3j8XYLeAcIOFOPKOCtGz85F0/XAFz0ER31exQn4x9wRaBU+YaW9uP39QP+g3FjApxqqOR4kSeOP3UmwVoNrFAslhaIY6jw= X-MS-TrafficTypeDiagnostic: HE1PR0802MB2411: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2411;20:49nJUp3dsODRdtaVpNq6Cmb9D6+iH8U0vhiJKD93FSh7sV2rVL4lzZfsSwgsaG65oMV7Os/vmXaBTDL/Cau3QWg4X8V9/I18vdXQ0kcgThspEG/dFLg8VzueGtNnjgfauvq21I0htuwfStLEwpyWEkYneR+FGig4p9Cz2W1T6sE=;4:M/I4d0xgX+wU+x2WkodAcFGp8aAS1Jzobq6ElU2dAvRugTRfAje0RAPFJG4k4wfhmEdGIUkmvKWmhCeX3NqToQ/tn9lcXDPwF84LG3QuNSDmDWVBNagEqAdxpJyIoP9C6yqDuCFq7quPJ7pOalneoUWVL4vpEV8AlKd+w+NIkQj9aH+icLhvP5j9dA7Jiqa9JuznJmNf3HVPHfNfKB1+E/T57FSnn3YgV+9tCbXN8Mp6ba5RHoEUNW2mFmBv1UmYsnR7oGC5GtfnfL9sEXF0zsJCe8UQ93VuFcszsUz2IzU7Cy4Ks4dO9CY6Zh6ODcsA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231023)(944501145)(93006095)(93001095)(6055026)(6041268)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:HE1PR0802MB2411;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR0802MB2411; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(366004)(346002)(396003)(39860400002)(39380400002)(199004)(189003)(36756003)(6666003)(72206003)(2906002)(105586002)(106356001)(386003)(59450400001)(5660300001)(3846002)(6116002)(478600001)(51416003)(53936002)(7696005)(16526018)(68736007)(6486002)(50466002)(50226002)(7736002)(16586007)(8936002)(8676002)(305945005)(25786009)(4326008)(48376002)(66066001)(47776003)(52116002)(86362001)(97736004)(316002)(81156014)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0802MB2411;H:e113505-lin.cambridge.arm.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0802MB2411;23:47XDRQLiaY42w751gxWp19NXaEJyd4p46TgJPZN?= =?us-ascii?Q?O0z3gcs+Hp0GgH0JVYPqBEwqfB+H4FGbMIGiOipbls/5+4YMBdu+VI5vHUMB?= =?us-ascii?Q?Dip61oXywKlLiMZW8hAK/UyfoGfSpyThx+eg7frh6Vq4BT1oLbKjX2px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T5+yvXm2uy4x5QY+u0HWGSu6lCg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0802MB2411;6:mCU25f+IGJZebv8Xc+mnrOKynl1CM6qOQhHm08Ua+S0fXLBgP0U45pKQchzPCO2pWuEGPpXiE/wNV3NawfLb2azRq6tXje6TvRqXHiw+WG3IUH6ySp4eN8p5aKiOBbXAMp5SDzHrhNHsgCr9gjvdNy0LKhpvD8gy7cfvvjg91XhypGJverzMMAqOCrvfgPPCuY9hwhUTRr1KX1ysr33b+U/vhHGQ+Pwac8iU1aGkl00zMhheoVlvF0x7HUE1rVUPAhVZyXlotNdx1uUI7BRrZ/P13PGQB2ioY4+y2xfFIYvmO62Mkv/LbIes5a59JsjHvaa0F3A2S4L5lNOOXBE4uQBQgTga99GA7NoMaGA63cU=;5:0OsMNSdQyVKugYP01PO6XcD+Di0sinfdYOv8q/sByZvYxs1uCCZirMAKfBrAIhhZofjxklO9946uZySWt652L+Svd58C/8kBv6Wned3MUHutP04dlv6OhnaihzzD41tChJhT/txDtAdOEJ4GYbAqTxn4OHGYbdmYdoDPz0CriKI=;24:4l1ALDf2to+JOruDy6Ic7FVfECeJ/14LbNFNP9I/V4eAQc9k6bAnFO/exocATjIQCjNUd93AoBYb6Eh1DTr3X9EIX3/sLhp9shXDbCvU1Iw=;7:fNgj/kORV14fya3nVnWb9yAPAyu/eLOTW6SIXtbvdhRrWlF3WCkDBssChY9D3S/8xNoy9Yzq0olg5RTladSZgbUk5q9kJ03ajz6SF9WokGDtpY202JqxYuz2BhQUfyOtEg2ALiXHxyftLw6hcosGwbUT3NLIUZ/1dhEAzJ8LoQTiN10Impkoh4jMRad8z2DjiX9/UcxCMRAcoNZz8EJRnEDhVZqetigcYWZp14PiJkaaevwkglNl9DF9oOg2Cbap SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 16:33:16.3617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74e04459-dfd5-4fcd-f013-08d559da2f3b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2411 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Mali dp needs to disable pixel alpha blending (use layer alpha blending) to display color formats that do not contain alpha bits per pixel Signed-off-by: Ayan Kumar Halder --- 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..4d7d564 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; + u8 alpha_bits = plane->state->fb->format->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 (alpha_bits > 0) { + + /* + * 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) { -- 2.7.4