From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
linux-kernel@vger.kernel.org
Cc: "David Airlie" <airlied@linux.ie>,
"Noralf Trønnes" <noralf@tronnes.org>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/repaper: Use format helper for xrgb8888 to monochrome conversion
Date: Wed, 23 Feb 2022 20:40:29 +0100 [thread overview]
Message-ID: <6335cf1d-41fc-1854-3916-2cdbd1337c1c@suse.de> (raw)
In-Reply-To: <20220223193735.213185-1-javierm@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2294 bytes --]
Hi
Am 23.02.22 um 20:37 schrieb Javier Martinez Canillas:
> There is now a drm_fb_xrgb8888_to_mono_reversed() helper function to do
> format conversion from XRGB8888 to reversed monochrome.
>
> Use that helper and remove the open coded version in the repaper driver.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Looks good.
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>
> This was only built tested because I don't have access to the hardware.
>
> drivers/gpu/drm/tiny/repaper.c | 24 +-----------------------
> 1 file changed, 1 insertion(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> index 97a775c48cea..5c74e236b16d 100644
> --- a/drivers/gpu/drm/tiny/repaper.c
> +++ b/drivers/gpu/drm/tiny/repaper.c
> @@ -508,26 +508,6 @@ static void repaper_get_temperature(struct repaper_epd *epd)
> epd->factored_stage_time = epd->stage_time * factor10x / 10;
> }
>
> -static void repaper_gray8_to_mono_reversed(u8 *buf, u32 width, u32 height)
> -{
> - u8 *gray8 = buf, *mono = buf;
> - int y, xb, i;
> -
> - for (y = 0; y < height; y++)
> - for (xb = 0; xb < width / 8; xb++) {
> - u8 byte = 0x00;
> -
> - for (i = 0; i < 8; i++) {
> - int x = xb * 8 + i;
> -
> - byte >>= 1;
> - if (gray8[y * width + x] >> 7)
> - byte |= BIT(7);
> - }
> - *mono++ = byte;
> - }
> -}
> -
> static int repaper_fb_dirty(struct drm_framebuffer *fb)
> {
> struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
> @@ -560,12 +540,10 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb)
> if (ret)
> goto out_free;
>
> - drm_fb_xrgb8888_to_gray8(buf, 0, cma_obj->vaddr, fb, &clip);
> + drm_fb_xrgb8888_to_mono_reversed(buf, 0, cma_obj->vaddr, fb, &clip);
>
> drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
>
> - repaper_gray8_to_mono_reversed(buf, fb->width, fb->height);
> -
> if (epd->partial) {
> repaper_frame_data_repeat(epd, buf, epd->current_frame,
> REPAPER_NORMAL);
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
linux-kernel@vger.kernel.org
Cc: "David Airlie" <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
"Noralf Trønnes" <noralf@tronnes.org>
Subject: Re: [PATCH] drm/repaper: Use format helper for xrgb8888 to monochrome conversion
Date: Wed, 23 Feb 2022 20:40:29 +0100 [thread overview]
Message-ID: <6335cf1d-41fc-1854-3916-2cdbd1337c1c@suse.de> (raw)
In-Reply-To: <20220223193735.213185-1-javierm@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2294 bytes --]
Hi
Am 23.02.22 um 20:37 schrieb Javier Martinez Canillas:
> There is now a drm_fb_xrgb8888_to_mono_reversed() helper function to do
> format conversion from XRGB8888 to reversed monochrome.
>
> Use that helper and remove the open coded version in the repaper driver.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Looks good.
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>
> This was only built tested because I don't have access to the hardware.
>
> drivers/gpu/drm/tiny/repaper.c | 24 +-----------------------
> 1 file changed, 1 insertion(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> index 97a775c48cea..5c74e236b16d 100644
> --- a/drivers/gpu/drm/tiny/repaper.c
> +++ b/drivers/gpu/drm/tiny/repaper.c
> @@ -508,26 +508,6 @@ static void repaper_get_temperature(struct repaper_epd *epd)
> epd->factored_stage_time = epd->stage_time * factor10x / 10;
> }
>
> -static void repaper_gray8_to_mono_reversed(u8 *buf, u32 width, u32 height)
> -{
> - u8 *gray8 = buf, *mono = buf;
> - int y, xb, i;
> -
> - for (y = 0; y < height; y++)
> - for (xb = 0; xb < width / 8; xb++) {
> - u8 byte = 0x00;
> -
> - for (i = 0; i < 8; i++) {
> - int x = xb * 8 + i;
> -
> - byte >>= 1;
> - if (gray8[y * width + x] >> 7)
> - byte |= BIT(7);
> - }
> - *mono++ = byte;
> - }
> -}
> -
> static int repaper_fb_dirty(struct drm_framebuffer *fb)
> {
> struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
> @@ -560,12 +540,10 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb)
> if (ret)
> goto out_free;
>
> - drm_fb_xrgb8888_to_gray8(buf, 0, cma_obj->vaddr, fb, &clip);
> + drm_fb_xrgb8888_to_mono_reversed(buf, 0, cma_obj->vaddr, fb, &clip);
>
> drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
>
> - repaper_gray8_to_mono_reversed(buf, fb->width, fb->height);
> -
> if (epd->partial) {
> repaper_frame_data_repeat(epd, buf, epd->current_frame,
> REPAPER_NORMAL);
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2022-02-23 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 19:37 [PATCH] drm/repaper: Use format helper for xrgb8888 to monochrome conversion Javier Martinez Canillas
2022-02-23 19:37 ` Javier Martinez Canillas
2022-02-23 19:40 ` Thomas Zimmermann [this message]
2022-02-23 19:40 ` Thomas Zimmermann
2022-02-24 14:04 ` Noralf Trønnes
2022-02-24 14:04 ` Noralf Trønnes
2022-02-24 14:13 ` Javier Martinez Canillas
2022-02-24 14:13 ` Javier Martinez Canillas
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=6335cf1d-41fc-1854-3916-2cdbd1337c1c@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=noralf@tronnes.org \
/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.