[Mesa-dev] [PATCH 4/5] st/dri2 Plumb the flush_swapbuffer functionality through to dri3
Thomas Hellstrom
thellstrom at vmware.com
Thu Jun 22 10:42:36 UTC 2017
Implement the state tracker manager drawable interface flush_swapbuffer
method by plumping it through to dri3 if avilable.
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
src/gallium/state_trackers/dri/dri2.c | 16 ++++++++++++++++
src/gallium/state_trackers/dri/dri_drawable.c | 18 ++++++++++++++++++
src/gallium/state_trackers/dri/dri_drawable.h | 2 ++
3 files changed, 36 insertions(+)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 625678f..e67e4e4 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -757,6 +757,21 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
}
}
+/**
+ * The struct dri_drawable flush_swapbuffers callback
+ */
+static void
+dri2_flush_swapbuffers(struct dri_context *ctx,
+ struct dri_drawable *drawable)
+{
+ __DRIdrawable *dri_drawable = drawable->dPriv;
+ const __DRIimageLoaderExtension *image = drawable->sPriv->image.loader;
+
+ if (image && image->base.version >= 2 && image->flushSwapBuffers) {
+ image->flushSwapBuffers(dri_drawable, dri_drawable->loaderPrivate);
+ }
+}
+
static void
dri2_update_tex_buffer(struct dri_drawable *drawable,
struct dri_context *ctx,
@@ -1936,6 +1951,7 @@ dri2_create_buffer(__DRIscreen * sPriv,
drawable->allocate_textures = dri2_allocate_textures;
drawable->flush_frontbuffer = dri2_flush_frontbuffer;
drawable->update_tex_buffer = dri2_update_tex_buffer;
+ drawable->flush_swapbuffers = dri2_flush_swapbuffers;
return TRUE;
}
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 743041b..109f9d8 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -121,6 +121,23 @@ dri_st_framebuffer_flush_front(struct st_context_iface *stctx,
}
/**
+ * 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.
*/
boolean
@@ -144,6 +161,7 @@ dri_create_buffer(__DRIscreen * sPriv,
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;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index 1f9842e..7c45004 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -85,6 +85,8 @@ struct dri_drawable
void (*update_tex_buffer)(struct dri_drawable *drawable,
struct dri_context *ctx,
struct pipe_resource *res);
+ void (*flush_swapbuffers)(struct dri_context *ctx,
+ struct dri_drawable *drawable);
};
static inline struct dri_drawable *
--
2.7.4
More information about the mesa-dev
mailing list