[Mesa-dev] [PATCH] i965: Unbind deleted shaders from brw_context, fixing malloc heisenbug.
Eero Tamminen
eero.t.tamminen at intel.com
Fri Jan 27 12:50:15 UTC 2017
Hi,
On 27.01.2017 00:08, Kenneth Graunke wrote:
> On Thursday, January 26, 2017 12:00:14 PM PST Eric Anholt wrote:
>> Kenneth Graunke <kenneth at whitecape.org> writes:
>> Any reason you're not just using _mesa_reference_program()?
>
> That might be a better plan.
>
> Conceptually, I thought of this more as a "weak reference" - we want to
> know if the current program is the same as the last draw...but we don't
> want to hold on to the program and prevent its deletion.
>
> Plus, it would add a bit of reference counting overhead in the draw path
> (though this is probably negligable - Mesa does a lot of it already).
>
> I suppose using real references would mean that a deleted program would
> remain alive until the next glDraw*() that used a different shader.
> Which could theoretically be forever, but is likely not that long, so
> it's probably acceptable.
If previous alloc is removed only after doing the new one, that could
worsen heap fragmentation and data locality. May be relevant on
machines with less RAM or when running 32-bit games (= most of Steam
games), but IMHO unlikely.
> I don't know. I'll probably go with this patch for now since it works
> and I've done a lot of testing. If people prefer the other way, I can
> write a patch to do that...
- Eero
More information about the mesa-dev
mailing list