platforms/drm: log when direct scanout starts and stops

This commit is contained in:
Xaver Hugl 2021-05-31 01:58:47 +02:00
parent de3b7a96db
commit b88b6f3bc3

View file

@ -30,12 +30,13 @@
#include <gbm.h> #include <gbm.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <egl_dmabuf.h>
#include <drm_fourcc.h>
// kwayland server // kwayland server
#include "KWaylandServer/surface_interface.h" #include "KWaylandServer/surface_interface.h"
#include "KWaylandServer/buffer_interface.h" #include "KWaylandServer/buffer_interface.h"
#include "KWaylandServer/linuxdmabuf_v1_interface.h" #include "KWaylandServer/linuxdmabuf_v1_interface.h"
#include <egl_dmabuf.h> #include "KWaylandServer/clientconnection.h"
#include <drm_fourcc.h>
namespace KWin namespace KWin
{ {
@ -689,6 +690,9 @@ void EglGbmBackend::setViewport(const Output &output) const
QRegion EglGbmBackend::beginFrame(int screenId) QRegion EglGbmBackend::beginFrame(int screenId)
{ {
Output &output = m_outputs[screenId]; Output &output = m_outputs[screenId];
if (output.surfaceInterface) {
qCDebug(KWIN_DRM) << "Direct scanout stopped on output" << output.output->name();
}
output.surfaceInterface = nullptr; output.surfaceInterface = nullptr;
if (isPrimary()) { if (isPrimary()) {
return prepareRenderingForOutput(output); return prepareRenderingForOutput(output);
@ -817,8 +821,18 @@ bool EglGbmBackend::scanout(int screenId, SurfaceItem *surfaceItem)
damage = output.output->geometry(); damage = output.output->geometry();
} }
output.buffer = QSharedPointer<DrmGbmBuffer>::create(m_gpu, importedBuffer, buffer); output.buffer = QSharedPointer<DrmGbmBuffer>::create(m_gpu, importedBuffer, buffer);
auto oldSurface = output.surfaceInterface;
output.surfaceInterface = surface; output.surfaceInterface = surface;
return presentOnOutput(output, damage); if (presentOnOutput(output, damage)) {
if (oldSurface != surface) {
auto path = surface->client()->executablePath();
qCDebug(KWIN_DRM).nospace() << "Direct scanout starting on output " << output.output->name() << " for application \"" << path << "\"";
}
return true;
} else {
output.surfaceInterface = nullptr;
return false;
}
} }
QSharedPointer<GLTexture> EglGbmBackend::textureForOutput(AbstractOutput *abstractOutput) const QSharedPointer<GLTexture> EglGbmBackend::textureForOutput(AbstractOutput *abstractOutput) const