summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorLauri Kasanen <[email protected]>2011-08-19 18:23:10 +0300
committerBrian Paul <[email protected]>2011-08-19 16:49:33 -0600
commit421235d42ad9921fd45332ec7b33bcee5c1ad33d (patch)
tree0de533100d83ae54b35449c0fed14c9d0e3b4258 /src/gallium/state_trackers
parent6a6441fc03b4f28bfd2619e4e6d260cf6ea82554 (diff)
st/dri: Bind the post-processing queue to dri
Signed-off-by: Lauri Kasanen <[email protected]> Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c24
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.h3
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c8
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c13
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c3
5 files changed, 47 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index e6612b1911d..bc8dacba1b7 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -48,6 +48,16 @@ dri_init_extensions(struct dri_context *ctx)
driInitExtensions(st->ctx, NULL, GL_FALSE);
}
+static void
+dri_pp_query(struct dri_context *ctx)
+{
+ unsigned int i;
+
+ for (i = 0; i < PP_FILTERS; i++) {
+ ctx->pp_enabled[i] = driQueryOptioni(&ctx->optionCache, pp_filters[i].name);
+ }
+}
+
GLboolean
dri_create_context(gl_api api, const struct gl_config * visual,
__DRIcontext * cPriv, void *sharedContextPrivate)
@@ -105,6 +115,11 @@ dri_create_context(gl_api api, const struct gl_config * visual,
if (api == API_OPENGL)
dri_init_extensions(ctx);
+ // Context successfully created. See if post-processing is requested.
+ dri_pp_query(ctx);
+
+ ctx->pp = pp_init(screen->base.screen, ctx->pp_enabled);
+
return GL_TRUE;
fail:
@@ -134,6 +149,8 @@ dri_destroy_context(__DRIcontext * cPriv)
ctx->st->flush(ctx->st, 0, NULL);
ctx->st->destroy(ctx->st);
+ if (ctx->pp) pp_free(ctx->pp);
+
FREE(ctx);
}
@@ -187,6 +204,13 @@ dri_make_current(__DRIcontext * cPriv,
ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
+ // This is ok to call here. If they are already init, it's a no-op.
+ if (draw->textures[ST_ATTACHMENT_BACK_LEFT] && draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]
+ && ctx->pp)
+ pp_init_fbos(ctx->pp, draw->textures[ST_ATTACHMENT_BACK_LEFT]->width0,
+ draw->textures[ST_ATTACHMENT_BACK_LEFT]->height0,
+ draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+
return GL_TRUE;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h
index 35105e861f9..cfc8e3345e5 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -34,6 +34,7 @@
#include "pipe/p_compiler.h"
#include "dri_wrapper.h"
+#include "postprocess/filters.h"
struct pipe_context;
struct pipe_fence;
@@ -61,6 +62,8 @@ struct dri_context
/* gallium */
struct st_api *stapi;
struct st_context_iface *st;
+ struct pp_queue_t *pp;
+ unsigned int pp_enabled[PP_FILTERS];
};
static INLINE struct dri_context *
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index c9647945d6e..dcb6fdf8f3c 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -51,10 +51,16 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_SECTION_QUALITY
/* DRI_CONF_FORCE_S3TC_ENABLE(false) */
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_PP_CELSHADE(0)
+ DRI_CONF_PP_NORED(0)
+ DRI_CONF_PP_NOGREEN(0)
+ DRI_CONF_PP_NOBLUE(0)
+ DRI_CONF_PP_JIMENEZMLAA(0, 0, 32)
+ DRI_CONF_PP_JIMENEZMLAA_COLOR(0, 0, 32)
DRI_CONF_SECTION_END
DRI_CONF_END;
-static const uint __driNConfigOptions = 3;
+static const uint __driNConfigOptions = 9;
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen,
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index cf476056f41..6cf237577ec 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -44,12 +44,19 @@
* DRI2 flush extension.
*/
static void
-dri2_flush_drawable(__DRIdrawable *draw)
+dri2_flush_drawable(__DRIdrawable *dPriv)
{
- struct dri_context *ctx = dri_get_current(draw->driScreenPriv);
+ struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+
+ struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
+
+ if (ctx) {
+ if (ptex && ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
+ pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
- if (ctx)
ctx->st->flush(ctx->st, 0, NULL);
+ }
}
static void
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
index a1879a8f46a..082df55e8ea 100644
--- a/src/gallium/state_trackers/dri/sw/drisw.c
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -136,6 +136,9 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
if (ptex) {
+ if (ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
+ pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+
ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
drisw_copy_to_front(dPriv, ptex);