[Mesa-stable] [Mesa-dev] [PATCH 3/4] i965/bufmgr: Add a set_tiling helper
Jason Ekstrand
jason at jlekstrand.net
Fri Jan 12 19:20:31 UTC 2018
On Fri, Jan 12, 2018 at 1:28 AM, Chris Wilson <chris at chris-wilson.co.uk>
wrote:
> Quoting Jason Ekstrand (2018-01-12 01:40:52)
> > This helper should be used carefully as setting tiling is a racy
> > operation since it potentially interacts with other processes. Still,
> > it is a useful thing to be able to do.
> >
> > Cc: mesa-stable at lists.freedesktop.org
> > ---
> > src/mesa/drivers/dri/i965/brw_bufmgr.c | 27 +++++++++++++++++++++++++++
> > src/mesa/drivers/dri/i965/brw_bufmgr.h | 10 ++++++++++
> > 2 files changed, 37 insertions(+)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> > index 469895e..dbd13dd 100644
> > --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> > +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> > @@ -1133,6 +1133,33 @@ brw_bo_get_tiling(struct brw_bo *bo, uint32_t
> *tiling_mode,
> > return 0;
> > }
> >
> > +int
> > +brw_bo_set_tiling(struct brw_bo *bo, uint32_t tiling_mode,
> > + uint32_t stride)
> > +{
> > + struct brw_bufmgr *bufmgr = bo->bufmgr;
> > +
> > + mtx_lock(&bufmgr->lock);
>
> This mutex protects the buffer cache, which should not be containing
> this bo. Changing the tiling of a shared active bo also should not
> happen because the other parties will have already derived state from
> the older tiling. So I don't see the purpose of this mutex here.
>
It can, in theory, if we have simultaneous imports on two different
contexts. That's a bit of a crazy case, I'll agree, but it can happen and
I don't want there to be any chance of corruption of the internal state of
the BO. Setting tiling from two different contexts simultaneously is racy,
I'll grant, but there are many other reasons why BO tilings are racy and/or
problematic so I don't really want to get hung up on it.
Also, FYI, I expect this patch (and 4/4) to live in 17.3 only and in master
for about a week or two before Scott gets rid of GTT maps and we stop
setting tiling on any BOs except legacy (non-modifiers) window-system ones.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180112/04c25808/attachment.html>
More information about the mesa-stable
mailing list