Bug 1555899 - [Wayland] Added more wayland logging, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D33910

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-06-06 09:38:28 +00:00
Родитель e40d11acc6
Коммит 6b29386225
2 изменённых файлов: 71 добавлений и 14 удалений

Просмотреть файл

@ -573,11 +573,13 @@ WindowBackBuffer* WindowSurfaceWayland::CreateWaylandBuffer(int aWidth,
WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(
int aWidth, int aHeight, bool aFullScreenUpdate, bool aNoBackBufferCopy) {
if (!mWaylandBuffer) {
LOGWAYLAND(("%s [%p] Create [%d x %d]\n", __PRETTY_FUNCTION__, (void*)this,
aWidth, aHeight));
LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__,
(void*)this, aWidth, aHeight));
mWaylandBuffer = CreateWaylandBuffer(aWidth, aHeight);
mWaitToFullScreenUpdate = true;
LOGWAYLAND((" mWaitToFullScreenUpdate = %d\n", mWaitToFullScreenUpdate));
return mWaylandBuffer;
}
@ -590,6 +592,7 @@ WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(
}
LOGWAYLAND(("%s [%p] Reuse buffer [%d x %d]\n", __PRETTY_FUNCTION__,
(void*)this, aWidth, aHeight));
LOGWAYLAND((" mWaitToFullScreenUpdate = %d\n", mWaitToFullScreenUpdate));
return mWaylandBuffer;
}
@ -639,12 +642,13 @@ WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(
// (https://bugzilla.redhat.com/show_bug.cgi?id=1418260)
mWaylandBufferFullScreenDamage = true;
} else {
LOGWAYLAND(("%s [%p] Resize to [%d x %d]\n", __PRETTY_FUNCTION__,
LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__,
(void*)this, aWidth, aHeight));
// Former buffer has different size from the new request. Only resize
// the new buffer and leave gecko to render new whole content.
mWaylandBuffer->Resize(aWidth, aHeight);
mWaitToFullScreenUpdate = true;
LOGWAYLAND((" mWaitToFullScreenUpdate = %d\n", mWaitToFullScreenUpdate));
}
return mWaylandBuffer;
@ -655,6 +659,10 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::LockWaylandBuffer(
bool aNoBackBufferCopy) {
WindowBackBuffer* buffer = GetWaylandBufferToDraw(
aWidth, aHeight, aFullScreenUpdate, aNoBackBufferCopy);
LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this,
(void*)buffer));
if (!buffer) {
if (!aNoBackBufferCopy) {
NS_WARNING(
@ -670,7 +678,10 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::LockWaylandBuffer(
return buffer->Lock();
}
void WindowSurfaceWayland::UnlockWaylandBuffer() { mWaylandBuffer->Unlock(); }
void WindowSurfaceWayland::UnlockWaylandBuffer() {
LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
mWaylandBuffer->Unlock();
}
already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::LockImageSurface(
const gfx::IntSize& aLockSize) {
@ -733,10 +744,6 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::Lock(
gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect();
gfx::IntSize lockSize(bounds.XMost(), bounds.YMost());
LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n",
__PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height,
screenRect.width, lockSize.height));
// Are we asked for entire nsWindow to draw?
bool isTransparentPopup =
mWindow->IsWaylandPopup() &&
@ -749,6 +756,21 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::Lock(
bool needsClear = mWindow->WaylandSurfaceNeedsClear() ||
(isTransparentPopup && mDrawToWaylandBufferDirectly);
LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n",
__PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height,
screenRect.width, screenRect.height));
LOGWAYLAND((" nsWindow = %p\n", mWindow));
LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup()));
LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup));
LOGWAYLAND((" IsPopupFullScreenUpdate = %d\n",
IsPopupFullScreenUpdate(screenRect, aRegion)));
LOGWAYLAND((" IsWindowFullScreenUpdate = %d\n",
IsWindowFullScreenUpdate(screenRect, aRegion)));
LOGWAYLAND((" needsClear = %d\n", needsClear));
LOGWAYLAND(
(" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly));
LOGWAYLAND((" mWaitToFullScreenUpdate = %d\n", mWaitToFullScreenUpdate));
if (mDrawToWaylandBufferDirectly) {
// If there's any pending image commit scratch them as we're going
// to redraw the whole sceen anyway.
@ -773,6 +795,7 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::Lock(
mDrawToWaylandBufferDirectly = false;
}
LOGWAYLAND((" Indirect drawing!\n"));
return LockImageSurface(lockSize);
}
@ -829,11 +852,15 @@ bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer(
return false;
}
LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__,
(void*)this, screenRect.width, screenRect.height));
RefPtr<gfx::SourceSurface> surf =
gfx::Factory::CreateSourceSurfaceForCairoSurface(
mImageSurface->CairoSurface(), mImageSurface->GetSize(),
mImageSurface->Format());
if (!surf) {
NS_WARNING("Failed to create source cairo surface!");
return false;
}
@ -841,6 +868,9 @@ bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer(
screenRect.width, screenRect.height, /* needs clear*/ false,
/* fullscreenDrawing */ false, /* aNoBackBufferCopy */ true);
if (dt) {
LOGWAYLAND(
(" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n",
mDelayedImageCommits.Length() + 1));
// Draw any delayed image commits first
DrawDelayedImageCommits(dt, aWaylandBufferDamage);
WindowImageSurface::Draw(surf, dt, aRegion);
@ -849,6 +879,8 @@ bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer(
UnlockWaylandBuffer();
} else {
mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion));
LOGWAYLAND((" Added WindowImageSurfaces, cached surfaces %ld\n",
mDelayedImageCommits.Length()));
return false;
}
@ -879,6 +911,16 @@ void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect,
void WindowSurfaceWayland::CommitWaylandBuffer() {
MOZ_ASSERT(mPendingCommit, "Committing empty surface!");
LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
LOGWAYLAND((" mWaitToFullScreenUpdate = %d\n", mWaitToFullScreenUpdate));
LOGWAYLAND(
(" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly));
LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n",
mWaylandBufferFullScreenDamage));
LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle));
LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback));
LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface));
if (mWaitToFullScreenUpdate) {
return;
}
@ -892,6 +934,8 @@ void WindowSurfaceWayland::CommitWaylandBuffer() {
/* fullscreenInvalidate */ false,
/* aNoBackBufferCopy */ true);
if (dt) {
LOGWAYLAND(("%s [%p] flushed indirect drawing\n", __PRETTY_FUNCTION__,
(void*)this));
DrawDelayedImageCommits(dt, mWaylandBufferDamage);
UnlockWaylandBuffer();
mDrawToWaylandBufferDirectly = true;
@ -900,6 +944,9 @@ void WindowSurfaceWayland::CommitWaylandBuffer() {
wl_surface* waylandSurface = mWindow->GetWaylandSurface();
if (!waylandSurface) {
LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n",
__PRETTY_FUNCTION__, (void*)this));
// Target window is not created yet - delay the commit. This can happen only
// when the window is newly created and there's no active
// frame callback pending.
@ -926,6 +973,8 @@ void WindowSurfaceWayland::CommitWaylandBuffer() {
// We have an active frame callback request so handle it.
if (mFrameCallback) {
if (waylandSurface == mLastCommittedSurface) {
LOGWAYLAND(("%s [%p] wait for frame callback.\n", __PRETTY_FUNCTION__,
(void*)this));
// We have an active frame callback pending from our recent surface.
// It means we should defer the commit to FrameCallbackHandler().
return;
@ -987,6 +1036,10 @@ void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) {
LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n",
__PRETTY_FUNCTION__, (void*)this, lockSize.width,
lockSize.height, screenRect.width, lockSize.height));
LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n",
mDrawToWaylandBufferDirectly));
LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n",
mWaylandBufferFullScreenDamage));
}
#endif
@ -1019,6 +1072,8 @@ void WindowSurfaceWayland::FrameCallbackHandler() {
MOZ_ASSERT(mLastCommittedSurface != nullptr,
"FrameCallbackHandler() called without valid wl_surface!");
LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
wl_callback_destroy(mFrameCallback);
mFrameCallback = nullptr;
@ -1030,6 +1085,8 @@ void WindowSurfaceWayland::FrameCallbackHandler() {
void WindowSurfaceWayland::DelayedCommitHandler() {
MOZ_ASSERT(mDelayedCommitHandle != nullptr, "Missing mDelayedCommitHandle!");
LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
*mDelayedCommitHandle = nullptr;
free(mDelayedCommitHandle);
mDelayedCommitHandle = nullptr;

Просмотреть файл

@ -609,10 +609,10 @@ struct wl_surface* moz_container_get_wl_surface(MozContainer* container) {
wl_surface_commit(container->surface);
wl_display_flush(waylandDisplay->GetDisplay());
}
LOGWAYLAND(("%s [%p] created surface %p\n", __FUNCTION__, (void*)container,
(void*)container->surface));
LOGWAYLAND(("%s [%p] created surface %p\n", __FUNCTION__, (void*)container,
(void*)container->surface));
}
return container->surface;
}
@ -633,10 +633,10 @@ struct wl_egl_window* moz_container_get_wl_egl_window(MozContainer* container) {
wl_egl_window_create(surface, gdk_window_get_width(window) * scale,
gdk_window_get_height(window) * scale);
wl_surface_set_buffer_scale(surface, scale);
}
LOGWAYLAND(("%s [%p] created eglwindow %p\n", __FUNCTION__, (void*)container,
(void*)container->eglwindow));
LOGWAYLAND(("%s [%p] created eglwindow %p\n", __FUNCTION__,
(void*)container, (void*)container->eglwindow));
}
return container->eglwindow;
}