frontends/va: Ignore requested size when creating VAEncCodedBufferType
authorDavid Rosca <nowrep@gmail.com>
Sun, 30 Jul 2023 15:36:06 +0000 (17:36 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sun, 13 Aug 2023 16:52:14 +0000 (16:52 +0000)
commit7bcbfae87c9039ebb01f7287403bf5666ca8d64e
tree4225102de56f8946816673558d3a1f18f68aacd7
parent040a0fcf421564ab6371aac735bcaff29f7be132
frontends/va: Ignore requested size when creating VAEncCodedBufferType

The buffer data is not directly accessible to application and it's
internally used to only store VACodedBufferSegment struct.
Ignore the size requested by application and instead allocate
sizeof(VACodedBufferSegment). Use calloc to zero out the struct.

This can save significant amount of memory, for example FFmpeg
will request up to tens of MB for single buffer.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6462

Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24410>
src/gallium/frontends/va/buffer.c