On Tue, Dec 08, 2015 at 04:51:18PM +0000, Dave Gordon wrote: > This patch covers a couple more places where a GEM object is (or may be) > modified by means of CPU writes, and should therefore be marked dirty to > ensure that the changes are not lost in the evenof of the object is > evicted under memory pressure. > > It may be possible to optimise these paths later, by marking only > specific pages of the object as dirty (for objects backed by shmfs > pages); but for now let's ensure correctness by dirtying the whole > object. > > Signed-off-by: Dave Gordon <david.s.gordon@xxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem.c | 4 +++- > drivers/gpu/drm/i915/i915_gem_dmabuf.c | 2 ++ > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 12f68f4..36b9539 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -937,7 +937,6 @@ i915_gem_shmem_pwrite(struct drm_device *dev, > i915_gem_object_pin_pages(obj); > > offset = args->offset; > - obj->dirty = 1; > > for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, > offset >> PAGE_SHIFT) { > @@ -1074,6 +1073,9 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, > goto out; > } > > + /* Object backing store will be out of date hereafter */ > + obj->dirty = 1; Possibly. I'd rather just have shmem_pwrite be consistent and use set_page_dirty. It is baked into the code that it doesn't access every page. > trace_i915_gem_object_pwrite(obj, args->offset, args->size); > > ret = -EFAULT; > diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c > index e9c2bfd..49a74c6 100644 > --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c > +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c > @@ -208,6 +208,8 @@ static int i915_gem_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size > return ret; > > ret = i915_gem_object_set_to_cpu_domain(obj, write); > + if (write) > + obj->dirty = 1; No. The accessor here should already be using set_page_dirty. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx