frontends/va: improve surface attribs processing
authorSimon Ser <contact@emersion.fr>
Thu, 8 Apr 2021 12:10:55 +0000 (14:10 +0200)
committerSimon Ser <contact@emersion.fr>
Fri, 16 Apr 2021 13:26:04 +0000 (15:26 +0200)
commitebab3109876113f86ed189f26f409529c7abed67
tree12737791be8b68beb89bc1f54cd9540b9c939787
parent6c80b084f26dfe60e86c80dcc10da3544244b79e
frontends/va: improve surface attribs processing

Instead of checking whether the attribute is settable for each
attrib type, check that once at the beginning of the loop.

Instead of having an if for each attrib type, use a switch.

Return an error if we encounter an unknown attribute. This allows
the caller to make sure settable attributes aren't ignored. The
intel media driver seems to just assert [1] that it doesn't encounter
unknown attributes.

[1]: https://github.com/intel/media-driver/blob/95d413e519a980f6a7178880ccbfedace092316c/media_driver/linux/common/ddi/media_libva.cpp#L2530

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10104>
src/gallium/frontends/va/surface.c