st/nine: Clamp GetAvailableTextureMem
authorAxel Davy <davyaxel0@gmail.com>
Sun, 17 Jan 2021 17:20:03 +0000 (18:20 +0100)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 2 Mar 2021 19:07:07 +0000 (20:07 +0100)
commit3dd6b79215cba88c43301e80601149bf8188662d
tree2445acefe2a9abe8c2617ed10d13789c645e4192
parentf85f025a05cb7267b5f2c0932b46218f21576819
st/nine: Clamp GetAvailableTextureMem

Previously we used to clamp "available_texture_limit",
which was incorrect. "available_texture_mem" should
have been clamped instead.
The resulting code was noop.

The idea behind that code was that 32 bits executable
would see maximum 4GB video memory.

However it seems according to users that 32 bits apps
should be able to allocate more than 4GB, thus the
clamping is inappropriate.

Instead clamp the return of GetAvailableTextureMem, to
correctly report a high value when there is more than
4GB available.

I do not know what should exactly be the clamp value,
for now have a 64MB margin below UINT_MAX.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9177>
src/gallium/frontends/nine/device9.c