Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3023579iog; Mon, 27 Jun 2022 07:40:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uETggd5c5YpGpovoGUW863b62a/JhY43Inx27ZdGFngDhINrwO+CpnzBhKEDo0ISnKOL/z X-Received: by 2002:a05:6a00:c94:b0:525:7deb:6933 with SMTP id a20-20020a056a000c9400b005257deb6933mr15420197pfv.76.1656340811640; Mon, 27 Jun 2022 07:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656340811; cv=none; d=google.com; s=arc-20160816; b=lc/MKXuqBfRWQu+zKiuSBpyTFwhC8yyFLRjo92w5JT59sJuVyUoCh7NdoY36qPoFZq W5cNJ3XnXksJwAY2La3TbR5fuawuS5AITX14zk5hq9r6yJ5wHj1V0UtxudmIaIgugi4s 0kPgEebrgA6hajAmOFbSNjijVA79Sq6qQvPg1ArcVhn2EKukSsQ2nZ4/0QBib25/HJFm jeUyQEOUZ0FxF0duTzXMZ4hOPOKP5ifH9DLdzh1lT/8mxYldIGcFO4Ugx+vUrzR0xt3x kw2Ib5AAivjVbkNUeQtQ6HlAUMhWSOXXEhfM/HHqeeoY6pG8iOwdM5YGj7/PCyg17RvN FYWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=fLqgEUtgLQ8lVAfp8ZG2jhKWEHztetknTXBKAQnmq3M=; b=hi//DOvm+wvWeE4AEUZ+cnTA6ZUb/HItJx+JNSlsPNuhi6Jvp1qYAGxvu6TqfJuTRY 5pt5hGS+HydqOuevEIvk9UJtGSWdfykMdOE17Qyr4ZcYR3/hCpXovmKHWT59wlmjLIxo fIR6nlMxCa4ZGg11GQdZrmKe0Sq6FTqFJYmfQsSevAHsgISKcKhrEQXyKO0m3Cs/2d2e PczBF0oLFKkBXSVGs86E3HOyWJnqjeuUiyszcTkJPSs4D6gnoWvvfPjVnp+zt7ybmaig IhE1gNQ8ScXFZofM5b0QZNZTpExTY2Dy+H4ih2SW/jtsWIzWWNZDgNWJJf6JJ/IKZa19 uBbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NSwu6VaY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj9-20020a17090b4d8900b001eca02837b7si19329547pjb.9.2022.06.27.07.39.59; Mon, 27 Jun 2022 07:40:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=NSwu6VaY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235910AbiF0OMs (ORCPT + 99 others); Mon, 27 Jun 2022 10:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234735AbiF0OMr (ORCPT ); Mon, 27 Jun 2022 10:12:47 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774BE13EA1 for ; Mon, 27 Jun 2022 07:12:46 -0700 (PDT) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25RDU9iF019780; Mon, 27 Jun 2022 16:12:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=fLqgEUtgLQ8lVAfp8ZG2jhKWEHztetknTXBKAQnmq3M=; b=NSwu6VaYMtq+dl/8iQ971tpH3Kcfq3KhTl+DsWmMkKBJsDQjrRVdEwLh0+osjoUgGDt9 sDTXO1V3XMOR943wSSSv/xn2ao6AkYTnot6VjaJZhM8Rz30CsOJLlIag65Mb8xl70kaA 6G+ZvPTee2ipWK0dpCVYk5mSyoAC0bjx1nKyVrNifLPFij9eTaSYFQ5E6ibTvsFNcrqN ST7gn0I+2TEjVtVbDBmOtuflMoKVsg9goGKTf8XQ11t84Uex/VZSmhf5XW2RjsHVcXT1 ECEQnSUE1D34BXV856s2HmgYkl4f55Q7r7BMEr5piZdeqvaXHCcUe57bFGPYFyqzA/aB rw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3gy9mr1r0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Jun 2022 16:12:38 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 233AB100034; Mon, 27 Jun 2022 16:12:38 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1ED02221778; Mon, 27 Jun 2022 16:12:38 +0200 (CEST) Received: from [10.48.1.86] (10.75.127.48) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Mon, 27 Jun 2022 16:12:37 +0200 Message-ID: <5255f936-e064-b7a4-ef50-5486c0afa983@foss.st.com> Date: Mon, 27 Jun 2022 16:12:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] drm/stm: ltdc: add support of the dynamic z-order Content-Language: en-US To: Yannick Fertre , Raphael Gallais-Pou , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , , , , References: <20220603134459.593379-1-yannick.fertre@foss.st.com> From: Philippe CORNU In-Reply-To: <20220603134459.593379-1-yannick.fertre@foss.st.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-27_06,2022-06-24_01,2022-06-22_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/3/22 15:44, Yannick Fertre wrote: > Zpos property is immutable for all hardware versions except the last > version (0x40100) which support the blending order feature > (dynamic z-order). > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/drv.c | 1 + > drivers/gpu/drm/stm/ltdc.c | 23 ++++++++++++++++++++--- > drivers/gpu/drm/stm/ltdc.h | 1 + > 3 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 0da7cce2a1a2..c63945dc2260 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -95,6 +95,7 @@ static int drv_load(struct drm_device *ddev) > ddev->mode_config.max_width = STM_MAX_FB_WIDTH; > ddev->mode_config.max_height = STM_MAX_FB_HEIGHT; > ddev->mode_config.funcs = &drv_mode_config_funcs; > + ddev->mode_config.normalize_zpos = true; > > ret = ltdc_load(ddev); > if (ret) > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 6a9f613839b5..00a6bc1b1d7c 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -194,6 +194,7 @@ > > #define LXBFCR_BF2 GENMASK(2, 0) /* Blending Factor 2 */ > #define LXBFCR_BF1 GENMASK(10, 8) /* Blending Factor 1 */ > +#define LXBFCR_BOR GENMASK(18, 16) /* Blending ORder */ > > #define LXCFBLR_CFBLL GENMASK(12, 0) /* Color Frame Buffer Line Length */ > #define LXCFBLR_CFBP GENMASK(28, 16) /* Color Frame Buffer Pitch in bytes */ > @@ -1309,7 +1310,14 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, > plane->type != DRM_PLANE_TYPE_PRIMARY) > val = BF1_PAXCA | BF2_1PAXCA; > > - regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, LXBFCR_BF2 | LXBFCR_BF1, val); > + if (ldev->caps.dynamic_zorder) { > + val |= (newstate->normalized_zpos << 16); > + regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, > + LXBFCR_BF2 | LXBFCR_BF1 | LXBFCR_BOR, val); > + } else { > + regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, > + LXBFCR_BF2 | LXBFCR_BF1, val); > + } > > /* Configures the frame buffer line number */ > line_number = y1 - y0 + 1; > @@ -1578,7 +1586,10 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) > return -EINVAL; > } > > - drm_plane_create_zpos_immutable_property(primary, 0); > + if (ldev->caps.dynamic_zorder) > + drm_plane_create_zpos_property(primary, 0, 0, ldev->caps.nb_layers - 1); > + else > + drm_plane_create_zpos_immutable_property(primary, 0); > > /* Init CRTC according to its hardware features */ > if (ldev->caps.crc) > @@ -1607,7 +1618,10 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) > DRM_ERROR("Can not create overlay plane %d\n", i); > goto cleanup; > } > - drm_plane_create_zpos_immutable_property(overlay, i); > + if (ldev->caps.dynamic_zorder) > + drm_plane_create_zpos_property(overlay, i, 0, ldev->caps.nb_layers - 1); > + else > + drm_plane_create_zpos_immutable_property(overlay, i); > } > > return 0; > @@ -1737,6 +1751,7 @@ static int ltdc_get_caps(struct drm_device *ddev) > ldev->caps.ycbcr_output = false; > ldev->caps.plane_reg_shadow = false; > ldev->caps.crc = false; > + ldev->caps.dynamic_zorder = false; > break; > case HWVER_20101: > ldev->caps.layer_ofs = LAY_OFS_0; > @@ -1752,6 +1767,7 @@ static int ltdc_get_caps(struct drm_device *ddev) > ldev->caps.ycbcr_output = false; > ldev->caps.plane_reg_shadow = false; > ldev->caps.crc = false; > + ldev->caps.dynamic_zorder = false; > break; > case HWVER_40100: > ldev->caps.layer_ofs = LAY_OFS_1; > @@ -1767,6 +1783,7 @@ static int ltdc_get_caps(struct drm_device *ddev) > ldev->caps.ycbcr_output = true; > ldev->caps.plane_reg_shadow = true; > ldev->caps.crc = true; > + ldev->caps.dynamic_zorder = true; > break; > default: > return -ENODEV; > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h > index 59fc5d1bbbab..4855898bd4c0 100644 > --- a/drivers/gpu/drm/stm/ltdc.h > +++ b/drivers/gpu/drm/stm/ltdc.h > @@ -28,6 +28,7 @@ struct ltdc_caps { > bool ycbcr_output; /* ycbcr output converter supported */ > bool plane_reg_shadow; /* plane shadow registers ability */ > bool crc; /* cyclic redundancy check supported */ > + bool dynamic_zorder; /* dynamic z-order */ > }; > > #define LTDC_MAX_LAYER 4 Dear Yannick, Many thanks for your patch, Applied on drm-misc-next. Have a good day Philippe :-)