From: Dave Gordon Date: Thu, 10 Dec 2015 18:51:24 +0000 (+0000) Subject: drm/i915: mark a newly-created GEM object dirty when filled with data X-Git-Tag: v5.15~14379^2~18^2~42 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9e7d18c08a4ec3b76b6a0994e93258decb250fbe;p=mirror_ubuntu-kernels.git 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 Signed-off-by: Dave Gordon Cc: Chris Wilson Link: http://patchwork.freedesktop.org/patch/msgid/1449773486-30822-3-git-send-email-david.s.gordon@intel.com Reviewed-by: Chris Wilson Signed-off-by: Daniel Vetter --- 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, i915_gem_object_pin_pages(obj); sg = obj->pages; bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); + obj->dirty = 1; /* Backing store is now out of date */ i915_gem_object_unpin_pages(obj); if (WARN_ON(bytes != size)) {