linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: dri-devel@lists.freedesktop.org,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	open list <linux-kernel@vger.kernel.org>,
	David Airlie <airlied@linux.ie>, Sean Paul <sean@poorly.run>
Subject: Re: [PATCH v2 2/6] drm: add dstclip parameter to drm_fb_memcpy()
Date: Thu, 4 Apr 2019 19:09:40 +0200	[thread overview]
Message-ID: <20190404170940.GC23897@ravnborg.org> (raw)
In-Reply-To: <20190404152430.8263-3-kraxel@redhat.com>

Hi Gerd.

Good to see these small incremental patches, and I recognize the parameter
from PATCH 1.

On Thu, Apr 04, 2019 at 05:24:26PM +0200, Gerd Hoffmann wrote:
> When set apply clipping logic to destination too.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/drm/drm_fb_helper.h        | 2 +-
>  drivers/gpu/drm/drm_fb_helper.c    | 6 ++++--
>  drivers/gpu/drm/tinydrm/mipi-dbi.c | 2 +-
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index 696017b38add..a57420f40643 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -643,6 +643,6 @@ drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
>  }
>  
>  void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
> -		   struct drm_rect *clip);
> +		   struct drm_rect *clip, bool dstclip);
>  
>  #endif
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 22d29834bbe9..fabeb408dce6 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -3363,7 +3363,7 @@ EXPORT_SYMBOL(drm_fb_helper_modinit);
>   * @dstclip: Clip destination too.
>   */
>  void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
> -		   struct drm_rect *clip)
> +		   struct drm_rect *clip, bool dstclip)

Not a huge fan of boolean parameters that decide what a simple
helper function should do.
Would have preferred two small helpers despite the small code duplication:

	drm_fb_memcpy()
	drm_fb_dstclip_memcpy()


>  {
>  	unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0);
>  	unsigned int pitch = fb->pitches[0];
> @@ -3371,10 +3371,12 @@ void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>  	size_t len = (clip->x2 - clip->x1) * cpp;
>  	unsigned int y;
>  
> +	if (dstclip)
> +		dst += (clip->y1 * pitch) + (clip->x1 * cpp);
Add newline?

>  	for (y = clip->y1; y < clip->y2; y++) {
>  		memcpy(dst, src, len);
>  		src += pitch;
> -		dst += len;
> +		dst += dstclip ? pitch : len;
>  	}
>  }
>  EXPORT_SYMBOL(drm_fb_memcpy);
> diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> index fb7e4582e293..e26fd61360a3 100644
> --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
> +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> @@ -221,7 +221,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
>  		if (swap)
>  			tinydrm_swab16(dst, src, fb, clip);
>  		else
> -			drm_fb_memcpy(dst, src, fb, clip);
> +			drm_fb_memcpy(dst, src, fb, clip, false);
>  		break;
>  	case DRM_FORMAT_XRGB8888:
>  		tinydrm_xrgb8888_to_rgb565(dst, src, fb, clip, swap);
> -- 
> 2.18.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-04-04 17:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190404152430.8263-1-kraxel@redhat.com>
2019-04-04 15:24 ` [PATCH v2 1/6] drm: move tinydrm_memcpy() to drm_fb_helper.c Gerd Hoffmann
2019-04-04 17:04   ` Sam Ravnborg
2019-04-04 18:37   ` Noralf Trønnes
2019-04-04 15:24 ` [PATCH v2 2/6] drm: add dstclip parameter to drm_fb_memcpy() Gerd Hoffmann
2019-04-04 17:09   ` Sam Ravnborg [this message]
2019-04-04 15:24 ` [PATCH v2 3/6] drm: move tinydrm_xrgb8888_to_rgb565() to drm_fb_helper.c Gerd Hoffmann
2019-04-04 17:11   ` Sam Ravnborg
2019-04-04 18:42   ` Noralf Trønnes
2019-04-04 15:24 ` [PATCH v2 4/6] drm: add dstclip parameter to drm_fb_xrgb8888_to_rgb565() Gerd Hoffmann
2019-04-04 17:17   ` Sam Ravnborg
2019-04-04 15:24 ` [PATCH v2 5/6] drm: add drm_fb_xrgb8888_to_rgb888() function to drm_fb_helper.c Gerd Hoffmann
2019-04-04 17:16   ` Sam Ravnborg
2019-04-04 15:24 ` [PATCH v2 6/6] drm/cirrus: rewrite and modernize driver Gerd Hoffmann
2019-04-04 17:41   ` Sam Ravnborg

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=20190404170940.GC23897@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    /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;
as well as URLs for NNTP newsgroup(s).