summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_context.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-26 12:26:02 +0800
committerChia-I Wu <[email protected]>2013-06-26 16:42:45 +0800
commit3eb6754e94c623c4c2393f23aeaafa933bee154e (patch)
tree1df7b9df4f461ffc13cec2d835a3afc1a111e8b2 /src/gallium/drivers/ilo/ilo_context.c
parent79385950f383771b9021f7b5f016da09a80600d4 (diff)
ilo: support PIPE_CAP_USER_CONSTANT_BUFFERS
We need it for HUD support, and will need it for push constants in the future.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_context.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_context.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c
index d3e900661ee..e355a9c3089 100644
--- a/src/gallium/drivers/ilo/ilo_context.c
+++ b/src/gallium/drivers/ilo/ilo_context.c
@@ -25,6 +25,7 @@
* Chia-I Wu <[email protected]>
*/
+#include "util/u_upload_mgr.h"
#include "intel_chipset.h"
#include "ilo_3d.h"
@@ -96,7 +97,8 @@ ilo_context_destroy(struct pipe_context *pipe)
if (ilo->last_cp_bo)
intel_bo_unreference(ilo->last_cp_bo);
- util_slab_destroy(&ilo->transfer_mempool);
+ if (ilo->uploader)
+ u_upload_destroy(ilo->uploader);
if (ilo->blitter)
ilo_blitter_destroy(ilo->blitter);
@@ -107,6 +109,8 @@ ilo_context_destroy(struct pipe_context *pipe)
if (ilo->cp)
ilo_cp_destroy(ilo->cp);
+ util_slab_destroy(&ilo->transfer_mempool);
+
FREE(ilo);
}
@@ -123,6 +127,13 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
ilo->winsys = is->winsys;
ilo->dev = &is->dev;
+ /*
+ * initialize first, otherwise it may not be safe to call
+ * ilo_context_destroy() on errors
+ */
+ util_slab_create(&ilo->transfer_mempool,
+ sizeof(struct ilo_transfer), 64, UTIL_SLAB_SINGLETHREADED);
+
ilo->cp = ilo_cp_create(ilo->winsys, is->dev.has_llc);
ilo->shader_cache = ilo_shader_cache_create();
if (ilo->cp)
@@ -133,12 +144,16 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
return NULL;
}
+ ilo->uploader = u_upload_create(&ilo->base, 1024 * 1024, 16,
+ PIPE_BIND_CONSTANT_BUFFER);
+ if (!ilo->uploader) {
+ ilo_context_destroy(&ilo->base);
+ return NULL;
+ }
+
ilo_cp_set_flush_callback(ilo->cp,
ilo_context_cp_flushed, (void *) ilo);
- util_slab_create(&ilo->transfer_mempool,
- sizeof(struct ilo_transfer), 64, UTIL_SLAB_SINGLETHREADED);
-
ilo->base.screen = screen;
ilo->base.priv = priv;