Lines Matching refs:screen
263 struct nv50_screen *screen = nv50_screen(pscreen); in nv50_screen_destroy() local
265 if (screen->base.fence.current) { in nv50_screen_destroy()
266 nouveau_fence_wait(screen->base.fence.current); in nv50_screen_destroy()
267 nouveau_fence_ref (NULL, &screen->base.fence.current); in nv50_screen_destroy()
269 if (screen->base.pushbuf) in nv50_screen_destroy()
270 screen->base.pushbuf->user_priv = NULL; in nv50_screen_destroy()
272 if (screen->blitctx) in nv50_screen_destroy()
273 FREE(screen->blitctx); in nv50_screen_destroy()
275 nouveau_bo_ref(NULL, &screen->code); in nv50_screen_destroy()
276 nouveau_bo_ref(NULL, &screen->tls_bo); in nv50_screen_destroy()
277 nouveau_bo_ref(NULL, &screen->stack_bo); in nv50_screen_destroy()
278 nouveau_bo_ref(NULL, &screen->txc); in nv50_screen_destroy()
279 nouveau_bo_ref(NULL, &screen->uniforms); in nv50_screen_destroy()
280 nouveau_bo_ref(NULL, &screen->fence.bo); in nv50_screen_destroy()
282 nouveau_heap_destroy(&screen->vp_code_heap); in nv50_screen_destroy()
283 nouveau_heap_destroy(&screen->gp_code_heap); in nv50_screen_destroy()
284 nouveau_heap_destroy(&screen->fp_code_heap); in nv50_screen_destroy()
286 if (screen->tic.entries) in nv50_screen_destroy()
287 FREE(screen->tic.entries); in nv50_screen_destroy()
289 nouveau_object_del(&screen->tesla); in nv50_screen_destroy()
290 nouveau_object_del(&screen->eng2d); in nv50_screen_destroy()
291 nouveau_object_del(&screen->m2mf); in nv50_screen_destroy()
292 nouveau_object_del(&screen->sync); in nv50_screen_destroy()
294 nouveau_screen_fini(&screen->base); in nv50_screen_destroy()
296 FREE(screen); in nv50_screen_destroy()
302 struct nv50_screen *screen = nv50_screen(pscreen); in nv50_screen_fence_emit() local
303 struct nouveau_pushbuf *push = screen->base.pushbuf; in nv50_screen_fence_emit()
306 *sequence = ++screen->base.fence.sequence; in nv50_screen_fence_emit()
309 PUSH_DATAh(push, screen->fence.bo->offset); in nv50_screen_fence_emit()
310 PUSH_DATA (push, screen->fence.bo->offset); in nv50_screen_fence_emit()
327 nv50_screen_init_hwctx(struct nv50_screen *screen) in nv50_screen_init_hwctx() argument
329 struct nouveau_pushbuf *push = screen->base.pushbuf; in nv50_screen_init_hwctx()
333 fifo = (struct nv04_fifo *)screen->base.channel->data; in nv50_screen_init_hwctx()
336 PUSH_DATA (push, screen->m2mf->handle); in nv50_screen_init_hwctx()
338 PUSH_DATA (push, screen->sync->handle); in nv50_screen_init_hwctx()
343 PUSH_DATA (push, screen->eng2d->handle); in nv50_screen_init_hwctx()
345 PUSH_DATA (push, screen->sync->handle); in nv50_screen_init_hwctx()
359 PUSH_DATA (push, screen->tesla->handle); in nv50_screen_init_hwctx()
365 PUSH_DATA (push, screen->sync->handle); in nv50_screen_init_hwctx()
399 if (screen->tesla->oclass >= NVA0_3D_CLASS) { in nv50_screen_init_hwctx()
413 PUSH_DATAh(push, screen->code->offset + (0 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
414 PUSH_DATA (push, screen->code->offset + (0 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
417 PUSH_DATAh(push, screen->code->offset + (1 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
418 PUSH_DATA (push, screen->code->offset + (1 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
421 PUSH_DATAh(push, screen->code->offset + (2 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
422 PUSH_DATA (push, screen->code->offset + (2 << NV50_CODE_BO_SIZE_LOG2)); in nv50_screen_init_hwctx()
425 PUSH_DATAh(push, screen->tls_bo->offset); in nv50_screen_init_hwctx()
426 PUSH_DATA (push, screen->tls_bo->offset); in nv50_screen_init_hwctx()
427 PUSH_DATA (push, util_logbase2(screen->cur_tls_space / 8)); in nv50_screen_init_hwctx()
430 PUSH_DATAh(push, screen->stack_bo->offset); in nv50_screen_init_hwctx()
431 PUSH_DATA (push, screen->stack_bo->offset); in nv50_screen_init_hwctx()
435 PUSH_DATAh(push, screen->uniforms->offset + (0 << 16)); in nv50_screen_init_hwctx()
436 PUSH_DATA (push, screen->uniforms->offset + (0 << 16)); in nv50_screen_init_hwctx()
440 PUSH_DATAh(push, screen->uniforms->offset + (1 << 16)); in nv50_screen_init_hwctx()
441 PUSH_DATA (push, screen->uniforms->offset + (1 << 16)); in nv50_screen_init_hwctx()
445 PUSH_DATAh(push, screen->uniforms->offset + (2 << 16)); in nv50_screen_init_hwctx()
446 PUSH_DATA (push, screen->uniforms->offset + (2 << 16)); in nv50_screen_init_hwctx()
450 PUSH_DATAh(push, screen->uniforms->offset + (3 << 16)); in nv50_screen_init_hwctx()
451 PUSH_DATA (push, screen->uniforms->offset + (3 << 16)); in nv50_screen_init_hwctx()
468 PUSH_DATAh(push, screen->uniforms->offset + (3 << 16) + (1 << 9)); in nv50_screen_init_hwctx()
469 PUSH_DATA (push, screen->uniforms->offset + (3 << 16) + (1 << 9)); in nv50_screen_init_hwctx()
478 PUSH_DATAh(push, screen->txc->offset); in nv50_screen_init_hwctx()
479 PUSH_DATA (push, screen->txc->offset); in nv50_screen_init_hwctx()
483 PUSH_DATAh(push, screen->txc->offset + 65536); in nv50_screen_init_hwctx()
484 PUSH_DATA (push, screen->txc->offset + 65536); in nv50_screen_init_hwctx()
536 static int nv50_tls_alloc(struct nv50_screen *screen, unsigned tls_space, in nv50_tls_alloc() argument
539 struct nouveau_device *dev = screen->base.device; in nv50_tls_alloc()
542 screen->cur_tls_space = util_next_power_of_two(tls_space / ONE_TEMP_SIZE) * in nv50_tls_alloc()
547 *tls_size = screen->cur_tls_space * util_next_power_of_two(screen->TPs) * in nv50_tls_alloc()
548 screen->MPsInTP * LOCAL_WARPS_ALLOC * THREADS_IN_WARP; in nv50_tls_alloc()
551 *tls_size, NULL, &screen->tls_bo); in nv50_tls_alloc()
560 int nv50_tls_realloc(struct nv50_screen *screen, unsigned tls_space) in nv50_tls_realloc() argument
562 struct nouveau_pushbuf *push = screen->base.pushbuf; in nv50_tls_realloc()
566 if (tls_space < screen->cur_tls_space) in nv50_tls_realloc()
568 if (tls_space > screen->max_tls_space) { in nv50_tls_realloc()
573 (unsigned)(screen->max_tls_space / ONE_TEMP_SIZE)); in nv50_tls_realloc()
577 nouveau_bo_ref(NULL, &screen->tls_bo); in nv50_tls_realloc()
578 ret = nv50_tls_alloc(screen, tls_space, &tls_size); in nv50_tls_realloc()
583 PUSH_DATAh(push, screen->tls_bo->offset); in nv50_tls_realloc()
584 PUSH_DATA (push, screen->tls_bo->offset); in nv50_tls_realloc()
585 PUSH_DATA (push, util_logbase2(screen->cur_tls_space / 8)); in nv50_tls_realloc()
593 struct nv50_screen *screen; in nv50_screen_create() local
601 screen = CALLOC_STRUCT(nv50_screen); in nv50_screen_create()
602 if (!screen) in nv50_screen_create()
604 pscreen = &screen->base.base; in nv50_screen_create()
606 ret = nouveau_screen_init(&screen->base, dev); in nv50_screen_create()
615 screen->base.vidmem_bindings |= PIPE_BIND_CONSTANT_BUFFER | in nv50_screen_create()
617 screen->base.sysmem_bindings |= in nv50_screen_create()
620 screen->base.pushbuf->user_priv = screen; in nv50_screen_create()
621 screen->base.pushbuf->rsvd_kick = 5; in nv50_screen_create()
623 chan = screen->base.channel; in nv50_screen_create()
634 nouveau_screen_init_vdec(&screen->base); in nv50_screen_create()
637 NULL, &screen->fence.bo); in nv50_screen_create()
643 nouveau_bo_map(screen->fence.bo, 0, NULL); in nv50_screen_create()
644 screen->fence.map = screen->fence.bo->map; in nv50_screen_create()
645 screen->base.fence.emit = nv50_screen_fence_emit; in nv50_screen_create()
646 screen->base.fence.update = nv50_screen_fence_update; in nv50_screen_create()
650 sizeof(struct nv04_notify), &screen->sync); in nv50_screen_create()
657 NULL, 0, &screen->m2mf); in nv50_screen_create()
664 NULL, 0, &screen->eng2d); in nv50_screen_create()
697 screen->base.class_3d = tesla_class; in nv50_screen_create()
700 NULL, 0, &screen->tesla); in nv50_screen_create()
707 3 << NV50_CODE_BO_SIZE_LOG2, NULL, &screen->code); in nv50_screen_create()
713 nouveau_heap_init(&screen->vp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2); in nv50_screen_create()
714 nouveau_heap_init(&screen->gp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2); in nv50_screen_create()
715 nouveau_heap_init(&screen->fp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2); in nv50_screen_create()
719 screen->TPs = util_bitcount(value & 0xffff); in nv50_screen_create()
720 screen->MPsInTP = util_bitcount((value >> 24) & 0xf); in nv50_screen_create()
722 stack_size = util_next_power_of_two(screen->TPs) * screen->MPsInTP * in nv50_screen_create()
726 &screen->stack_bo); in nv50_screen_create()
732 uint64_t size_of_one_temp = util_next_power_of_two(screen->TPs) * in nv50_screen_create()
733 screen->MPsInTP * LOCAL_WARPS_ALLOC * THREADS_IN_WARP * in nv50_screen_create()
735 screen->max_tls_space = dev->vram_size / size_of_one_temp * ONE_TEMP_SIZE; in nv50_screen_create()
736 screen->max_tls_space /= 2; /* half of vram */ in nv50_screen_create()
739 screen->max_tls_space = MIN2(screen->max_tls_space, 64 << 10); in nv50_screen_create()
743 ret = nv50_tls_alloc(screen, tls_space, &tls_size); in nv50_screen_create()
749 screen->TPs, screen->MPsInTP, dev->vram_size >> 20, tls_size >> 10); in nv50_screen_create()
752 &screen->uniforms); in nv50_screen_create()
759 &screen->txc); in nv50_screen_create()
765 screen->tic.entries = CALLOC(4096, sizeof(void *)); in nv50_screen_create()
766 screen->tsc.entries = screen->tic.entries + 2048; in nv50_screen_create()
768 if (!nv50_blitctx_create(screen)) in nv50_screen_create()
771 nv50_screen_init_hwctx(screen); in nv50_screen_create()
773 nouveau_fence_new(&screen->base, &screen->base.fence.current, FALSE); in nv50_screen_create()
783 nv50_screen_tic_alloc(struct nv50_screen *screen, void *entry) in nv50_screen_tic_alloc() argument
785 int i = screen->tic.next; in nv50_screen_tic_alloc()
787 while (screen->tic.lock[i / 32] & (1 << (i % 32))) in nv50_screen_tic_alloc()
790 screen->tic.next = (i + 1) & (NV50_TIC_MAX_ENTRIES - 1); in nv50_screen_tic_alloc()
792 if (screen->tic.entries[i]) in nv50_screen_tic_alloc()
793 nv50_tic_entry(screen->tic.entries[i])->id = -1; in nv50_screen_tic_alloc()
795 screen->tic.entries[i] = entry; in nv50_screen_tic_alloc()
800 nv50_screen_tsc_alloc(struct nv50_screen *screen, void *entry) in nv50_screen_tsc_alloc() argument
802 int i = screen->tsc.next; in nv50_screen_tsc_alloc()
804 while (screen->tsc.lock[i / 32] & (1 << (i % 32))) in nv50_screen_tsc_alloc()
807 screen->tsc.next = (i + 1) & (NV50_TSC_MAX_ENTRIES - 1); in nv50_screen_tsc_alloc()
809 if (screen->tsc.entries[i]) in nv50_screen_tsc_alloc()
810 nv50_tsc_entry(screen->tsc.entries[i])->id = -1; in nv50_screen_tsc_alloc()
812 screen->tsc.entries[i] = entry; in nv50_screen_tsc_alloc()