// Perform a safe void to hgl_buffer cast
-static inline struct hgl_buffer*
+//static inline struct hgl_buffer*
+struct hgl_buffer*
hgl_st_framebuffer(struct st_framebuffer_iface *stfbi)
{
struct hgl_buffer* buffer;
CALLED();
//struct hgl_context* context = hgl_st_context(stctxi);
- //struct hgl_buffer* buffer = hgl_st_context(stfbi);
+ // struct hgl_buffer* buffer = hgl_st_context(stfbi);
+ struct hgl_buffer* buffer = hgl_st_framebuffer(stfbi);
+ //buffer->surface
#if 0
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
//manager->display = dpy;
manager->screen = context->screen;
manager->get_param = hgl_st_manager_get_param;
-
+ manager->st_manager_private = (void *)context;
+
return manager;
}
unsigned mask;
struct pipe_screen* screen;
+ struct pipe_surface* surface;
+
enum pipe_texture_target target;
struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
struct hgl_buffer* read;
};
+// hgl_buffer from statetracker interface
+struct hgl_buffer* hgl_st_framebuffer(struct st_framebuffer_iface *stfbi);
// hgl state_tracker api
struct st_api* hgl_create_st_api(void);
#include "sw/hgl/hgl_sw_winsys.h"
#include "util/u_atomic.h"
#include "util/u_memory.h"
+#include "util/u_framebuffer.h"
#include "target-helpers/inline_sw_helper.h"
#include "target-helpers/inline_debug_helper.h"
ERROR("%s: context not found\n", __func__);
return B_ERROR;
}
-
- // TODO: Where did st_notify_swapbuffers go?
- //st_notify_swapbuffers(context->draw->stfbi);
-
context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
- struct st_context *stContext = (struct st_context*)context->st;
-
- unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs;
- for (unsigned i = 0; i < nColorBuffers; i++) {
- pipe_surface* surface = stContext->state.framebuffer.cbufs[i];
- if (!surface) {
- ERROR("%s: Color buffer %d invalid!\n", __func__, i);
- continue;
- }
-
- TRACE("%s: Flushing color buffer #%d\n", __func__, i);
-
- // We pass our destination bitmap to flush_fronbuffer which passes it
- // to the private winsys display call.
- fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
- context->bitmap, NULL);
+ struct hgl_buffer* buffer = hgl_st_framebuffer(context->draw->stfbi);
+ pipe_surface* surface = buffer->surface;
+ if (!surface) {
+ ERROR("%s: Invalid drawable surface!\n", __func__);
+ return B_ERROR;
}
- #if 0
- // TODO... should we flush the z stencil buffer?
- pipe_surface* zSurface = stContext->state.framebuffer.zsbuf;
- fScreen->flush_frontbuffer(fScreen, zSurface->texture, 0, 0,
+ fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
context->bitmap, NULL);
- #endif
return B_OK;
}
fDitherMap(NULL)
{
fRoster = new GLRendererRoster(this, options);
+ fRenderer = fRoster->GetRenderer();
}
// TODO: acquire the OpenGL API lock it on this glview
fDisplayLock.Lock();
- if (fRenderer)
+ if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
fRenderer->LockGL();
}
void
BGLView::UnlockGL()
{
- if (fRenderer)
+ if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
fRenderer->UnlockGL();
fDisplayLock.Unlock();
for (BView* view = this; view != NULL; view = view->Parent())
view->ConvertToParent(&fBounds);
- fRenderer = fRoster->GetRenderer();
if (fRenderer != NULL) {
// Jackburton: The following code was commented because it doesn't look
// good in "direct" mode: