Set EGL_IMAGE_PRESERVED_KHR=EGL_TRUE on our EGLImages

They're mapped read-only and may be saved internally as reference frames,
so they must not be modified by the EGL implementation.
This commit is contained in:
Cameron Gutman
2023-09-26 02:38:46 -05:00
parent fee54a9d76
commit f420dc740a
2 changed files with 8 additions and 6 deletions

View File

@@ -943,15 +943,16 @@ VAAPIRenderer::exportEGLImages(AVFrame *frame, EGLDisplay dpy,
for (size_t i = 0; i < m_PrimeDescriptor.num_layers; ++i) {
const auto &layer = m_PrimeDescriptor.layers[i];
// Max 30 attributes (1 key + 1 value for each)
const int EGL_ATTRIB_COUNT = 30 * 2;
// Max 31 attributes (1 key + 1 value for each)
const int EGL_ATTRIB_COUNT = 31 * 2;
EGLAttrib attribs[EGL_ATTRIB_COUNT] = {
EGL_LINUX_DRM_FOURCC_EXT, layer.drm_format,
EGL_WIDTH, i == 0 ? frame->width : frame->width / 2,
EGL_HEIGHT, i == 0 ? frame->height : frame->height / 2,
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
};
int attribIndex = 6;
int attribIndex = 8;
for (size_t j = 0; j < layer.num_planes; j++) {
const auto &object = m_PrimeDescriptor.objects[layer.object_index[j]];