Bug 1807942 [Linux] Don't use dmabuf surface if ExportDMABUFImageMESA() fails to export dmabuf file descriptors r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D169315
This commit is contained in:
stransky 2023-02-10 08:04:13 +00:00
Родитель ea17a88f1e
Коммит 498077e020
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -474,6 +474,17 @@ bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
return false;
}
// A broken driver can return dmabuf without valid file descriptors
// which leads to fails later so quit now.
for (int i = 0; i < mBufferPlaneCount; i++) {
if (mDmabufFds[i] < 0) {
LOGDMABUF(
(" ExportDMABUFImageMESA failed, mDmabufFds[%d] is invalid, quit",
i));
return false;
}
}
LOGDMABUF((" imported size %d x %d format %x planes %d modifiers %" PRIx64,
mWidth, mHeight, mDrmFormats[0], mBufferPlaneCount,
mBufferModifiers[0]));