maintain our own copy of direct_buffer_info as it can change without notice
fixed bug #3001 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "MesaSoftwareRenderer.h"
|
#include "MesaSoftwareRenderer.h"
|
||||||
|
|
||||||
|
#include <Autolock.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
|
||||||
@@ -203,6 +204,7 @@ MesaSoftwareRenderer::MesaSoftwareRenderer(BGLView* view, ulong options,
|
|||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fDirectModeEnabled(false),
|
fDirectModeEnabled(false),
|
||||||
fInfo(NULL),
|
fInfo(NULL),
|
||||||
|
fInfoLocker("info locker"),
|
||||||
fContext(NULL),
|
fContext(NULL),
|
||||||
fVisual(NULL),
|
fVisual(NULL),
|
||||||
fFrameBuffer(NULL),
|
fFrameBuffer(NULL),
|
||||||
@@ -324,6 +326,7 @@ MesaSoftwareRenderer::LockGL()
|
|||||||
|
|
||||||
BRect b = GLView()->Bounds();
|
BRect b = GLView()->Bounds();
|
||||||
color_space cs = B_RGBA32;
|
color_space cs = B_RGBA32;
|
||||||
|
|
||||||
if (fDirectModeEnabled && fInfo != NULL) {
|
if (fDirectModeEnabled && fInfo != NULL) {
|
||||||
cs = BScreen(GLView()->Window()).ColorSpace();
|
cs = BScreen(GLView()->Window()).ColorSpace();
|
||||||
}
|
}
|
||||||
@@ -436,6 +439,7 @@ MesaSoftwareRenderer::SwapBuffers(bool VSync)
|
|||||||
GLView()->DrawBitmap(fBitmap);
|
GLView()->DrawBitmap(fBitmap);
|
||||||
GLView()->UnlockLooper();
|
GLView()->UnlockLooper();
|
||||||
} else {
|
} else {
|
||||||
|
BAutolock lock(fInfoLocker);
|
||||||
uint8 bytesPerPixel = fInfo->bits_per_pixel / 8;
|
uint8 bytesPerPixel = fInfo->bits_per_pixel / 8;
|
||||||
uint32 bytesPerRow = fBitmap->BytesPerRow();
|
uint32 bytesPerRow = fBitmap->BytesPerRow();
|
||||||
for (uint32 i = 0; i < fInfo->clip_list_count; i++) {
|
for (uint32 i = 0; i < fInfo->clip_list_count; i++) {
|
||||||
@@ -556,7 +560,16 @@ MesaSoftwareRenderer::EnableDirectMode(bool enabled)
|
|||||||
void
|
void
|
||||||
MesaSoftwareRenderer::DirectConnected(direct_buffer_info *info)
|
MesaSoftwareRenderer::DirectConnected(direct_buffer_info *info)
|
||||||
{
|
{
|
||||||
fInfo = info;
|
BAutolock lock(fInfoLocker);
|
||||||
|
if (info) {
|
||||||
|
if (!fInfo)
|
||||||
|
fInfo = new direct_buffer_info();
|
||||||
|
memcpy(fInfo, info, sizeof(*info));
|
||||||
|
} else if (fInfo) {
|
||||||
|
delete fInfo;
|
||||||
|
fInfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ private:
|
|||||||
|
|
||||||
BBitmap* fBitmap;
|
BBitmap* fBitmap;
|
||||||
bool fDirectModeEnabled;
|
bool fDirectModeEnabled;
|
||||||
direct_buffer_info* fInfo;
|
direct_buffer_info* fInfo;
|
||||||
|
BLocker fInfoLocker;
|
||||||
|
|
||||||
GLcontext* fContext;
|
GLcontext* fContext;
|
||||||
GLvisual* fVisual;
|
GLvisual* fVisual;
|
||||||
|
|||||||
Reference in New Issue
Block a user