#include "util/u_memory.h"
#include "util/u_inlines.h"
+static uint32_t drifb_ID = 0;
+
static void
swap_fences_unref(struct dri_drawable *draw);
return TRUE;
/* Set the window-system buffers for the state tracker. */
- for (i = 0; i < count; i++) {
- out[i] = NULL;
+ for (i = 0; i < count; i++)
pipe_resource_reference(&out[i], textures[statts[i]]);
- }
return TRUE;
}
return TRUE;
}
+/**
+ * The state tracker framebuffer interface flush_swapbuffers callback
+ */
+static boolean
+dri_st_framebuffer_flush_swapbuffers(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi)
+{
+ struct dri_context *ctx = (struct dri_context *)stctx->st_manager_private;
+ struct dri_drawable *drawable =
+ (struct dri_drawable *) stfbi->st_manager_private;
+
+ if (drawable->flush_swapbuffers)
+ drawable->flush_swapbuffers(ctx, drawable);
+
+ return TRUE;
+}
+
/**
* This is called when we need to set up GL rendering to a new X window.
*/
drawable->base.visual = &drawable->stvis;
drawable->base.flush_front = dri_st_framebuffer_flush_front;
drawable->base.validate = dri_st_framebuffer_validate;
+ drawable->base.flush_swapbuffers = dri_st_framebuffer_flush_swapbuffers;
drawable->base.st_manager_private = (void *) drawable;
drawable->screen = screen;
dPriv->driverPrivate = (void *)drawable;
p_atomic_set(&drawable->base.stamp, 1);
+ drawable->base.ID = p_atomic_inc_return(&drifb_ID);
+ drawable->base.state_manager = &screen->base;
return GL_TRUE;
fail:
dri_destroy_buffer(__DRIdrawable * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct dri_screen *screen = drawable->screen;
+ struct st_api *stapi = screen->st_api;
int i;
pipe_surface_reference(&drawable->drisw_surface, NULL);
swap_fences_unref(drawable);
+ /* Notify the st manager that this drawable is no longer valid */
+ stapi->destroy_drawable(stapi, &drawable->base);
+
FREE(drawable);
}
GLint format, __DRIdrawable *dPriv)
{
struct dri_context *ctx = dri_context(pDRICtx);
+ struct st_context_iface *st = ctx->st;
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_resource *pt;
+ if (st->thread_finish)
+ st->thread_finish(st);
+
dri_drawable_validate_att(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT);
/* Use the pipe resource associated with the X drawable */
if (format == __DRI_TEXTURE_FORMAT_RGB) {
/* only need to cover the formats recognized by dri_fill_st_visual */
switch (internal_format) {
+ case PIPE_FORMAT_B10G10R10A2_UNORM:
+ internal_format = PIPE_FORMAT_B10G10R10X2_UNORM;
+ break;
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ internal_format = PIPE_FORMAT_R10G10B10X2_UNORM;
+ break;
case PIPE_FORMAT_BGRA8888_UNORM:
internal_format = PIPE_FORMAT_BGRX8888_UNORM;
break;
}
st = ctx->st;
+ if (st->thread_finish)
+ st->thread_finish(st);
if (drawable) {
/* prevent recursion */
dri_postprocessing(ctx, drawable, ST_ATTACHMENT_BACK_LEFT);
- if (ctx->hud) {
- hud_draw(ctx->hud, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
- }
-
- pipe->flush_resource(pipe, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
-
if (pipe->invalidate_resource &&
(flags & __DRI2_FLUSH_INVALIDATE_ANCILLARY)) {
if (drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
if (drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL])
pipe->invalidate_resource(pipe, drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]);
}
+
+ if (ctx->hud) {
+ hud_run(ctx->hud, ctx->st->cso_context,
+ drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
+ }
+
+ pipe->flush_resource(pipe, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
}
flush_flags = 0;
flush_flags |= ST_FLUSH_END_OF_FRAME;
/* Flush the context and throttle if needed. */
- if (dri_screen(ctx->sPriv)->throttling_enabled &&
+ if (dri_screen(ctx->sPriv)->default_throttle_frames &&
drawable &&
(reason == __DRI2_THROTTLE_SWAPBUFFER ||
reason == __DRI2_THROTTLE_FLUSHFRONT)) {