From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> To: Daniel Vetter <daniel@ffwll.ch>, Haneen Mohammed <hamohammed.sa@gmail.com>, David Airlie <airlied@linux.ie>, Simon Ser <contact@emersion.fr>, Oleg Vasilev <oleg.vasilev@intel.com>, Mamta Shukla <mamtashukla555@gmail.com>, Harry Wentland <harry.wentland@amd.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/vkms: Rework blend function Date: Tue, 9 Jul 2019 22:53:06 -0300 [thread overview] Message-ID: <c5fc1e8ae57cc3a2818a92e74b5eda5becaa1cf3.1562695974.git.rodrigosiqueiramelo@gmail.com> (raw) In-Reply-To: <cover.1562695974.git.rodrigosiqueiramelo@gmail.com> [-- Attachment #1: Type: text/plain, Size: 3164 bytes --] For combining the cursor into the primary plane, vkms invokes a function named blend which iterates in both buffers and ends up by copying the cursor into the primary buffer. This patch, rework part of the blend function to prepare it for using the alpha channel for blending. Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Mamta Shukla <mamtashukla555@gmail.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> --- drivers/gpu/drm/vkms/vkms_composer.c | 39 +++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index 2317803e7320..fb106964d8bf 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -15,6 +15,17 @@ static u32 get_pixel_from_buffer(int x, int y, const u8 *buffer, return *(u32 *)&buffer[src_offset]; } +static void set_pixel(int x, int y, u8 *buffer, + const struct vkms_composer *composer, const u32 value) +{ + int offset = composer->offset + (y * composer->pitch) + + (x * composer->cpp); + u32 *dst; + + dst = (u32 *)&buffer[offset]; + *dst = value; +} + /** * compute_crc - Compute CRC value on output frame * @@ -50,7 +61,7 @@ static uint32_t compute_crc(const u8 *vaddr, * blend - belnd value at vaddr_src with value at vaddr_dst * @vaddr_dst: destination address * @vaddr_src: source address - * @dest_composer: destination framebuffer's metadata + * @dst_composer: destination framebuffer's metadata * @src_composer: source framebuffer's metadata * * Blend value at vaddr_src with value at vaddr_dst. @@ -62,11 +73,10 @@ static uint32_t compute_crc(const u8 *vaddr, * instead of overwriting it. */ static void blend(void *vaddr_dst, void *vaddr_src, - struct vkms_composer *dest_composer, + struct vkms_composer *dst_composer, struct vkms_composer *src_composer) { - int i, j, j_dst, i_dst; - int offset_src, offset_dst; + int y, x, j_dst, i_dst; int x_src = src_composer->src.x1 >> 16; int y_src = src_composer->src.y1 >> 16; @@ -79,17 +89,16 @@ static void blend(void *vaddr_dst, void *vaddr_src, int y_limit = y_src + h_dst; int x_limit = x_src + w_dst; - for (i = y_src, i_dst = y_dst; i < y_limit; ++i) { - for (j = x_src, j_dst = x_dst; j < x_limit; ++j) { - offset_dst = dest_composer->offset - + (i_dst * dest_composer->pitch) - + (j_dst++ * dest_composer->cpp); - offset_src = src_composer->offset - + (i * src_composer->pitch) - + (j * src_composer->cpp); - - memcpy(vaddr_dst + offset_dst, - vaddr_src + offset_src, sizeof(u32)); + u32 pixel_src; + + for (y = y_src, i_dst = y_dst; y < y_limit; ++y) { + for (x = x_src, j_dst = x_dst; x < x_limit; ++x) { + pixel_src = get_pixel_from_buffer(x, y, + vaddr_src, + src_composer); + set_pixel(j_dst, i_dst, vaddr_dst, dest_composer, + pixel_src); + j_dst++; } i_dst++; } -- 2.21.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> To: Daniel Vetter <daniel@ffwll.ch>, Haneen Mohammed <hamohammed.sa@gmail.com>, David Airlie <airlied@linux.ie>, Simon Ser <contact@emersion.fr>, Oleg Vasilev <oleg.vasilev@intel.com>, Mamta Shukla <mamtashukla555@gmail.com>, Harry Wentland <harry.wentland@amd.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/vkms: Rework blend function Date: Tue, 9 Jul 2019 22:53:06 -0300 [thread overview] Message-ID: <c5fc1e8ae57cc3a2818a92e74b5eda5becaa1cf3.1562695974.git.rodrigosiqueiramelo@gmail.com> (raw) In-Reply-To: <cover.1562695974.git.rodrigosiqueiramelo@gmail.com> [-- Attachment #1.1: Type: text/plain, Size: 3164 bytes --] For combining the cursor into the primary plane, vkms invokes a function named blend which iterates in both buffers and ends up by copying the cursor into the primary buffer. This patch, rework part of the blend function to prepare it for using the alpha channel for blending. Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Mamta Shukla <mamtashukla555@gmail.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> --- drivers/gpu/drm/vkms/vkms_composer.c | 39 +++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index 2317803e7320..fb106964d8bf 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -15,6 +15,17 @@ static u32 get_pixel_from_buffer(int x, int y, const u8 *buffer, return *(u32 *)&buffer[src_offset]; } +static void set_pixel(int x, int y, u8 *buffer, + const struct vkms_composer *composer, const u32 value) +{ + int offset = composer->offset + (y * composer->pitch) + + (x * composer->cpp); + u32 *dst; + + dst = (u32 *)&buffer[offset]; + *dst = value; +} + /** * compute_crc - Compute CRC value on output frame * @@ -50,7 +61,7 @@ static uint32_t compute_crc(const u8 *vaddr, * blend - belnd value at vaddr_src with value at vaddr_dst * @vaddr_dst: destination address * @vaddr_src: source address - * @dest_composer: destination framebuffer's metadata + * @dst_composer: destination framebuffer's metadata * @src_composer: source framebuffer's metadata * * Blend value at vaddr_src with value at vaddr_dst. @@ -62,11 +73,10 @@ static uint32_t compute_crc(const u8 *vaddr, * instead of overwriting it. */ static void blend(void *vaddr_dst, void *vaddr_src, - struct vkms_composer *dest_composer, + struct vkms_composer *dst_composer, struct vkms_composer *src_composer) { - int i, j, j_dst, i_dst; - int offset_src, offset_dst; + int y, x, j_dst, i_dst; int x_src = src_composer->src.x1 >> 16; int y_src = src_composer->src.y1 >> 16; @@ -79,17 +89,16 @@ static void blend(void *vaddr_dst, void *vaddr_src, int y_limit = y_src + h_dst; int x_limit = x_src + w_dst; - for (i = y_src, i_dst = y_dst; i < y_limit; ++i) { - for (j = x_src, j_dst = x_dst; j < x_limit; ++j) { - offset_dst = dest_composer->offset - + (i_dst * dest_composer->pitch) - + (j_dst++ * dest_composer->cpp); - offset_src = src_composer->offset - + (i * src_composer->pitch) - + (j * src_composer->cpp); - - memcpy(vaddr_dst + offset_dst, - vaddr_src + offset_src, sizeof(u32)); + u32 pixel_src; + + for (y = y_src, i_dst = y_dst; y < y_limit; ++y) { + for (x = x_src, j_dst = x_dst; x < x_limit; ++x) { + pixel_src = get_pixel_from_buffer(x, y, + vaddr_src, + src_composer); + set_pixel(j_dst, i_dst, vaddr_dst, dest_composer, + pixel_src); + j_dst++; } i_dst++; } -- 2.21.0 [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 159 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-07-10 1:53 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-10 1:52 [PATCH 0/2] drm/vkms: Use alpha value for blending Rodrigo Siqueira 2019-07-10 1:52 ` Rodrigo Siqueira 2019-07-10 1:53 ` Rodrigo Siqueira [this message] 2019-07-10 1:53 ` [PATCH 1/2] drm/vkms: Rework blend function Rodrigo Siqueira 2019-07-10 1:54 ` [PATCH 2/2] drm/vkms: Use alpha channel for blending cursor with primary Rodrigo Siqueira 2019-07-10 16:46 ` [PATCH 0/2] drm/vkms: Use alpha value for blending Daniel Vetter 2019-07-10 16:46 ` Daniel Vetter
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=c5fc1e8ae57cc3a2818a92e74b5eda5becaa1cf3.1562695974.git.rodrigosiqueiramelo@gmail.com \ --to=rodrigosiqueiramelo@gmail.com \ --cc=airlied@linux.ie \ --cc=contact@emersion.fr \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=hamohammed.sa@gmail.com \ --cc=harry.wentland@amd.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mamtashukla555@gmail.com \ --cc=oleg.vasilev@intel.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: linkBe 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.