All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>,
	rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com
Cc: hamohammed.sa@gmail.com, daniel@ffwll.ch, airlied@linux.ie,
	contact@emersion.fr, leandro.ribeiro@collabora.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	lkcamp@lists.libreplanetbr.org
Subject: Re: [PATCH 5/6] drm: vkms: Prepare `vkms_wb_encoder_atomic_check` to accept multiple formats
Date: Mon, 18 Oct 2021 12:14:52 +0200	[thread overview]
Message-ID: <5507450a-eb69-b24c-9f43-a1780dafbfa9@suse.de> (raw)
In-Reply-To: <20211005201637.58563-6-igormtorrente@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1905 bytes --]

Hi

Am 05.10.21 um 22:16 schrieb Igor Matheus Andrade Torrente:
> Currently, the vkms atomic check only goes through the first position of
> the `vkms_wb_formats` vector.
> 
> This change prepares the atomic_check to check the entire vector.
> 
> Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
> ---
>   drivers/gpu/drm/vkms/vkms_writeback.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 5a3e12f105dc..56978f499203 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -30,6 +30,8 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder,
>   {
>   	struct drm_framebuffer *fb;
>   	const struct drm_display_mode *mode = &crtc_state->mode;
> +	bool format_supported = false;
> +	int i;
>   
>   	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
>   		return 0;
> @@ -41,7 +43,14 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder,
>   		return -EINVAL;
>   	}
>   
> -	if (fb->format->format != vkms_wb_formats[0]) {
> +	for (i = 0; i < ARRAY_SIZE(vkms_wb_formats); i++) {
> +		if (fb->format->format == vkms_wb_formats[i]) {
> +			format_supported = true;
> +			break;
> +		}
> +	}

At a minimum, this loop should be in a helper function. But more 
generally, I'm surprised that this isn't already covered by the DRM's 
atomic helpers.

Best regards
Thomas

> +
> +	if (!format_supported) {
>   		DRM_DEBUG_KMS("Invalid pixel format %p4cc\n",
>   			      &fb->format->format);
>   		return -EINVAL;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-10-18 10:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 20:16 [PATCH 0/6] Refactor the vkms to accept new formats Igor Matheus Andrade Torrente
2021-10-05 20:16 ` [PATCH 1/6] drm: vkms: Replace the deprecated drm_mode_config_init Igor Matheus Andrade Torrente
2021-10-18 10:02   ` Thomas Zimmermann
2021-10-18 18:21     ` Igor Matheus Andrade Torrente
2021-10-05 20:16 ` [PATCH 2/6] drm: vkms: Alloc the compose frame using vzalloc Igor Matheus Andrade Torrente
2021-10-05 20:16 ` [PATCH 3/6] drm: vkms: Replace hardcoded value of `vkms_composer.map` to DRM_FORMAT_MAX_PLANES Igor Matheus Andrade Torrente
2021-10-18 10:04   ` Thomas Zimmermann
2021-10-05 20:16 ` [PATCH 4/6] drm: vkms: Add fb information to `vkms_writeback_job` Igor Matheus Andrade Torrente
2021-10-18 10:10   ` Thomas Zimmermann
2021-10-05 20:16 ` [PATCH 5/6] drm: vkms: Prepare `vkms_wb_encoder_atomic_check` to accept multiple formats Igor Matheus Andrade Torrente
2021-10-18 10:14   ` Thomas Zimmermann [this message]
2021-10-18 17:41     ` Igor Matheus Andrade Torrente
2021-10-18 18:06       ` Thomas Zimmermann
2021-10-18 19:32         ` Igor Matheus Andrade Torrente
2021-10-19  7:17           ` Thomas Zimmermann
2021-10-19 19:12             ` Igor Matheus Andrade Torrente
2021-10-05 20:16 ` [PATCH 6/6] drm: vkms: Refactor the plane composer to accept new formats Igor Matheus Andrade Torrente
2021-10-05 22:20   ` kernel test robot
2021-10-05 22:20     ` kernel test robot
2021-10-05 23:18   ` kernel test robot
2021-10-05 23:18     ` kernel test robot
2021-10-05 23:36   ` kernel test robot
2021-10-05 23:36     ` kernel test robot
2021-10-18  8:30   ` Pekka Paalanen
2021-10-18 19:26     ` Igor Matheus Andrade Torrente
2021-10-19  8:05       ` Pekka Paalanen
2021-10-19 21:10         ` Igor Matheus Andrade Torrente
2021-10-20  8:25           ` Pekka Paalanen
2021-10-18  7:53 ` [PATCH 0/6] Refactor the vkms " Pekka Paalanen
2021-10-18 18:05   ` Igor Matheus Andrade Torrente

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5507450a-eb69-b24c-9f43-a1780dafbfa9@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=contact@emersion.fr \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=igormtorrente@gmail.com \
    --cc=leandro.ribeiro@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkcamp@lists.libreplanetbr.org \
    --cc=melissa.srw@gmail.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.