[Intel-gfx] [PATCH 3/7] drm/i915: Allow page pinning to be in the background

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 6 15:38:47 UTC 2019


Quoting Matthew Auld (2019-06-05 15:03:03)
> On Mon, 3 Jun 2019 at 18:49, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
> > index 7868dd48d931..68262231f56f 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
> > @@ -72,21 +72,18 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
> >
> >                 spin_unlock(&i915->mm.obj_lock);
> >         }
> > +
> > +       complete_all(&obj->mm.completion);
> >  }
> 
> Worth having  __i915_gem_object_set_pages_error(struct
> drm_i915_gem_object, int err) at some point?

I don't think it's required, in my current sketch, actually setting the
obj->mm.pages is central:

static void
get_pages_worker(struct work_struct *_work)
{
        struct get_pages_work *work = container_of(_work, typeof(*work), work);
        struct drm_i915_gem_object *obj = work->ctx.object;
        struct sg_table *pages;
        unsigned int sizes = 0;

        if (!work->dma.error) {
                pages = obj->ops->get_pages(&work->ctx, &sizes);
		if (!IS_ERR(pages))
			__set_pages(obj, pages, sizes);
		else
			dma_fence_set_error(&work->dma, PTR_ERR(pages));
        } else {
                pages = ERR_PTR(work->dma.error);
	}

        obj->mm.pages = pages;
        complete_all(&obj->mm.completion);
        atomic_dec(&obj->mm.pages_pin_count);

        i915_gem_object_put(obj);
        put_task_struct(work->ctx.task);

        dma_fence_signal(&work->dma);
        dma_fence_put(&work->dma);
}

That may all change with blitter integration :)
-Chris


More information about the Intel-gfx mailing list