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); \
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)
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);