From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Dongwon Kim <dongwon.kim@intel.com>
Subject: Re: [PATCH] drm/i915: Split obj->cache_coherent to track r/w
Date: Fri, 11 Aug 2017 11:08:39 +0300 [thread overview]
Message-ID: <1502438919.3582.14.camel@linux.intel.com> (raw)
In-Reply-To: <20170810162035.30547-1-chris@chris-wilson.co.uk>
On to, 2017-08-10 at 17:20 +0100, Chris Wilson wrote:
> Another month, another story in the cache coherency saga. This time, we
> come to the realisation that i915_gem_object_is_coherent() has been
> reporting whether we can read from the target without requiring a cache
> invalidate; but we were using it in places for testing whether we could
> write into the object without requiring a cache flush. So split the
> tracking into two, one to decide before reads, one after writes.
>
> See commit e27ab73d17ef ("drm/i915: Mark CPU cache as dirty on every
> transition for CPU writes") for the previous step in this saga.
>
> Testcase: igt/kms_mmap_write_crc
> Testcase: igt/kms_pwrite_crc
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Dongwon Kim <dongwon.kim@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
<SNIP>
> +++ b/drivers/gpu/drm/i915/i915_gem_object.c
> @@ -0,0 +1,44 @@
> +/*
> + * Copyright © 2017 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include "i915_drv.h"
> +#include "i915_gem_object.h"
> +
Kerneldoc for the two following functions needed.
> +static inline bool
> +i915_gem_object_is_coherent(struct drm_i915_gem_object *obj, bool write)
> +{
> + if (obj->cache_level != I915_CACHE_NONE)
> + return true;
> +
> + return !write && HAS_LLC(to_i915(obj->base.dev));
> +}
> +
> +void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
> + unsigned int cache_level)
> +{
> + obj->cache_level = cache_level;
> + obj->cache_coherent_r = i915_gem_object_is_coherent(obj, false);
> + obj->cache_coherent_w = i915_gem_object_is_coherent(obj, true);
> + obj->cache_dirty = !obj->cache_coherent_w;
> +}
>
Other than that, it seems OK. Although READ / WRITE might be more
explicit than true / false.
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-08-11 8:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 16:20 [PATCH] drm/i915: Split obj->cache_coherent to track r/w Chris Wilson
2017-08-10 16:53 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-11 7:26 ` [PATCH] " Maarten Lankhorst
2017-08-11 8:08 ` Joonas Lahtinen [this message]
2017-08-11 10:11 ` [PATCH v2] " Chris Wilson
2017-08-11 11:12 ` Chris Wilson
2017-08-11 10:23 ` [PATCH v3] " Chris Wilson
2017-08-11 10:55 ` ✗ Fi.CI.BAT: failure for drm/i915: Split obj->cache_coherent to track r/w (rev3) Patchwork
2017-08-11 11:11 ` [PATCH v4] drm/i915: Split obj->cache_coherent to track r/w Chris Wilson
2017-08-15 14:34 ` Joonas Lahtinen
2017-08-15 14:51 ` Chris Wilson
2017-08-11 11:44 ` ✓ Fi.CI.BAT: success for drm/i915: Split obj->cache_coherent to track r/w (rev4) 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=1502438919.3582.14.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=dongwon.kim@intel.com \
--cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox