Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] lib/igt_draw: Use device coherent and cpu coherent mappings for draw methods.
Date: Tue, 19 Oct 2021 13:09:26 +0300	[thread overview]
Message-ID: <YW6ZVoESdqRdYwPG@intel.com> (raw)
In-Reply-To: <20211019094030.553874-2-maarten.lankhorst@linux.intel.com>

On Tue, Oct 19, 2021 at 11:40:30AM +0200, Maarten Lankhorst wrote:
> This will allow kms_frontbuffer_tracking to draw buffers for frontbuffer tracking on dg1.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  lib/igt_draw.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_draw.c b/lib/igt_draw.c
> index da1d39fcba95..62ca4761a9f2 100644
> --- a/lib/igt_draw.c
> +++ b/lib/igt_draw.c
> @@ -341,8 +341,8 @@ static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect,
>  	if (tiling != I915_TILING_NONE)
>  		igt_require(intel_display_ver(intel_get_drm_devid(fd)) >= 5);
>  
> -	ptr = gem_mmap__cpu(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
> -			    PROT_READ | PROT_WRITE);
> +	ptr = gem_mmap__cpu_coherent(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
> +				     PROT_READ | PROT_WRITE);
>  
>  	switch (tiling) {
>  	case I915_TILING_NONE:
> @@ -391,8 +391,8 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
>  	if (tiling != I915_TILING_NONE)
>  		igt_require(intel_display_ver(intel_get_drm_devid(fd)) >= 5);
>  
> -	ptr = gem_mmap__wc(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
> -			   PROT_READ | PROT_WRITE);
> +	ptr = gem_mmap__device_coherent(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
> +					PROT_READ | PROT_WRITE);

That seems to have a silent fallback to mmap_gtt, so on
first blush this does not seem to have 100% identical
behaviour anymore.

Then again gem_mmap__wc() should assert if you attempt to
use it on a machine that doesn't support WC mmaps. So I guess
it ends up being the same in practice? Maybe we should have an
assert in draw_rect_mmap_wc() that either lmem or wc mmap is
available?

Or maybe we don't want to conflate mmap_wc and mmap_fixed
(which I guess is some code for "lmem"?) and instead igt_draw
should have separate methods for each?

>  
>  	switch (tiling) {
>  	case I915_TILING_NONE:
> -- 
> 2.33.0

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2021-10-19 10:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  9:40 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: create i915 bo in lmem, if available Maarten Lankhorst
2021-10-19  9:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_draw: Use device coherent and cpu coherent mappings for draw methods Maarten Lankhorst
2021-10-19 10:09   ` Ville Syrjälä [this message]
2021-10-19 10:55     ` Maarten Lankhorst
2021-10-19 10:02 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: create i915 bo in lmem, if available Ville Syrjälä
2021-10-20 13:29   ` Maarten Lankhorst
2021-10-19 11:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2021-10-19 14:22 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=YW6ZVoESdqRdYwPG@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.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: 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