lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5507450a-eb69-b24c-9f43-a1780dafbfa9@suse.de>
Date:   Mon, 18 Oct 2021 12:14:52 +0200
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Igor Matheus Andrade Torrente <igormtorrente@...il.com>,
        rodrigosiqueiramelo@...il.com, melissa.srw@...il.com
Cc:     hamohammed.sa@...il.com, daniel@...ll.ch, airlied@...ux.ie,
        contact@...rsion.fr, leandro.ribeiro@...labora.com,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        lkcamp@...ts.libreplanetbr.org
Subject: Re: [PATCH 5/6] drm: vkms: Prepare `vkms_wb_encoder_atomic_check` to
 accept multiple formats

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@...il.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

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ