}
+static int
+hgl_st_manager_get_param(struct st_manager *smapi, enum st_manager_param param)
+{
+ CALLED();
+
+ switch (param) {
+ case ST_MANAGER_BROKEN_INVALIDATE:
+ TRACE("%s: TODO: How should we handle BROKEN_INVALIDATE calls?\n",
+ __func__);
+ // For now we force validation of the framebuffer.
+ return 1;
+ }
+
+ return 0;
+}
+
+
/**
* Create new framebuffer
*/
// Copy context visual into framebuffer
memcpy(&buffer->visual, context->stVisual, sizeof(struct st_visual));
- // calloc our st_framebuffer interface
+ // calloc and configure our st_framebuffer interface
buffer->stfbi = CALLOC_STRUCT(st_framebuffer_iface);
if (!buffer->stfbi) {
ERROR("%s: Couldn't calloc framebuffer!\n", __func__);
return buffer;
}
+
+
+struct st_manager *
+hgl_create_st_manager(struct pipe_screen* screen)
+{
+ CALLED();
+
+ assert(screen);
+ struct st_manager* manager = CALLOC_STRUCT(st_manager);
+
+ if (!manager) {
+ ERROR("%s: Couldn't allocate state tracker manager!\n", __func__);
+ return NULL;
+ }
+
+ //manager->display = dpy;
+ manager->screen = screen;
+ manager->get_param = hgl_st_manager_get_param;
+
+ return manager;
+}
+
+
+void
+hgl_destroy_st_manager(struct st_manager *manager)
+{
+ CALLED();
+
+ if (manager)
+ FREE(manager);
+}
}
-static int
-hook_stm_get_param(struct st_manager *smapi, enum st_manager_param param)
-{
- CALLED();
-
- switch (param) {
- case ST_MANAGER_BROKEN_INVALIDATE:
- TRACE("%s: TODO: How should we handle BROKEN_INVALIDATE calls?\n",
- __func__);
- // For now we force validation of the framebuffer.
- return 1;
- }
-
- return 0;
-}
-
-
GalliumContext::GalliumContext(ulong options)
:
fOptions(options),
return -1;
}
- context->manager = CALLOC_STRUCT(st_manager);
- if (!context->manager) {
- ERROR("%s: Couldn't allocate Mesa state tracker manager!\n", __func__);
- return -1;
- }
- context->manager->get_param = hook_stm_get_param;
+ // Create state_tracker manager
+ context->manager = hgl_create_st_manager(fScreen);
// Create state tracker visual
context->stVisual = CreateVisual();
return -1;
}
- // We need to assign the screen *before* calling st_api create_context
- context->manager->screen = fScreen;
-
// Build state tracker attributes
struct st_context_attribs attribs;
memset(&attribs, 0, sizeof(attribs));
FREE(fContext[contextID]->stVisual);
if (fContext[contextID]->manager)
- FREE(fContext[contextID]->manager);
+ hgl_destroy_st_manager(fContext[contextID]->manager);
FREE(fContext[contextID]);
}
if (fContext[i] && fContext[i]->st) {
struct st_context *stContext = (struct st_context*)fContext[i]->st;
_mesa_set_viewport(stContext->ctx, 0, 0, 0, width, height);
- st_manager_validate_framebuffers(stContext);
+ st_manager_validate_framebuffers(stContext);
}
}
}