summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.h1
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c47
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.h2
3 files changed, 40 insertions, 10 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index ae65f8a20c6..6499f3ef790 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -27,6 +27,7 @@
#include "nv50/nv50_2d.xml.h"
#include "nvc0/nvc0_m2mf.xml.h"
#include "nvc0/nve4_p2mf.xml.h"
+#include "nvc0/nvc0_compute.xml.h"
#include "nvc0/nvc0_macros.h"
/* NOTE: must keep NVC0_NEW_3D_...PROG in consecutive bits in this order */
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index a4f16055212..6c6d1779f58 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -701,6 +701,42 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
return 0;
}
+int
+nvc0_screen_resize_text_area(struct nvc0_screen *screen, uint64_t size)
+{
+ struct nouveau_pushbuf *push = screen->base.pushbuf;
+ struct nouveau_bo *bo;
+ int ret;
+
+ ret = nouveau_bo_new(screen->base.device, NV_VRAM_DOMAIN(&screen->base),
+ 1 << 17, size, NULL, &bo);
+ if (ret)
+ return ret;
+
+ nouveau_bo_ref(NULL, &screen->text);
+ screen->text = bo;
+
+ nouveau_heap_destroy(&screen->lib_code);
+ nouveau_heap_destroy(&screen->text_heap);
+
+ /* XXX: getting a page fault at the end of the code buffer every few
+ * launches, don't use the last 256 bytes to work around them - prefetch ?
+ */
+ nouveau_heap_init(&screen->text_heap, 0, size - 0x100);
+
+ /* update the code segment setup */
+ BEGIN_NVC0(push, NVC0_3D(CODE_ADDRESS_HIGH), 2);
+ PUSH_DATAh(push, screen->text->offset);
+ PUSH_DATA (push, screen->text->offset);
+ if (screen->compute) {
+ BEGIN_NVC0(push, NVC0_CP(CODE_ADDRESS_HIGH), 2);
+ PUSH_DATAh(push, screen->text->offset);
+ PUSH_DATA (push, screen->text->offset);
+ }
+
+ return 0;
+}
+
#define FAIL_SCREEN_INIT(str, err) \
do { \
NOUVEAU_ERR(str, err); \
@@ -951,16 +987,10 @@ nvc0_screen_create(struct nouveau_device *dev)
nvc0_magic_3d_init(push, screen->eng3d->oclass);
- ret = nouveau_bo_new(dev, NV_VRAM_DOMAIN(&screen->base), 1 << 17, 1 << 20, NULL,
- &screen->text);
+ ret = nvc0_screen_resize_text_area(screen, 1 << 20);
if (ret)
FAIL_SCREEN_INIT("Error allocating TEXT area: %d\n", ret);
- /* XXX: getting a page fault at the end of the code buffer every few
- * launches, don't use the last 256 bytes to work around them - prefetch ?
- */
- nouveau_heap_init(&screen->text_heap, 0, (1 << 20) - 0x100);
-
ret = nouveau_bo_new(dev, NV_VRAM_DOMAIN(&screen->base), 1 << 12, 7 << 16, NULL,
&screen->uniform_bo);
if (ret)
@@ -1044,9 +1074,6 @@ nvc0_screen_create(struct nouveau_device *dev)
if (ret)
FAIL_SCREEN_INIT("Error allocating TLS area: %d\n", ret);
- BEGIN_NVC0(push, NVC0_3D(CODE_ADDRESS_HIGH), 2);
- PUSH_DATAh(push, screen->text->offset);
- PUSH_DATA (push, screen->text->offset);
BEGIN_NVC0(push, NVC0_3D(TEMP_ADDRESS_HIGH), 4);
PUSH_DATAh(push, screen->tls->offset);
PUSH_DATA (push, screen->tls->offset);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
index 672d515de2b..aff0308e823 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -136,6 +136,8 @@ int nvc0_screen_tsc_alloc(struct nvc0_screen *, void *);
int nve4_screen_compute_setup(struct nvc0_screen *, struct nouveau_pushbuf *);
int nvc0_screen_compute_setup(struct nvc0_screen *, struct nouveau_pushbuf *);
+int nvc0_screen_resize_text_area(struct nvc0_screen *, uint64_t);
+
static inline void
nvc0_resource_fence(struct nv04_resource *res, uint32_t flags)
{