<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 15, 2017 at 8:27 AM, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Quoting Jason Ekstrand (2017-12-15 16:21:42)<br>
<div><div class="h5">> On Fri, Dec 15, 2017 at 5:42 AM, Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br>
><br>
> Every client (everyone instance that opens /dev/dri/card0 or the render<br>
> nodes), receives a unique per-process GTT (where supported by the<br>
> hardware, unfortunately that means only Broadwell and later). Every<br>
> context created by each client, in turns receives its own unique ppGTT.<br>
> This is overkill in terms of allocations and tracking, both in the<br>
> kernel and in the hardware, as we could be sharing the per-client GTT<br>
> amongst all of its contexts. The downside is that context segregation is<br>
> reduced, a stray write from one context may affect another, and so we<br>
> must honour any client requests that require robust segregation (e.g.<br>
> ARB_robustness).<br>
><br>
> Signed-off-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c | 23 +++++++++++++++++------<br>
> src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.h | 2 +-<br>
> src/mesa/drivers/dri/i965/<wbr>brw_context.c | 2 +-<br>
> 3 files changed, 19 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c b/src/mesa/drivers/dri/<br>
> i965/brw_bufmgr.c<br>
> index 52b5bf97a1..d8a9635f5d 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c<br>
> @@ -1297,13 +1297,24 @@ init_cache_buckets(struct brw_bufmgr *bufmgr)<br>
> }<br>
><br>
> uint32_t<br>
> -brw_create_hw_context(struct brw_bufmgr *bufmgr)<br>
> +brw_create_hw_context(struct brw_bufmgr *bufmgr, unsigned int flags)<br>
> {<br>
> - struct drm_i915_gem_context_create create = { };<br>
> - int ret = drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_<wbr>CREATE, &<br>
> create);<br>
> - if (ret != 0) {<br>
> - DBG("DRM_IOCTL_I915_GEM_<wbr>CONTEXT_CREATE failed: %s\n", strerror<br>
> (errno));<br>
> - return 0;<br>
> + struct local_i915_gem_context_create_<wbr>v2 {<br>
> + uint32_t ctx_id; /* out */<br>
> + uint32_t flags;<br>
> +#define I915_GEM_CONTEXT_SHARE_GTT 0x1<br>
> + uint32_t share_ctx;<br>
><br>
><br>
> So, we've left share_ctx as 0. What does that mean? Does that mean that we<br>
> share with some context that was implicitly created by opening /dev/dri/card0? <br>
> Does it mean we share with the default context and therefore other processes? <br>
<br>
</div></div>The default context, 0, is per fd.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>So a second open() of /dev/dri/card0 will get a different default context?<br></div></div><br></div></div>