<div dir="ltr">Apparently this patch was blocking other teams that were pinging us at irc and with 2 rv-b, 2 tested-by and ci success I merged this patch.<div>However other 2 patches in this series are still pending review so not merged.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 29, 2016 at 8:49 AM Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">commit 033908aed5a596f6202c848c6bbc8a40fb1a8490<br>
Author: Dave Gordon <<a href="mailto:david.s.gordon@intel.com" target="_blank">david.s.gordon@intel.com</a>><br>
Date: Thu Dec 10 18:51:23 2015 +0000<br>
<br>
drm/i915: mark GEM object pages dirty when mapped & written by the CPU<br>
<br>
introduced a check into i915_gem_object_get_dirty_pages() that returned<br>
a NULL pointer when called with a bad object, one that was not backed by<br>
shmemfs. This WARN was too strict as we can work on all struct page<br>
backed objects, and resulted in a WARN + GPF for existing userspace. In<br>
order to differentiate the various types of objects, add a new flags field<br>
to the i915_gem_object_ops struct to describe their capabilities, with<br>
the first flag being whether the object has struct pages.<br>
<br>
v2: Drop silly const before an integer in the structure declaration.<br>
<br>
Testcase: igt/gem_userptr_blits/relocations<br>
Reported-and-tested-by: Kristian Høgsberg Kristensen <<a href="mailto:krh@bitplanet.net" target="_blank">krh@bitplanet.net</a>><br>
Signed-off-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>><br>
Cc: Dave Gordon <<a href="mailto:david.s.gordon@intel.com" target="_blank">david.s.gordon@intel.com</a>><br>
Cc: Kristian Høgsberg Kristensen <<a href="mailto:krh@bitplanet.net" target="_blank">krh@bitplanet.net</a>><br>
Cc: Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch" target="_blank">daniel.vetter@ffwll.ch</a>><br>
Reviewed-by: Dave Gordon <<a href="mailto:david.s.gordon@intel.com" target="_blank">david.s.gordon@intel.com</a>><br>
Reviewed-by: Kristian Høgsberg Kristensen <<a href="mailto:krh@bitplanet.net" target="_blank">krh@bitplanet.net</a>><br>
---<br>
drivers/gpu/drm/i915/i915_drv.h | 4 ++++<br>
drivers/gpu/drm/i915/i915_gem.c | 3 ++-<br>
drivers/gpu/drm/i915/i915_gem_userptr.c | 3 ++-<br>
3 files changed, 8 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h<br>
index 905e90f25957..a2d2f08b7515 100644<br>
--- a/drivers/gpu/drm/i915/i915_drv.h<br>
+++ b/drivers/gpu/drm/i915/i915_drv.h<br>
@@ -2000,6 +2000,9 @@ enum hdmi_force_audio {<br>
#define I915_GTT_OFFSET_NONE ((u32)-1)<br>
<br>
struct drm_i915_gem_object_ops {<br>
+ unsigned int flags;<br>
+#define I915_GEM_OBJECT_HAS_STRUCT_PAGE 0x1<br>
+<br>
/* Interface between the GEM object and its backing storage.<br>
* get_pages() is called once prior to the use of the associated set<br>
* of pages before to binding them into the GTT, and put_pages() is<br>
@@ -2015,6 +2018,7 @@ struct drm_i915_gem_object_ops {<br>
*/<br>
int (*get_pages)(struct drm_i915_gem_object *);<br>
void (*put_pages)(struct drm_i915_gem_object *);<br>
+<br>
int (*dmabuf_export)(struct drm_i915_gem_object *);<br>
void (*release)(struct drm_i915_gem_object *);<br>
};<br>
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c<br>
index a928823507c5..e9b19bca1383 100644<br>
--- a/drivers/gpu/drm/i915/i915_gem.c<br>
+++ b/drivers/gpu/drm/i915/i915_gem.c<br>
@@ -4465,6 +4465,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,<br>
}<br>
<br>
static const struct drm_i915_gem_object_ops i915_gem_object_ops = {<br>
+ .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE,<br>
.get_pages = i915_gem_object_get_pages_gtt,<br>
.put_pages = i915_gem_object_put_pages_gtt,<br>
};<br>
@@ -5309,7 +5310,7 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n)<br>
struct page *page;<br>
<br>
/* Only default objects have per-page dirty tracking */<br>
- if (WARN_ON(obj->ops != &i915_gem_object_ops))<br>
+ if (WARN_ON((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0))<br>
return NULL;<br>
<br>
page = i915_gem_object_get_page(obj, n);<br>
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c<br>
index 74a4d1714879..7107f2fd38f5 100644<br>
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c<br>
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c<br>
@@ -708,9 +708,10 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj)<br>
}<br>
<br>
static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = {<br>
- .dmabuf_export = i915_gem_userptr_dmabuf_export,<br>
+ .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE,<br>
.get_pages = i915_gem_userptr_get_pages,<br>
.put_pages = i915_gem_userptr_put_pages,<br>
+ .dmabuf_export = i915_gem_userptr_dmabuf_export,<br>
.release = i915_gem_userptr_release,<br>
};<br>
<br>
--<br>
2.7.0<br>
<br>
_______________________________________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org" target="_blank">Intel-gfx@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
</blockquote></div>