Received: by 10.223.176.5 with SMTP id f5csp1689677wra; Thu, 8 Feb 2018 01:41:27 -0800 (PST) X-Google-Smtp-Source: AH8x227SviKaEd0ApcMTN3jWsh1SAWTcEgHHZMZY9HS82RDNFH21XlJc2t1EzWXP76atwWjLLctF X-Received: by 10.98.78.148 with SMTP id c142mr46642pfb.153.1518082887268; Thu, 08 Feb 2018 01:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518082887; cv=none; d=google.com; s=arc-20160816; b=hPUkCyp5bUsMrFwUzkXfGcaLfouuK7ytoVL9+zVuL5c1P6rq0nG0RI4lpyA5DXc9Af ZqzRS+5nWK/Gf2kY1B62yVQgalIiD0Piq25ZGpN9fgXsoQk+xWyJJt+WUEoo/I4P6qxI FhFWfYF+bgKxwAJ462JcrLw4gUimk9WD4XzAU6VtYbyN1rpbvwjv1X5VjGtjBBSK/hZj Nx+0MtFQ6v7oG8uPBpGVpKA9h8RLWgrf05768YyJcNZiCRtTbMxXGoebsBlfYqBsMFGs EIs69IFPcsUDFd4xN34Hdgfdwl7azJf9nkrykYyMt/n/pRbIGoXKE/TTBxczgOfDFsjY jXMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=CLuFE7L5YUe67yO0+2x2JNvAruUgB3IXkGYVxGC5S0I=; b=UCAs4n9Tb1vgNpBoU4yugXpD0e+aKpiHuNvOu6MaDqSJIwONTGTrlSN4hY/Tq73fE1 mpLemroQALzGtKNn5czTXHH9ICHk2sQklaIyXsupn/WPRviIoPfo9YgBVKxUHttZ8Smq Kd+WRbJlWQbYGtYV48FrIloZD8Y3iHMb2C3MDCA8gNXE60vrkP+tF246ykW5ka9+V4wJ 9CBMM3ck+yWkPzMR8IoY8LCeb+My2RTrseKv5g6SFGo2CywhNN30KIteghqoR2v66jS1 f98nCHzRKCKpgY5dT+QiscfQU3JkrQFPdIpn+06VJAoyD3vr5hTCluXlT2W4/OQbnPBD E8wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMC16Lxx; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si1035222pgu.798.2018.02.08.01.41.12; Thu, 08 Feb 2018 01:41:27 -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=@linaro.org header.s=google header.b=XMC16Lxx; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751153AbeBHJka (ORCPT + 99 others); Thu, 8 Feb 2018 04:40:30 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:39702 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbeBHJk2 (ORCPT ); Thu, 8 Feb 2018 04:40:28 -0500 Received: by mail-qt0-f196.google.com with SMTP id f4so5357077qtj.6 for ; Thu, 08 Feb 2018 01:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CLuFE7L5YUe67yO0+2x2JNvAruUgB3IXkGYVxGC5S0I=; b=XMC16LxxwJSGh0c4cecrlkZ7ZWbOD6bSBLKohGAlQ1EqPQi5etfwI8CXbA0LdqYI1j Smu9cppZTV1VhFkY3ISiBA/g2/rzIb81nFcRdAD4/QJJ9F2zp4G7JbNWE585JChCLqRE vTm8vQKuoDWZrcf/MJtVOFCrb3O/BLQsNneSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CLuFE7L5YUe67yO0+2x2JNvAruUgB3IXkGYVxGC5S0I=; b=TkLwNzW5f6Bc32W403oE8XvCBzu+SCbGto9lNwLXeWw8RvscoL6ZuwtTUQrpmpcq4V Zh+GpbyeyOtRTTU7snGe5ZgpO4Oac6TD2MakjFFD3k4rAnxgIHPqiR5lVD0MH2y86bsj hHKGwowN+tK8qvvdWk1m+c5jA19NVyj4zLtx4fhqpp8MrSCOo3u18I+dzgDt259MT1iT gnyk3cH0mWvz5Wqoz5g0F1cFpmvX4F+IEVw15oHLtEwwfYekz9dr96gMYly5Pghw+yfC Uyud9hSFssna6Y3MCdi+TvDMRjtB+3d+QANFwIX41Y9dBhZvPXM8MNgjCrd6QYJQRI2d z/fg== X-Gm-Message-State: APf1xPCyenq8CpJ13qkFga8K1Nr5jBSoNgMPjE4PfeXET7Eltaqh2PP5 KOQ5F5shuvx/pyCxWoQDZZGhSvRS7UlMoBXxUDePmQ== X-Received: by 10.237.53.202 with SMTP id d10mr98550qte.276.1518082827751; Thu, 08 Feb 2018 01:40:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.82.178 with HTTP; Thu, 8 Feb 2018 01:40:27 -0800 (PST) In-Reply-To: <2c9f9935-a1ce-84de-e90b-c9462c9bf785@st.com> References: <20180201104243.20726-1-philippe.cornu@st.com> <20180201104243.20726-2-philippe.cornu@st.com> <2c9f9935-a1ce-84de-e90b-c9462c9bf785@st.com> From: Benjamin Gaignard Date: Thu, 8 Feb 2018 10:40:27 +0100 Message-ID: Subject: Re: [PATCH v1 1/2] drm/stm: ltdc: add non-alpha color formats To: Yannick FERTRE Cc: Philippe CORNU , Vincent ABRIOU , David Airlie , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Fabien DESSENNE , Mickael REULIER , Alexandre TORGUE Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-02-06 10:12 GMT+01:00 Yannick FERTRE : > Reviewed-by: Yannick Fertr=C3=A9 > > > On 02/01/2018 11:42 AM, Philippe Cornu wrote: >> ltdc supports natively some color formats with alpha (like >> ARGB8888, ARGB1555, ARGB4444...). Related non-alpha formats are >> supported too (ARGB8888->XRGB8888, ARGB4444->XRGB4444...) by >> adjusting ltdc blending factors. >> >> Note: Wayland/Weston requests by default the non-alpha XRGB8888 >> color format. >> >> Signed-off-by: Philippe Cornu Applied on drm-misc-next Benjamin >> --- >> drivers/gpu/drm/stm/ltdc.c | 33 +++++++++++++++++++++++++++++++-- >> 1 file changed, 31 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c >> index 90b3de516c91..f6f26fc0ae9e 100644 >> --- a/drivers/gpu/drm/stm/ltdc.c >> +++ b/drivers/gpu/drm/stm/ltdc.c >> @@ -328,6 +328,26 @@ static inline u32 to_drm_pixelformat(enum ltdc_pix_= fmt pf) >> } >> } >> >> +static inline u32 get_pixelformat_without_alpha(u32 drm) >> +{ >> + switch (drm) { >> + case DRM_FORMAT_ARGB4444: >> + return DRM_FORMAT_XRGB4444; >> + case DRM_FORMAT_RGBA4444: >> + return DRM_FORMAT_RGBX4444; >> + case DRM_FORMAT_ARGB1555: >> + return DRM_FORMAT_XRGB1555; >> + case DRM_FORMAT_RGBA5551: >> + return DRM_FORMAT_RGBX5551; >> + case DRM_FORMAT_ARGB8888: >> + return DRM_FORMAT_XRGB8888; >> + case DRM_FORMAT_RGBA8888: >> + return DRM_FORMAT_RGBX8888; >> + default: >> + return 0; >> + } >> +} >> + >> static irqreturn_t ltdc_irq_thread(int irq, void *arg) >> { >> struct drm_device *ddev =3D arg; >> @@ -680,6 +700,9 @@ static void ltdc_plane_atomic_update(struct drm_plan= e *plane, >> >> /* Specifies the blending factors */ >> val =3D BF1_PAXCA | BF2_1PAXCA; >> + if (!fb->format->has_alpha) >> + val =3D BF1_CA | BF2_1CA; >> + >> reg_update_bits(ldev->regs, LTDC_L1BFCR + lofs, >> LXBFCR_BF2 | LXBFCR_BF1, val); >> >> @@ -747,8 +770,8 @@ static struct drm_plane *ltdc_plane_create(struct dr= m_device *ddev, >> struct device *dev =3D ddev->dev; >> struct drm_plane *plane; >> unsigned int i, nb_fmt =3D 0; >> - u32 formats[NB_PF]; >> - u32 drm_fmt; >> + u32 formats[NB_PF * 2]; >> + u32 drm_fmt, drm_fmt_no_alpha; >> int ret; >> >> /* Get supported pixel formats */ >> @@ -757,6 +780,12 @@ static struct drm_plane *ltdc_plane_create(struct d= rm_device *ddev, >> if (!drm_fmt) >> continue; >> formats[nb_fmt++] =3D drm_fmt; >> + >> + /* Add the no-alpha related format if any & supported */ >> + drm_fmt_no_alpha =3D get_pixelformat_without_alpha(drm_fmt= ); >> + if (!drm_fmt_no_alpha) >> + continue; >> + formats[nb_fmt++] =3D drm_fmt_no_alpha; >> } >> >> plane =3D devm_kzalloc(dev, sizeof(*plane), GFP_KERNEL);