Actually use a linear buffer format for multi-GPU
BUG: 431968
This commit is contained in:
parent
2c6d19fec1
commit
f8d9b3bc6c
2 changed files with 12 additions and 22 deletions
|
@ -155,23 +155,6 @@ bool EglGbmBackend::initRenderingContext()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<GbmSurface> EglGbmBackend::createGbmSurface(const QSize &size, const bool linear) const
|
|
||||||
{
|
|
||||||
auto flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
|
||||||
if (linear) {
|
|
||||||
flags |= GBM_BO_USE_LINEAR;
|
|
||||||
}
|
|
||||||
auto gbmSurface = std::make_shared<GbmSurface>(m_gpu->gbmDevice(),
|
|
||||||
size.width(), size.height(),
|
|
||||||
GBM_FORMAT_XRGB8888,
|
|
||||||
flags);
|
|
||||||
if (!gbmSurface) {
|
|
||||||
qCCritical(KWIN_DRM) << "Creating GBM surface failed";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return gbmSurface;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLSurface EglGbmBackend::createEglSurface(std::shared_ptr<GbmSurface> gbmSurface) const
|
EGLSurface EglGbmBackend::createEglSurface(std::shared_ptr<GbmSurface> gbmSurface) const
|
||||||
{
|
{
|
||||||
auto eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(),
|
auto eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(),
|
||||||
|
@ -188,9 +171,18 @@ bool EglGbmBackend::resetOutput(Output &output, DrmOutput *drmOutput)
|
||||||
output.output = drmOutput;
|
output.output = drmOutput;
|
||||||
const QSize size = drmOutput->hardwareTransforms() ? drmOutput->pixelSize() :
|
const QSize size = drmOutput->hardwareTransforms() ? drmOutput->pixelSize() :
|
||||||
drmOutput->modeSize();
|
drmOutput->modeSize();
|
||||||
|
int flags = GBM_BO_USE_RENDERING;
|
||||||
auto gbmSurface = createGbmSurface(size, output.onSecondaryGPU);
|
if (drmOutput->gpu() == m_gpu) {
|
||||||
|
flags |= GBM_BO_USE_SCANOUT;
|
||||||
|
} else {
|
||||||
|
flags |= GBM_BO_USE_LINEAR;
|
||||||
|
}
|
||||||
|
auto gbmSurface = std::make_shared<GbmSurface>(m_gpu->gbmDevice(),
|
||||||
|
size.width(), size.height(),
|
||||||
|
GBM_FORMAT_XRGB8888,
|
||||||
|
flags);
|
||||||
if (!gbmSurface) {
|
if (!gbmSurface) {
|
||||||
|
qCCritical(KWIN_DRM) << "Creating GBM surface failed";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto eglSurface = createEglSurface(gbmSurface);
|
auto eglSurface = createEglSurface(gbmSurface);
|
||||||
|
@ -335,7 +327,7 @@ bool EglGbmBackend::resetFramebuffer(Output &output)
|
||||||
{
|
{
|
||||||
cleanupFramebuffer(output);
|
cleanupFramebuffer(output);
|
||||||
|
|
||||||
if (output.output->hardwareTransforms() && !output.onSecondaryGPU) {
|
if (output.output->hardwareTransforms()) {
|
||||||
// No need for an extra render target.
|
// No need for an extra render target.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,14 +74,12 @@ private:
|
||||||
std::shared_ptr<GLVertexBuffer> vbo;
|
std::shared_ptr<GLVertexBuffer> vbo;
|
||||||
} render;
|
} render;
|
||||||
|
|
||||||
bool onSecondaryGPU = false;
|
|
||||||
int dmabufFd = 0;
|
int dmabufFd = 0;
|
||||||
gbm_bo *secondaryGbmBo = nullptr;
|
gbm_bo *secondaryGbmBo = nullptr;
|
||||||
gbm_bo *importedGbmBo = nullptr;
|
gbm_bo *importedGbmBo = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool resetOutput(Output &output, DrmOutput *drmOutput);
|
bool resetOutput(Output &output, DrmOutput *drmOutput);
|
||||||
std::shared_ptr<GbmSurface> createGbmSurface(const QSize &size, const bool linear) const;
|
|
||||||
EGLSurface createEglSurface(std::shared_ptr<GbmSurface> gbmSurface) const;
|
EGLSurface createEglSurface(std::shared_ptr<GbmSurface> gbmSurface) const;
|
||||||
|
|
||||||
bool makeContextCurrent(const Output &output) const;
|
bool makeContextCurrent(const Output &output) const;
|
||||||
|
|
Loading…
Reference in a new issue