aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorDave Gordon <david.s.gordon@intel.com>2015-12-10 13:51:24 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-12-11 12:20:19 -0500
commit9e7d18c08a4ec3b76b6a0994e93258decb250fbe (patch)
tree60077e145dbafefaa287eb6d31f6bbec73324c0f /drivers/gpu/drm/i915/i915_gem.c
parent033908aed5a596f6202c848c6bbc8a40fb1a8490 (diff)
drm/i915: mark a newly-created GEM object dirty when filled with data
When creating a new (pageable) GEM object and filling it with data, we must mark it as 'dirty', i.e. backing store is out-of-date w.r.t. the newly-written content. This ensures that if the object is evicted under memory pressure, its pages in the pagecache will be written to backing store rather than discarded. Based on an original version by Alex Dai. Signed-off-by: Alex Dai <yu.dai@intel.com> Signed-off-by: Dave Gordon <david.s.gordon@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/1449773486-30822-3-git-send-email-david.s.gordon@intel.com Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1592c5479463..47f6a8244151 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5225,6 +5225,7 @@ i915_gem_object_create_from_data(struct drm_device *dev,
5225 i915_gem_object_pin_pages(obj); 5225 i915_gem_object_pin_pages(obj);
5226 sg = obj->pages; 5226 sg = obj->pages;
5227 bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); 5227 bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size);
5228 obj->dirty = 1; /* Backing store is now out of date */
5228 i915_gem_object_unpin_pages(obj); 5229 i915_gem_object_unpin_pages(obj);
5229 5230
5230 if (WARN_ON(bytes != size)) { 5231 if (WARN_ON(bytes != size)) {