Re: [RFC] drm/i915: Extend CREATE_CONTEXT to allow inheritance ala clone()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 15, 2017 at 01:20:17PM +0000, Chris Wilson wrote:
> A context encompasses the driver's view of process related state, and
> encapsulates the logical GPU state where available. Each context is
> currently equivalent to a process in CPU terms. Like with processes,
> sometimes the user wants a lighter encapsulation that shares some state
> with the parent process, for example two threads have unique register
> state but share the virtual memory mappings. We can support exactly the
> same principle using contexts where we may share the GTT but keep the
> logical GPU state distinct. This allows quicker switching between those
> contexts, and for userspace to allocate a single offset in the GTT and
> use it across multiple contexts. Like with clone(), in the future we may
> wish to allow userspace to select more features to copy across from the
> parent, but for now we only allow sharing of the GTT.

Our timelines are still per-vm and not per-ctx.
This means that schedule() will have slightly unexpected behavior when dealing
with two context of different priority sharing a VM.

-Michał

> 
> Note that if full per-process GTT is not supported on the harder, the
> GTT are already implicitly shared between contexts, and this request
> to create contexts with shared GTT fails. With full ppGTT, every fd
> (i.e. every process) is allocated a unique GTT so this request cannot be
> used to share GTT between processes/fds, it can only share GTT belonging
> to this fd.
> Testcase: igt/gem_ctx_shared
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>
> Cc: Michał Winiarski <michal.winiarski@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c           |  62 ++++--
>  drivers/gpu/drm/i915/i915_gem_gtt.c               |   4 +-
>  drivers/gpu/drm/i915/i915_gem_gtt.h               |   1 -
>  drivers/gpu/drm/i915/selftests/huge_pages.c       |   1 -
>  drivers/gpu/drm/i915/selftests/i915_gem_context.c | 234 +++++++++++++++++-----
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c     |   1 -
>  drivers/gpu/drm/i915/selftests/mock_context.c     |   2 +-
>  include/uapi/drm/i915_drm.h                       |  11 +-
>  8 files changed, 241 insertions(+), 75 deletions(-)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux