plugins: fix GLTextureUploadMeta check for native texture changes
@gb
Submitted by Gwenole Beauchesne Link to original bug (#720728)
Description
Currently, in the GLTextureUploadMeta::upload() implementation for GLX, we check that the supplied texture changed by its name. This is OK for the general case but there is still a possibility that the upper layer (e.g. glimagesink) releases that texture, and next create a new one, but with different dimensions.
Note: that's not a big deal currently because we usually create a GL texture that is as large as the original VA surface. For performance reasons, e.g. 2160p surface -> 1080p display, it could be enough to upload to a smaller texture.
Possible solutions:
-
Fix gst_vaapi_texture_upload() to also check for the supplied texture dimensions. This causes the GL pipeline to sync since a glGetTexLevelParameteriv() would be involved for GL_WIDTH and GL_HEIGHT params. i.e. that doesn't look a good approach for performance reasons, but this is a correct one.
-
Mandate, and document, GLTextureUploadMeta _upload() hook to required that supplied texture characteristics (format, size) need to be consistent for the lifetime of the meta. Benefit: no code change, efficient. Only doc update needed.
-
Change the upload API to let the upper layer (caller) supply the dimensions for the various textures in the _upload() arguments.