-
Notifications
You must be signed in to change notification settings - Fork 4
Revert "HaikuCompositor: use opaque region" #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 3e61d9b.
Does it help if put |
Thanks, give it a try! |
This didn't help ~/src/haikuports/dev-libs/wayland-server/work-0.1.20241217/sources/wayland-server-c7f42756cd10868fc9ca24e6a34bf2c05472d37c> git diff
diff --git a/HaikuCompositor.cpp b/HaikuCompositor.cpp
index 2c1daf3..5edd173 100644
--- a/HaikuCompositor.cpp
+++ b/HaikuCompositor.cpp
@@ -223,6 +223,7 @@ void WaylandView::Draw(BRect dirty)
if (mode == B_OP_ALPHA && fSurface->fState.opaqueRgn.has_value()) {
viewLocked->ConstrainClippingRegion(&fSurface->fState.opaqueRgn.value());
viewLocked->SetDrawingMode(B_OP_COPY);
+ viewLocked->ConstrainClippingRegion(NULL);
viewLocked->DrawBitmap(bmp);
BRegion remaining = viewLocked->Bounds();
remaining.Exclude(&fSurface->fState.opaqueRgn.value()); |
Not here, but before |
OK, let's try with ~/src/haikuports/dev-libs/wayland-server/work-0.1.20241217/sources/wayland-server-c7f42756cd10868fc9ca24e6a34bf2c05472d37c> git diff
diff --git a/HaikuCompositor.cpp b/HaikuCompositor.cpp
index 2c1daf3..1756835 100644
--- a/HaikuCompositor.cpp
+++ b/HaikuCompositor.cpp
@@ -220,6 +220,7 @@ void WaylandView::Draw(BRect dirty)
mode = B_OP_COPY;
break;
}
+ viewLocked->ConstrainClippingRegion(NULL);
if (mode == B_OP_ALPHA && fSurface->fState.opaqueRgn.has_value()) {
viewLocked->ConstrainClippingRegion(&fSurface->fState.opaqueRgn.value());
viewLocked->SetDrawingMode(B_OP_COPY); |
It didn't help too... |
Do we have option that revert this and change firefox surfaces to have colorspace without alpha? |
I thought it has something to do with drawing bitmap twice in single view lock, so I tried splitting view locking, but it didn't help. I felt Haiku has some special code path for clipping exclusion of complex region asynchronously, and the offloaded task has not enough priority, then it can't have chance to be executed in high CPU usage. ~/src/haikuports/dev-libs/wayland-server/work-0.1.20241217/sources/wayland-server-c7f42756cd10868fc9ca24e6a34bf2c05472d37c> git diff
diff --git a/HaikuCompositor.cpp b/HaikuCompositor.cpp
index 2c1daf3..2593378 100644
--- a/HaikuCompositor.cpp
+++ b/HaikuCompositor.cpp
@@ -205,7 +205,6 @@ void WaylandView::Draw(BRect dirty)
BBitmap *bmp = fSurface->Bitmap();
if (bmp != NULL) {
- auto viewLocked = AppKitPtrs::LockedPtr(this);
drawing_mode mode;
switch (bmp->ColorSpace()) {
case B_RGBA64:
@@ -221,15 +220,25 @@ void WaylandView::Draw(BRect dirty)
break;
}
if (mode == B_OP_ALPHA && fSurface->fState.opaqueRgn.has_value()) {
- viewLocked->ConstrainClippingRegion(&fSurface->fState.opaqueRgn.value());
- viewLocked->SetDrawingMode(B_OP_COPY);
+ {
+ auto viewLocked = AppKitPtrs::LockedPtr(this);
+ viewLocked->ConstrainClippingRegion(&fSurface->fState.opaqueRgn.value());
+ viewLocked->SetDrawingMode(B_OP_COPY);
+ viewLocked->DrawBitmap(bmp);
+ }
+ {
+ auto viewLocked = AppKitPtrs::LockedPtr(this);
+ BRegion remaining = viewLocked->Bounds();
+ remaining.Exclude(&fSurface->fState.opaqueRgn.value());
+ viewLocked->ConstrainClippingRegion(&remaining);
+ viewLocked->SetDrawingMode(mode);
+ viewLocked->DrawBitmap(bmp);
+ }
+ } else {
+ auto viewLocked = AppKitPtrs::LockedPtr(this);
+ viewLocked->SetDrawingMode(mode);
viewLocked->DrawBitmap(bmp);
- BRegion remaining = viewLocked->Bounds();
- remaining.Exclude(&fSurface->fState.opaqueRgn.value());
- viewLocked->ConstrainClippingRegion(&remaining);
}
- viewLocked->SetDrawingMode(mode);
- viewLocked->DrawBitmap(bmp);
}
fSurface->CallFrameCallbacks(); |
It seems related to BWindows transaction, but we (wayland-server) or related apps doesn't seem to call this
|
Draw transaction is automatically started when system calls |
Other cases BWindow enters in transactions are while UPDATE ing with app_server void
BWindow::DispatchMessage(BMessage* message, BHandler* target)
{
if (message == NULL)
return;
switch (message->what) {
// snip
case _UPDATE_:
{
//bigtime_t now = system_time();
//bigtime_t drawTime = 0;
STRACE(("info:BWindow handling _UPDATE_.\n"));
fLink->StartMessage(AS_BEGIN_UPDATE);
fInTransaction = true; or when BWindow is initialized with _InitData() with non-zero bitmapToken void
BWindow::_InitData(BRect frame, const char* title, window_look look,
window_feel feel, uint32 flags, uint32 workspace, int32 bitmapToken)
{
// snip
fFlags = flags | B_ASYNCHRONOUS_CONTROLS;
fInTransaction = bitmapToken >= 0; |
I saw BView::ConstrainClippingRegion() calls _FlushIfNotInTransaction() and guessed it seems relating to this. But you should have some expertise on app_server interaction, it just noise for you, sorry for disturbing... |
Reverting 3e61d9b fixes #20
I wonder why that change affects redrawing only when CPU is busy.