swpipe: Cleanup; Store GalliumContext
* Store GalliumContext in st_manager_private
This commit is contained in:
@@ -49,37 +49,14 @@ static void
|
|||||||
hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
|
hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
|
||||||
GLsizei width, GLsizei height)
|
GLsizei width, GLsizei height)
|
||||||
{
|
{
|
||||||
TRACE("%s(glContext: %p, x: %d, y: %d, width: %d, height: %d\n", __func__,
|
TRACE("%s(glContext: %p, x: %d, y: %d, w: %d, h: %d\n", __func__,
|
||||||
glContext, x, y, width, height);
|
glContext, x, y, width, height);
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct hgl_context* context = DOWNCAST(hgl_context, gl_context, glContext);
|
|
||||||
|
|
||||||
if (!context) {
|
|
||||||
ERROR("%s: No context yet. bailing.\n", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 bitmapWidth;
|
|
||||||
int32 bitmapHeight;
|
|
||||||
|
|
||||||
get_bitmap_size(context->bitmap, &bitmapWidth, &bitmapHeight);
|
|
||||||
|
|
||||||
if (width != bitmapWidth || height != bitmapHeight) {
|
|
||||||
struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
|
|
||||||
struct gl_framebuffer *read = glContext->WinSysReadBuffer;
|
|
||||||
|
|
||||||
if (draw)
|
|
||||||
_mesa_resize_framebuffer(glContext, draw, bitmapWidth, bitmapHeight);
|
|
||||||
if (read)
|
|
||||||
_mesa_resize_framebuffer(glContext, read, bitmapWidth, bitmapHeight);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
|
struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
|
||||||
struct gl_framebuffer *read = glContext->WinSysReadBuffer;
|
struct gl_framebuffer *read = glContext->WinSysReadBuffer;
|
||||||
|
|
||||||
// TODO: SLOW! We need to check for changes in size here.
|
// TODO: SLOW! We need to check for changes in bitmap vs gl_framebuffer
|
||||||
|
// size before doing a _mesa_resize_framebuffer.
|
||||||
if (draw)
|
if (draw)
|
||||||
_mesa_resize_framebuffer(glContext, draw, width, height);
|
_mesa_resize_framebuffer(glContext, draw, width, height);
|
||||||
if (read)
|
if (read)
|
||||||
@@ -313,8 +290,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
|
|||||||
// Convert Mesa calculated visual into state tracker visual
|
// Convert Mesa calculated visual into state tracker visual
|
||||||
context->stVisual = hgl_fill_st_visual(glVisual);
|
context->stVisual = hgl_fill_st_visual(glVisual);
|
||||||
|
|
||||||
context->draw = new GalliumFramebuffer(context->stVisual);
|
context->draw = new GalliumFramebuffer(context->stVisual, (void*)this);
|
||||||
context->read = new GalliumFramebuffer(context->stVisual);
|
context->read = new GalliumFramebuffer(context->stVisual, (void*)this);
|
||||||
|
|
||||||
if (!context->draw || !context->read) {
|
if (!context->draw || !context->read) {
|
||||||
ERROR("%s: Problem allocating framebuffer!\n", __func__);
|
ERROR("%s: Problem allocating framebuffer!\n", __func__);
|
||||||
@@ -377,7 +354,7 @@ GalliumContext::CreateContext(Bitmap *bitmap)
|
|||||||
//context->postProcess = pp_init(fScreen, context->postProcessEnable);
|
//context->postProcess = pp_init(fScreen, context->postProcessEnable);
|
||||||
|
|
||||||
assert(!context->st->st_manager_private);
|
assert(!context->st->st_manager_private);
|
||||||
context->st->st_manager_private = (void*)context;
|
context->st->st_manager_private = (void*)this;
|
||||||
|
|
||||||
struct st_context *stContext = (struct st_context*)context->st;
|
struct st_context *stContext = (struct st_context*)context->st;
|
||||||
|
|
||||||
@@ -470,7 +447,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, context_id contextID)
|
|||||||
|
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
api->make_current(context->api, NULL, NULL, NULL);
|
api->make_current(context->api, NULL, NULL, NULL);
|
||||||
return B_ERROR;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything seems valid, lets set the new context.
|
// Everything seems valid, lets set the new context.
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ hgl_framebuffer_validate(struct st_framebuffer_iface* stfb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual)
|
GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual,
|
||||||
|
void* privateContext)
|
||||||
:
|
:
|
||||||
fBuffer(NULL)
|
fBuffer(NULL)
|
||||||
{
|
{
|
||||||
@@ -73,6 +74,7 @@ GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual)
|
|||||||
fBuffer->visual = visual;
|
fBuffer->visual = visual;
|
||||||
fBuffer->flush_front = hgl_framebuffer_flush_front;
|
fBuffer->flush_front = hgl_framebuffer_flush_front;
|
||||||
fBuffer->validate = hgl_framebuffer_validate;
|
fBuffer->validate = hgl_framebuffer_validate;
|
||||||
|
fBuffer->st_manager_private = privateContext;
|
||||||
|
|
||||||
pipe_mutex_init(fMutex);
|
pipe_mutex_init(fMutex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ extern "C" {
|
|||||||
|
|
||||||
class GalliumFramebuffer {
|
class GalliumFramebuffer {
|
||||||
public:
|
public:
|
||||||
GalliumFramebuffer(struct st_visual* visual);
|
GalliumFramebuffer(struct st_visual* visual,
|
||||||
|
void* privateContext);
|
||||||
~GalliumFramebuffer();
|
~GalliumFramebuffer();
|
||||||
status_t Lock();
|
status_t Lock();
|
||||||
status_t Unlock();
|
status_t Unlock();
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ hook_winsys_displaytarget_create(struct sw_winsys* winsys,
|
|||||||
unsigned textureUsage, enum pipe_format format, unsigned width,
|
unsigned textureUsage, enum pipe_format format, unsigned width,
|
||||||
unsigned height, unsigned alignment, unsigned* stride)
|
unsigned height, unsigned alignment, unsigned* stride)
|
||||||
{
|
{
|
||||||
CALLED();
|
TRACE("%s: %dx%d\n", __func__, width, height);
|
||||||
|
|
||||||
struct haiku_displaytarget* haikuDisplayTarget
|
struct haiku_displaytarget* haikuDisplayTarget
|
||||||
= CALLOC_STRUCT(haiku_displaytarget);
|
= CALLOC_STRUCT(haiku_displaytarget);
|
||||||
|
|||||||
Reference in New Issue
Block a user