[PATCH v2 1/3] drm/panic: only draw the foreground color in drm_panic_blit()

Javier Martinez Canillas javierm at redhat.com
Fri Jun 7 09:08:04 UTC 2024


Jocelyn Falempe <jfalempe at redhat.com> writes:

Hello Jocelyn,

> The whole framebuffer is cleared, so it's useless to rewrite the
> background colored pixels. It allows to simplify the drawing
> functions, and prepare the work for the set_pixel() callback.
>
> v2:
>  * keep fg16/fg24/fg32 as variable name for the blit function.
>  * add drm_panic_is_pixel_fg() to avoid code duplication.
>  both suggested by Javier Martinez Canillas
>
> Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
> ---
>  drivers/gpu/drm/drm_panic.c | 67 +++++++++++++++++--------------------
>  1 file changed, 31 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
> index 7ece67086cec..056494ae1ede 100644
> --- a/drivers/gpu/drm/drm_panic.c
> +++ b/drivers/gpu/drm/drm_panic.c
> @@ -194,40 +194,42 @@ static u32 convert_from_xrgb8888(u32 color, u32 format)
>  /*
>   * Blit & Fill
>   */
> +/* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */
> +static bool drm_panic_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y)
> +{
> +	return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
> +}

Thanks for doing this! The code is much easier to follow now IMO.

Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat



More information about the dri-devel mailing list