public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Brian Starkey <brian.starkey@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Haneen Mohammed <hamohammed.sa@gmail.com>,
	Simon Ser <contact@emersion.fr>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/5] drm/vkms: Move functions from vkms_crc to vkms_composer
Date: Tue, 18 Jun 2019 11:27:14 +0200	[thread overview]
Message-ID: <20190618092714.GP12905@phenom.ffwll.local> (raw)
In-Reply-To: <408a662d504db1cfe13919688a4e9f7f7a6d8489.1560820888.git.rodrigosiqueiramelo@gmail.com>

On Mon, Jun 17, 2019 at 11:42:33PM -0300, Rodrigo Siqueira wrote:
> The vkms_crc file has functions related to compose operations which are
> not directly associated with CRC. This patch, move those function for a
> new file named vkms_composer.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>

I guess my suggestion wasn't quite clear: I thought we should rename the
entire file from vkms_crc.c to vkms_composor.c. And then adjust functions
and datastructures to use vkms_composer instead of vkms_crc as the prefix.
-Daniel

> ---
>  drivers/gpu/drm/vkms/Makefile        |  9 +++-
>  drivers/gpu/drm/vkms/vkms_composer.c | 69 ++++++++++++++++++++++++++++
>  drivers/gpu/drm/vkms/vkms_composer.h | 12 +++++
>  drivers/gpu/drm/vkms/vkms_crc.c      | 65 +-------------------------
>  4 files changed, 90 insertions(+), 65 deletions(-)
>  create mode 100644 drivers/gpu/drm/vkms/vkms_composer.c
>  create mode 100644 drivers/gpu/drm/vkms/vkms_composer.h
> 
> diff --git a/drivers/gpu/drm/vkms/Makefile b/drivers/gpu/drm/vkms/Makefile
> index 89f09bec7b23..b4c040854bd6 100644
> --- a/drivers/gpu/drm/vkms/Makefile
> +++ b/drivers/gpu/drm/vkms/Makefile
> @@ -1,4 +1,11 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -vkms-y := vkms_drv.o vkms_plane.o vkms_output.o vkms_crtc.o vkms_gem.o vkms_crc.o
> +vkms-y := \
> +	vkms_drv.o \
> +	vkms_plane.o \
> +	vkms_output.o \
> +	vkms_crtc.o \
> +	vkms_gem.o \
> +	vkms_composer.o \
> +	vkms_crc.o
>  
>  obj-$(CONFIG_DRM_VKMS) += vkms.o
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> new file mode 100644
> index 000000000000..3d7c5e316d6e
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +#include "vkms_drv.h"
> +#include "vkms_composer.h"
> +#include <drm/drm_gem_framebuffer_helper.h>
> +
> +/**
> + * blend - belnd value at vaddr_src with value at vaddr_dst
> + * @vaddr_dst: destination address
> + * @vaddr_src: source address
> + * @dest: destination framebuffer's metadata
> + * @src: source framebuffer's metadata
> + *
> + * Blend value at vaddr_src with value at vaddr_dst.
> + * Currently, this function write value at vaddr_src on value
> + * at vaddr_dst using buffer's metadata to locate the new values
> + * from vaddr_src and their distenation at vaddr_dst.
> + *
> + * Todo: Use the alpha value to blend vaddr_src with vaddr_dst
> + *	 instead of overwriting it.
> + */
> +void blend(void *vaddr_dst, void *vaddr_src, struct vkms_crc_data *dest,
> +	   struct vkms_crc_data *src)
> +{
> +	int i, j, j_dst, i_dst;
> +	int offset_src, offset_dst;
> +
> +	int x_src = src->src.x1 >> 16;
> +	int y_src = src->src.y1 >> 16;
> +
> +	int x_dst = src->dst.x1;
> +	int y_dst = src->dst.y1;
> +	int h_dst = drm_rect_height(&src->dst);
> +	int w_dst = drm_rect_width(&src->dst);
> +
> +	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->offset
> +				     + (i_dst * dest->pitch)
> +				     + (j_dst++ * dest->cpp);
> +			offset_src = src->offset
> +				     + (i * src->pitch)
> +				     + (j * src->cpp);
> +
> +			memcpy(vaddr_dst + offset_dst,
> +			       vaddr_src + offset_src, sizeof(u32));
> +		}
> +		i_dst++;
> +	}
> +}
> +
> +void compose_cursor(struct vkms_crc_data *cursor,
> +		    struct vkms_crc_data *primary, void *vaddr_out)
> +{
> +	struct drm_gem_object *cursor_obj;
> +	struct vkms_gem_object *cursor_vkms_obj;
> +
> +	cursor_obj = drm_gem_fb_get_obj(&cursor->fb, 0);
> +	cursor_vkms_obj = drm_gem_to_vkms_gem(cursor_obj);
> +
> +	if (WARN_ON(!cursor_vkms_obj->vaddr))
> +		return;
> +
> +	blend(vaddr_out, cursor_vkms_obj->vaddr, primary, cursor);
> +}
> +
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.h b/drivers/gpu/drm/vkms/vkms_composer.h
> new file mode 100644
> index 000000000000..53fdee17a632
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_composer.h
> @@ -0,0 +1,12 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +
> +#ifndef _VKMS_COMPOSER_H_
> +#define _VKMS_COMPOSER_H_
> +
> +void blend(void *vaddr_dst, void *vaddr_src, struct vkms_crc_data *dest,
> +	   struct vkms_crc_data *src);
> +
> +void compose_cursor(struct vkms_crc_data *cursor,
> +		    struct vkms_crc_data *primary, void *vaddr_out);
> +
> +#endif /* _VKMS_COMPOSER_H_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
> index 4b3146d83265..3c6a35aba494 100644
> --- a/drivers/gpu/drm/vkms/vkms_crc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crc.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  
>  #include "vkms_drv.h"
> +#include "vkms_composer.h"
>  #include <linux/crc32.h>
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
> @@ -39,70 +40,6 @@ static uint32_t compute_crc(void *vaddr_out, struct vkms_crc_data *crc_out)
>  	return crc;
>  }
>  
> -/**
> - * blend - belnd value at vaddr_src with value at vaddr_dst
> - * @vaddr_dst: destination address
> - * @vaddr_src: source address
> - * @crc_dst: destination framebuffer's metadata
> - * @crc_src: source framebuffer's metadata
> - *
> - * Blend value at vaddr_src with value at vaddr_dst.
> - * Currently, this function write value at vaddr_src on value
> - * at vaddr_dst using buffer's metadata to locate the new values
> - * from vaddr_src and their distenation at vaddr_dst.
> - *
> - * Todo: Use the alpha value to blend vaddr_src with vaddr_dst
> - *	 instead of overwriting it.
> - */
> -static void blend(void *vaddr_dst, void *vaddr_src,
> -		  struct vkms_crc_data *crc_dst,
> -		  struct vkms_crc_data *crc_src)
> -{
> -	int i, j, j_dst, i_dst;
> -	int offset_src, offset_dst;
> -
> -	int x_src = crc_src->src.x1 >> 16;
> -	int y_src = crc_src->src.y1 >> 16;
> -
> -	int x_dst = crc_src->dst.x1;
> -	int y_dst = crc_src->dst.y1;
> -	int h_dst = drm_rect_height(&crc_src->dst);
> -	int w_dst = drm_rect_width(&crc_src->dst);
> -
> -	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 = crc_dst->offset
> -				     + (i_dst * crc_dst->pitch)
> -				     + (j_dst++ * crc_dst->cpp);
> -			offset_src = crc_src->offset
> -				     + (i * crc_src->pitch)
> -				     + (j * crc_src->cpp);
> -
> -			memcpy(vaddr_dst + offset_dst,
> -			       vaddr_src + offset_src, sizeof(u32));
> -		}
> -		i_dst++;
> -	}
> -}
> -
> -static void compose_cursor(struct vkms_crc_data *cursor_crc,
> -			   struct vkms_crc_data *primary_crc, void *vaddr_out)
> -{
> -	struct drm_gem_object *cursor_obj;
> -	struct vkms_gem_object *cursor_vkms_obj;
> -
> -	cursor_obj = drm_gem_fb_get_obj(&cursor_crc->fb, 0);
> -	cursor_vkms_obj = drm_gem_to_vkms_gem(cursor_obj);
> -
> -	if (WARN_ON(!cursor_vkms_obj->vaddr))
> -		return;
> -
> -	blend(vaddr_out, cursor_vkms_obj->vaddr, primary_crc, cursor_crc);
> -}
> -
>  static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc,
>  			      struct vkms_crc_data *cursor_crc)
>  {
> -- 
> 2.21.0

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2019-06-18  9:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  2:41 [PATCH V2 0/5] drm/vkms: Introduces writeback support Rodrigo Siqueira
2019-06-18  2:42 ` [PATCH V2 1/5] drm/vkms: Move functions from vkms_crc to vkms_composer Rodrigo Siqueira
2019-06-18  9:27   ` Daniel Vetter [this message]
2019-06-18  2:43 ` [PATCH V2 2/5] drm/vkms: Rename crc_enabled to composer_enabled Rodrigo Siqueira
2019-06-18  2:45 ` [PATCH V2 3/5] drm/vkms: Rename vkms_crc_data to vkms_data Rodrigo Siqueira
2019-06-18  2:45 ` [PATCH V2 4/5] drm/vkms: Use index instead of 0 in possible crtc Rodrigo Siqueira
2019-06-18  7:56   ` Simon Ser
2019-06-18 11:09     ` Daniel Vetter
2019-06-18  9:29   ` Daniel Vetter
2019-06-18  2:45 ` [PATCH V2 5/5] drm/vkms: Add support for writeback Rodrigo Siqueira
2019-06-18  9:33   ` Daniel Vetter
2019-06-18 22:10     ` Rodrigo Siqueira

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=20190618092714.GP12905@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=brian.starkey@arm.com \
    --cc=contact@emersion.fr \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox