correctly figure out bits per pixel in the direct window info code, this fixes direct windows in the Accelerant test environment, added a note about how the all windows lock seems to be grabbed for the entire duration of a client update on R5, which cannot quite be the truth, because apps crashing in BView::Draw() would take lock up the app_server, added skipping the processing of drawing messages if the current drawing region is empty, added currently disabled code for clearing the view right before the client draws it... doesn't work for some reason unfortunately

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15625 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-12-20 22:30:02 +00:00
parent 33ab390e50
commit a07317fc10
1 changed files with 66 additions and 2 deletions

View File

@ -880,12 +880,22 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
case AS_BEGIN_UPDATE:
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title()));
// NOTE: when line below is turned on, the behaviour starts to
// be very much like on R5, but if the client crashes in
// one of it's BView's Draw() functions, AS_END_UPDATE is
// never received and the app_server is toast! Maybe R5
// does something like this, but if the write lock cannot
// be optained within a certain amount of time, it crashes
// whoever holds the read lock on purpose.
//fDesktop->LockSingleWindow();
fWindowLayer->BeginUpdate();
break;
case AS_END_UPDATE:
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title()));
fWindowLayer->EndUpdate();
//fDesktop->UnlockSingleWindow();
break;
case AS_LAYER_DELETE_ROOT:
@ -1771,6 +1781,15 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
fCurrentDrawingRegionValid = true;
}
if (fCurrentDrawingRegion.CountRects() <= 0) {
if (link.NeedsReply()) {
// the client is now blocking and waiting for a reply!
fLink.StartMessage(B_ERROR);
fLink.Flush();
}
return;
}
// prevent other ServerWindows from messing with the drawing engine
// as long as each uses the same instance... TODO: remove the locking
// when each has its own
@ -2330,7 +2349,31 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
fDirectWindowData->buffer_info->bits = buffer->Bits();
fDirectWindowData->buffer_info->pci_bits = NULL; // TODO
fDirectWindowData->buffer_info->bytes_per_row = buffer->BytesPerRow();
fDirectWindowData->buffer_info->bits_per_pixel = buffer->BytesPerRow() / buffer->Width() * 8;
switch (buffer->ColorSpace()) {
case B_RGB32:
case B_RGBA32:
case B_RGB32_BIG:
case B_RGBA32_BIG:
fDirectWindowData->buffer_info->bits_per_pixel = 32;
break;
case B_RGB24:
case B_RGB24_BIG:
fDirectWindowData->buffer_info->bits_per_pixel = 24;
break;
case B_RGB16:
case B_RGB16_BIG:
case B_RGB15:
case B_RGB15_BIG:
fDirectWindowData->buffer_info->bits_per_pixel = 16;
break;
case B_CMAP8:
fDirectWindowData->buffer_info->bits_per_pixel = 8;
break;
default:
fprintf(stderr, "unkown colorspace in HandleDirectConnection()!\n");
fDirectWindowData->buffer_info->bits_per_pixel = 0;
break;
}
fDirectWindowData->buffer_info->pixel_format = buffer->ColorSpace();
fDirectWindowData->buffer_info->layout = B_BUFFER_NONINTERLEAVED;
fDirectWindowData->buffer_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO
@ -2344,7 +2387,6 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
// We just want the region inside the window, border excluded.
BRegion clipRegion = fWindowLayer->VisibleContentRegion();
clipRegion.PrintToStream();
fDirectWindowData->buffer_info->clip_list_count = min_c(clipRegion.CountRects(),
kMaxClipRectsCount);
@ -2383,6 +2425,28 @@ ServerWindow::_SetCurrentLayer(ViewLayer* layer)
if (fCurrentLayer != layer) {
fCurrentLayer = layer;
fCurrentDrawingRegionValid = false;
#if 0
#if DELAYED_BACKGROUND_CLEARING
fWindowLayer->ReadLockWindows();
if (fCurrentLayer->IsBackgroundDirty() && fWindowLayer->InUpdate()) {
DrawingEngine* drawingEngine = fWindowLayer->GetDrawingEngine();
if (drawingEngine->Lock()) {
fWindowLayer->GetEffectiveDrawingRegion(fCurrentLayer, fCurrentDrawingRegion);
fCurrentDrawingRegionValid = true;
BRegion dirty(fCurrentDrawingRegion);
BRegion content;
fWindowLayer->GetContentRegion(&content);
fCurrentLayer->Draw(drawingEngine, &dirty, &content, false);
drawingEngine->Unlock();
}
}
fWindowLayer->ReadUnlockWindows();
#endif
#endif // 0
}
}