From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Extract checking for backing struct pages to a helper
Date: Mon, 20 Jun 2016 13:12:49 +0100 [thread overview]
Message-ID: <5767DDC1.7080201@linux.intel.com> (raw)
In-Reply-To: <1466415111-29671-2-git-send-email-chris@chris-wilson.co.uk>
On 20/06/16 10:31, Chris Wilson wrote:
> Currently to see if an object is backed by struct pages (as opposed to
> being a simple pointer to stolen memory, for example) we do a manual
> check on the obj->ops->flags. This is quite shouty and before adding
> more checks in future, we should make it a bit calmer.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 6 ++++++
> drivers/gpu/drm/i915/i915_gem.c | 4 ++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 25ebe4660764..48928227bdcc 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2266,6 +2266,12 @@ struct drm_i915_gem_object {
> };
> #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
>
> +static inline bool
> +i915_gem_object_has_struct_page(const struct drm_i915_gem_object *obj)
> +{
> + return obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE;
> +}
> +
> /*
> * Optimised SGL iterator for GEM objects
> */
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 21d0dea57312..7f6879cc82fb 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -508,7 +508,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
>
> *needs_clflush = 0;
>
> - if (WARN_ON((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0))
> + if (WARN_ON(!i915_gem_object_has_struct_page(obj)))
> return -EINVAL;
>
> if (!(obj->base.read_domains & I915_GEM_DOMAIN_CPU)) {
> @@ -5528,7 +5528,7 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n)
> struct page *page;
>
> /* Only default objects have per-page dirty tracking */
> - if (WARN_ON((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0))
> + if (WARN_ON(!i915_gem_object_has_struct_page(obj)))
> return NULL;
>
> page = i915_gem_object_get_page(obj, n);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-06-20 12:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 9:31 Enable pread/pwrite for prime objects Chris Wilson
2016-06-20 9:31 ` [PATCH 1/2] drm/i915: Extract checking for backing struct pages to a helper Chris Wilson
2016-06-20 12:12 ` Tvrtko Ursulin [this message]
2016-06-20 9:31 ` [PATCH 2/2] drm/i915: pwrite/pread do not require obj->base.filp, just pages Chris Wilson
2016-06-20 12:14 ` Tvrtko Ursulin
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=5767DDC1.7080201@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--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