backends/drm: Prefer egl import mode
The egl import mode ensures that there's a local buffer, which is preferred as it minimizes the number of data transfers over PCIe. With dmabuf, it's unclear what the driver will do. But the main takeaway from discussion with mesa developers is that it's undesired for gbm_bo_import() to migrate or perform data transfers behind the user's back, it should be done explicitly.
This commit is contained in:
parent
082301920e
commit
e81fa52c76
2 changed files with 17 additions and 17 deletions
|
@ -241,25 +241,24 @@ std::optional<EglGbmLayerSurface::Surface> EglGbmLayerSurface::createSurface(con
|
|||
};
|
||||
const auto testFormats = [this, &sort, &doTestFormats](QVector<GbmFormat> &formats) -> std::optional<Surface> {
|
||||
std::sort(formats.begin(), formats.end(), sort);
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::Dmabuf)) {
|
||||
if (m_gpu != m_eglBackend->gpu()) {
|
||||
qCDebug(KWIN_DRM) << "chose dmabuf import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
}
|
||||
if (m_gpu == m_eglBackend->gpu()) {
|
||||
return doTestFormats(formats, MultiGpuImportMode::None);
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::Egl)) {
|
||||
qCDebug(KWIN_DRM) << "chose egl import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (m_gpu != m_eglBackend->gpu()) {
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::LinearDmabuf)) {
|
||||
qCDebug(KWIN_DRM) << "chose linear dmabuf import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::Egl)) {
|
||||
qCDebug(KWIN_DRM) << "chose egl import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::DumbBuffer)) {
|
||||
qCDebug(KWIN_DRM) << "chose cpu import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::Dmabuf)) {
|
||||
qCDebug(KWIN_DRM) << "chose dmabuf import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::LinearDmabuf)) {
|
||||
qCDebug(KWIN_DRM) << "chose linear dmabuf import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
if (const auto surface = doTestFormats(formats, MultiGpuImportMode::DumbBuffer)) {
|
||||
qCDebug(KWIN_DRM) << "chose cpu import with format" << formatName(surface->gbmSwapchain->format()).name << "and modifier" << surface->gbmSwapchain->modifier();
|
||||
return surface;
|
||||
}
|
||||
return std::nullopt;
|
||||
};
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
|
||||
private:
|
||||
enum class MultiGpuImportMode {
|
||||
None,
|
||||
Dmabuf,
|
||||
LinearDmabuf,
|
||||
Egl,
|
||||
|
|
Loading…
Reference in a new issue