[Mesa-dev] [RFC PATCH] mesa: add support for multiple buffer mappings

Fredrik Höglund fredrik at kde.org
Thu Feb 6 15:37:21 PST 2014


On Thursday 06 February 2014, Eric Anholt wrote:
> Marek Olšák <maraeo at gmail.com> writes:
> 
> > From: Marek Olšák <marek.olsak at amd.com>
> >
> > OpenGL allows a buffer to be mapped only once, but we also map buffers
> > internally, e.g. in the software primitive restart fallback, for PBOs,
> > vbo_get_minmax_index, etc. This has always been a problem, but it will
> > be a bigger problem with persistent buffer mappings, which will prevent
> > all Mesa functions from mapping buffers for internal purposes.
> >
> > This adds a driver inteface to core Mesa which supports multiple buffer
> > mappings and allows 2 mappings: one for the GL user and one for Mesa.
> >
> > Note that Gallium supports an unlimited number of buffer and texture
> > mappings, so it's not really an issue for Gallium.
> >
> > This is just the interface change. Please review. If you don't like it,
> > feel free to propose how you would do it. Thank you.
> 
> Having an index makes sense to me -- you have to either have that in the
> caller, or have the MBR hook return a pointer to private storage that
> gets passed in to Unmap, which sucks more.
> 
> My only question is whether we want to make Offset/Length/Pointer be
> GL-only properties that are managed by glMapBuffer() and
> glMapBufferRange() for us, then have drivers like intel store whatever
> the need in their own private area.

The code in api_arrayelt.c uses the Pointer field, so it will be easier
to adapt it to the new interface if the driver hook continues to set it.

Fredrik



More information about the mesa-dev mailing list