307 lines
14 KiB
Diff
307 lines
14 KiB
Diff
|
diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp
|
||
|
--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 2019-09-12 07:53:06.119602913 +0200
|
||
|
+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-12 07:54:47.410105270 +0200
|
||
|
@@ -326,13 +326,13 @@ void WindowBackBufferShm::Create(int aWi
|
||
|
mHeight = aHeight;
|
||
|
|
||
|
LOGWAYLAND((
|
||
|
- "%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this,
|
||
|
+ "WindowBackBufferShm::Create [%p] wl_buffer %p ID %d\n", (void*)this,
|
||
|
(void*)mWaylandBuffer,
|
||
|
mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1));
|
||
|
}
|
||
|
|
||
|
void WindowBackBufferShm::Release() {
|
||
|
- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND(("WindowBackBufferShm::Release [%p]\n", (void*)this));
|
||
|
|
||
|
wl_buffer_destroy(mWaylandBuffer);
|
||
|
mWidth = mHeight = 0;
|
||
|
@@ -358,8 +358,8 @@ WindowBackBufferShm::~WindowBackBufferSh
|
||
|
bool WindowBackBufferShm::Resize(int aWidth, int aHeight) {
|
||
|
if (aWidth == mWidth && aHeight == mHeight) return true;
|
||
|
|
||
|
- LOGWAYLAND(
|
||
|
- ("%s [%p] %d %d\n", __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight));
|
||
|
+ LOGWAYLAND(("WindowBackBufferShm::Resize [%p] %d %d\n", (void*)this, aWidth,
|
||
|
+ aHeight));
|
||
|
|
||
|
Release();
|
||
|
Create(aWidth, aHeight);
|
||
|
@@ -369,7 +369,7 @@ bool WindowBackBufferShm::Resize(int aWi
|
||
|
|
||
|
void WindowBackBuffer::Attach(wl_surface* aSurface) {
|
||
|
LOGWAYLAND(
|
||
|
- ("%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__,
|
||
|
+ ("WindowBackBuffer::Attach [%p] wl_surface %p ID %d wl_buffer %p ID %d\n",
|
||
|
(void*)this, (void*)aSurface,
|
||
|
aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1,
|
||
|
(void*)GetWlBuffer(),
|
||
|
@@ -382,8 +382,8 @@ void WindowBackBuffer::Attach(wl_surface
|
||
|
}
|
||
|
|
||
|
void WindowBackBufferShm::Detach(wl_buffer* aBuffer) {
|
||
|
- LOGWAYLAND(("%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this,
|
||
|
- (void*)aBuffer,
|
||
|
+ LOGWAYLAND(("WindowBackBufferShm::Detach [%p] wl_buffer %p ID %d\n",
|
||
|
+ (void*)this, (void*)aBuffer,
|
||
|
aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1));
|
||
|
|
||
|
mAttached = false;
|
||
|
@@ -404,7 +404,7 @@ bool WindowBackBufferShm::SetImageDataFr
|
||
|
|
||
|
already_AddRefed<gfx::DrawTarget> WindowBackBufferShm::Lock() {
|
||
|
LOGWAYLAND((
|
||
|
- "%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__,
|
||
|
+ "WindowBackBufferShm::Lock [%p] [%d x %d] wl_buffer %p ID %d\n",
|
||
|
(void*)this, mWidth, mHeight, (void*)mWaylandBuffer,
|
||
|
mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1));
|
||
|
|
||
|
@@ -419,16 +419,17 @@ WindowBackBufferDMABuf::WindowBackBuffer
|
||
|
nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight)
|
||
|
: WindowBackBuffer(aWaylandDisplay) {
|
||
|
mDMAbufSurface.Create(aWidth, aHeight);
|
||
|
-
|
||
|
- LOGWAYLAND(("%s [%p] Created DMABuf buffer [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, aWidth, aHeight));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowBackBufferDMABuf::WindowBackBufferDMABuf [%p] Created DMABuf "
|
||
|
+ "buffer [%d x %d]\n",
|
||
|
+ (void*)this, aWidth, aHeight));
|
||
|
}
|
||
|
|
||
|
WindowBackBufferDMABuf::~WindowBackBufferDMABuf() { mDMAbufSurface.Release(); }
|
||
|
|
||
|
already_AddRefed<gfx::DrawTarget> WindowBackBufferDMABuf::Lock() {
|
||
|
LOGWAYLAND(
|
||
|
- ("%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__,
|
||
|
+ ("WindowBackBufferDMABuf::Lock [%p] [%d x %d] wl_buffer %p ID %d\n",
|
||
|
(void*)this, GetWidth(), GetHeight(), (void*)GetWlBuffer(),
|
||
|
GetWlBuffer() ? wl_proxy_get_id((struct wl_proxy*)GetWlBuffer()) : -1));
|
||
|
|
||
|
@@ -534,7 +535,8 @@ WindowSurfaceWayland::~WindowSurfaceWayl
|
||
|
bool WindowSurfaceWayland::UseDMABufBackend() {
|
||
|
if (!mUseDMABufInitialized) {
|
||
|
mUseDMABuf = nsWaylandDisplay::IsDMABufEnabled();
|
||
|
- LOGWAYLAND(("%s DMABuf state %d\n", __PRETTY_FUNCTION__, mUseDMABuf));
|
||
|
+ LOGWAYLAND(("WindowSurfaceWayland::UseDMABufBackend DMABuf state %d\n",
|
||
|
+ mUseDMABuf));
|
||
|
mUseDMABufInitialized = true;
|
||
|
}
|
||
|
return mUseDMABuf;
|
||
|
@@ -567,15 +569,16 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
|
||
|
WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(
|
||
|
bool aCanSwitchBuffer) {
|
||
|
- LOGWAYLAND(("%s [%p] Requested buffer [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::GetWaylandBufferToDraw [%p] Requested buffer [%d "
|
||
|
+ "x %d]\n",
|
||
|
+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
|
||
|
// There's no buffer created yet, create a new one.
|
||
|
if (!mWaylandBuffer) {
|
||
|
MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage,
|
||
|
"Created new buffer for partial drawing!");
|
||
|
- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, mBufferScreenRect.width,
|
||
|
+ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width,
|
||
|
mBufferScreenRect.height));
|
||
|
|
||
|
mWaylandBuffer =
|
||
|
@@ -586,21 +589,19 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
|
||
|
#ifdef DEBUG
|
||
|
if (mWaylandBuffer->IsAttached()) {
|
||
|
- LOGWAYLAND(("%s [%p] Buffer %p is attached, need to find a new one.\n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this, mWaylandBuffer));
|
||
|
+ LOGWAYLAND((" Buffer %p is attached, need to find a new one.\n",
|
||
|
+ mWaylandBuffer));
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
// Reuse existing buffer
|
||
|
if (!mWaylandBuffer->IsAttached()) {
|
||
|
- LOGWAYLAND(
|
||
|
- ("%s [%p] Use recent buffer.\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND((" Use recent buffer.\n"));
|
||
|
|
||
|
if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width,
|
||
|
mBufferScreenRect.height)) {
|
||
|
- LOGWAYLAND(("%s [%p] Size is ok, use the buffer [%d x %d]\n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width,
|
||
|
- mBufferScreenRect.height));
|
||
|
+ LOGWAYLAND((" Size is ok, use the buffer [%d x %d]\n",
|
||
|
+ mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
return mWaylandBuffer;
|
||
|
}
|
||
|
|
||
|
@@ -609,9 +610,8 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
return nullptr;
|
||
|
}
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p] Reuse buffer with resize [%d x %d]\n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width,
|
||
|
- mBufferScreenRect.height));
|
||
|
+ LOGWAYLAND((" Reuse buffer with resize [%d x %d]\n",
|
||
|
+ mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
|
||
|
mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height);
|
||
|
// There's a chance that scale factor has been changed
|
||
|
@@ -629,8 +629,7 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
for (availableBuffer = 0; availableBuffer < BACK_BUFFER_NUM;
|
||
|
availableBuffer++) {
|
||
|
if (!mBackupBuffer[availableBuffer]) {
|
||
|
- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, mBufferScreenRect.width,
|
||
|
+ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width,
|
||
|
mBufferScreenRect.height));
|
||
|
mBackupBuffer[availableBuffer] = CreateWaylandBuffer(
|
||
|
mBufferScreenRect.width, mBufferScreenRect.height);
|
||
|
@@ -643,8 +642,7 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
}
|
||
|
|
||
|
if (MOZ_UNLIKELY(availableBuffer == BACK_BUFFER_NUM)) {
|
||
|
- LOGWAYLAND(("%s [%p] No drawing buffer available!\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this));
|
||
|
+ LOGWAYLAND((" No drawing buffer available!\n"));
|
||
|
NS_WARNING("No drawing buffer available");
|
||
|
return nullptr;
|
||
|
}
|
||
|
@@ -653,17 +651,15 @@ WindowBackBuffer* WindowSurfaceWayland::
|
||
|
mWaylandBuffer = mBackupBuffer[availableBuffer];
|
||
|
mBackupBuffer[availableBuffer] = lastWaylandBuffer;
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p] Buffer flip new back %p new front %p \n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this, (void*)lastWaylandBuffer,
|
||
|
- (void*)mWaylandBuffer));
|
||
|
+ LOGWAYLAND((" Buffer flip new back %p new front %p \n",
|
||
|
+ (void*)lastWaylandBuffer, (void*)mWaylandBuffer));
|
||
|
|
||
|
mNeedScaleFactorUpdate = true;
|
||
|
|
||
|
bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize(
|
||
|
mBufferScreenRect.width, mBufferScreenRect.height);
|
||
|
if (bufferNeedsResize) {
|
||
|
- LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, mBufferScreenRect.width,
|
||
|
+ LOGWAYLAND((" Resize buffer to [%d x %d]\n", mBufferScreenRect.width,
|
||
|
mBufferScreenRect.height));
|
||
|
mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height);
|
||
|
}
|
||
|
@@ -675,8 +671,8 @@ already_AddRefed<gfx::DrawTarget> Window
|
||
|
bool aCanSwitchBuffer) {
|
||
|
WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer);
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this,
|
||
|
- (void*)buffer));
|
||
|
+ LOGWAYLAND(("WindowSurfaceWayland::LockWaylandBuffer [%p] Got buffer %p\n",
|
||
|
+ (void*)this, (void*)buffer));
|
||
|
|
||
|
if (!buffer) {
|
||
|
return nullptr;
|
||
|
@@ -691,7 +687,7 @@ already_AddRefed<gfx::DrawTarget> Window
|
||
|
}
|
||
|
|
||
|
void WindowSurfaceWayland::UnlockWaylandBuffer() {
|
||
|
- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND(("WindowSurfaceWayland::UnlockWaylandBuffer [%p]\n", (void*)this));
|
||
|
mWaylandBuffer->Unlock();
|
||
|
}
|
||
|
|
||
|
@@ -774,9 +770,11 @@ already_AddRefed<gfx::DrawTarget> Window
|
||
|
mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup;
|
||
|
}
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height,
|
||
|
- lockedScreenRect.width, lockedScreenRect.height));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::Lock [%p] lockSize [%d x %d] windowSize [%d x "
|
||
|
+ "%d]\n",
|
||
|
+ (void*)this, lockSize.width, lockSize.height, lockedScreenRect.width,
|
||
|
+ lockedScreenRect.height));
|
||
|
LOGWAYLAND((" nsWindow = %p\n", mWindow));
|
||
|
LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup()));
|
||
|
LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup));
|
||
|
@@ -892,8 +890,10 @@ bool WindowSurfaceWayland::CommitImageSu
|
||
|
MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?");
|
||
|
#endif
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__,
|
||
|
- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] "
|
||
|
+ "screenSize [%d x %d]\n",
|
||
|
+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
|
||
|
|
||
|
mDelayedImageCommits.AppendElement(
|
||
|
WindowImageSurface(mImageSurface, aRegion));
|
||
|
@@ -930,7 +930,7 @@ static void WaylandBufferDelayCommitHand
|
||
|
void WindowSurfaceWayland::CommitWaylandBuffer() {
|
||
|
MOZ_ASSERT(mPendingCommit, "Committing empty surface!");
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this));
|
||
|
LOGWAYLAND(
|
||
|
(" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly));
|
||
|
LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage));
|
||
|
@@ -940,8 +940,8 @@ void WindowSurfaceWayland::CommitWayland
|
||
|
|
||
|
wl_surface* waylandSurface = mWindow->GetWaylandSurface();
|
||
|
if (!waylandSurface) {
|
||
|
- LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n",
|
||
|
- __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND((" [%p] mWindow->GetWaylandSurface() failed, delay commit.\n",
|
||
|
+ (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
|
||
|
@@ -969,8 +969,7 @@ void WindowSurfaceWayland::CommitWayland
|
||
|
// 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));
|
||
|
+ LOGWAYLAND((" [%p] wait for frame callback.\n", (void*)this));
|
||
|
// We have an active frame callback pending from our recent surface.
|
||
|
// It means we should defer the commit to FrameCallbackHandler().
|
||
|
return;
|
||
|
@@ -1022,10 +1021,11 @@ void WindowSurfaceWayland::Commit(const
|
||
|
gfx::IntRect bounds = aInvalidRegion.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, mBufferScreenRect.width,
|
||
|
- mBufferScreenRect.height));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::Commit [%p] lockSize [%d x %d] screenSize [%d "
|
||
|
+ "x %d]\n",
|
||
|
+ (void*)this, lockSize.width, lockSize.height, mBufferScreenRect.width,
|
||
|
+ mBufferScreenRect.height));
|
||
|
LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n",
|
||
|
mDrawToWaylandBufferDirectly));
|
||
|
LOGWAYLAND(
|
||
|
@@ -1064,7 +1064,8 @@ void WindowSurfaceWayland::FrameCallback
|
||
|
MOZ_ASSERT(mLastCommittedSurface != nullptr,
|
||
|
"FrameCallbackHandler() called without valid wl_surface!");
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::FrameCallbackHandler [%p]\n", (void*)this));
|
||
|
|
||
|
wl_callback_destroy(mFrameCallback);
|
||
|
mFrameCallback = nullptr;
|
||
|
@@ -1077,7 +1078,8 @@ void WindowSurfaceWayland::FrameCallback
|
||
|
void WindowSurfaceWayland::DelayedCommitHandler() {
|
||
|
MOZ_ASSERT(mDelayedCommitHandle != nullptr, "Missing mDelayedCommitHandle!");
|
||
|
|
||
|
- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this));
|
||
|
+ LOGWAYLAND(
|
||
|
+ ("WindowSurfaceWayland::DelayedCommitHandler [%p]\n", (void*)this));
|
||
|
|
||
|
*mDelayedCommitHandle = nullptr;
|
||
|
free(mDelayedCommitHandle);
|