[Mesa-dev] [PATCH 1/3] gallium: add expand_resource interface
Grigori Goronzy
greg at chown.ath.cx
Wed Jul 10 09:20:47 PDT 2013
This interface is used to expand fast-cleared window system
colorbuffers.
---
src/gallium/include/pipe/p_context.h | 8 ++++++++
src/gallium/state_trackers/dri/common/dri_drawable.c | 4 ++++
src/gallium/state_trackers/dri/drm/dri2.c | 8 ++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index aa18cbf..38d5ee6 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -354,6 +354,14 @@ struct pipe_context {
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
+ /**
+ * Expand a color resource in-place.
+ *
+ * \return TRUE if resource was expanded, FALSE otherwise
+ */
+ boolean (*expand_resource)(struct pipe_context *pipe,
+ struct pipe_resource *dst);
+
/** Flush draw commands
*
* \param flags bitfield of enum pipe_flush_flags values.
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index 18d8d89..b67a497 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -448,6 +448,10 @@ dri_flush(__DRIcontext *cPriv,
}
/* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */
+ } else if (ctx->st->pipe->expand_resource) {
+ /* Expand fast-cleared framebuffer */
+ ctx->st->pipe->expand_resource(ctx->st->pipe,
+ drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
}
dri_postprocessing(ctx, drawable, ST_ATTACHMENT_BACK_LEFT);
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 1dcc1f7..97784ec 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -490,18 +490,22 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
{
__DRIdrawable *dri_drawable = drawable->dPriv;
struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
+ struct pipe_context *pipe = ctx->st->pipe;
if (statt != ST_ATTACHMENT_FRONT_LEFT)
return;
if (drawable->stvis.samples > 1) {
- struct pipe_context *pipe = ctx->st->pipe;
-
/* Resolve the front buffer. */
dri_pipe_blit(ctx->st->pipe,
drawable->textures[ST_ATTACHMENT_FRONT_LEFT],
drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT]);
pipe->flush(pipe, NULL, 0);
+ } else if (pipe->expand_resource && drawable->textures[ST_ATTACHMENT_FRONT_LEFT]) {
+ /* Expand fast-cleared framebuffer */
+ if (pipe->expand_resource(pipe, drawable->textures[ST_ATTACHMENT_FRONT_LEFT])) {
+ pipe->flush(pipe, NULL, 0);
+ }
}
if (loader->flushFrontBuffer) {
--
1.8.1.2
More information about the mesa-dev
mailing list