Commit 9679beac authored by Xaver Hugl's avatar Xaver Hugl
Browse files

Actually use a linear buffer format for multi-GPU

BUG: 431968


(cherry picked from commit f8d9b3bc)
parent 27e7dba1
......@@ -155,23 +155,6 @@ bool EglGbmBackend::initRenderingContext()
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
{
auto eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(),
......@@ -188,9 +171,18 @@ bool EglGbmBackend::resetOutput(Output &output, DrmOutput *drmOutput)
output.output = drmOutput;
const QSize size = drmOutput->hardwareTransforms() ? drmOutput->pixelSize() :
drmOutput->modeSize();
auto gbmSurface = createGbmSurface(size, output.onSecondaryGPU);
int flags = GBM_BO_USE_RENDERING;
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) {
qCCritical(KWIN_DRM) << "Creating GBM surface failed";
return false;
}
auto eglSurface = createEglSurface(gbmSurface);
......@@ -335,7 +327,7 @@ bool EglGbmBackend::resetFramebuffer(Output &output)
{
cleanupFramebuffer(output);
if (output.output->hardwareTransforms() && !output.onSecondaryGPU) {
if (output.output->hardwareTransforms()) {
// No need for an extra render target.
return true;
}
......
......@@ -74,14 +74,12 @@ private:
std::shared_ptr<GLVertexBuffer> vbo;
} render;
bool onSecondaryGPU = false;
int dmabufFd = 0;
gbm_bo *secondaryGbmBo = nullptr;
gbm_bo *importedGbmBo = nullptr;
};
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;
bool makeContextCurrent(const Output &output) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment