platformsupport/scene/opengl: do test imports for external_only formats properly
The scene renderer doesn't use external_only formats as a single EGLImage, but only does YUV conversion for some specific formats, so the test import should match that.
This commit is contained in:
parent
61ef8c0087
commit
ad27858df3
1 changed files with 19 additions and 1 deletions
|
@ -309,8 +309,26 @@ std::shared_ptr<GLTexture> AbstractEglBackend::importDmaBufAsTexture(const DmaBu
|
|||
|
||||
bool AbstractEglBackend::testImportBuffer(GraphicsBuffer *buffer)
|
||||
{
|
||||
const auto nonExternalOnly = m_display->nonExternalOnlySupportedDrmFormats();
|
||||
if (auto it = nonExternalOnly.find(buffer->dmabufAttributes()->format); it != nonExternalOnly.end() && it->contains(buffer->dmabufAttributes()->modifier)) {
|
||||
return importBufferAsImage(buffer) != EGL_NO_IMAGE_KHR;
|
||||
}
|
||||
// external_only buffers aren't used as a single EGLImage, import them separately
|
||||
const auto info = FormatInfo::get(buffer->dmabufAttributes()->format);
|
||||
if (!info || !info->yuvConversion()) {
|
||||
return false;
|
||||
}
|
||||
const auto planes = info->yuvConversion()->plane;
|
||||
if (buffer->dmabufAttributes()->planeCount != planes.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < planes.size(); i++) {
|
||||
if (!importBufferAsImage(buffer, i, planes[i].format, QSize(buffer->size().width() / planes[i].widthDivisor, buffer->size().height() / planes[i].heightDivisor))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QHash<uint32_t, QList<uint64_t>> AbstractEglBackend::supportedFormats() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue