1 #ifndef __NV50_SCREEN_H__
2 #define __NV50_SCREEN_H__
4 #include "nouveau/nouveau_screen.h"
5 #include "nouveau/nouveau_fence.h"
6 #include "nouveau/nouveau_mm.h"
7 #include "nouveau/nouveau_heap.h"
9 #include "nv50_winsys.h"
10 #include "nv50_stateobj.h"
12 #define NV50_TIC_MAX_ENTRIES 2048
13 #define NV50_TSC_MAX_ENTRIES 2048
17 #define NV50_CODE_BO_SIZE_LOG2 19
19 #define NV50_SCRATCH_SIZE (2 << 20)
20 #define NV50_SCRATCH_NR_BUFFERS 2
22 #define NV50_SCREEN_RESIDENT_BO_COUNT 5
27 struct nouveau_screen base
;
29 struct nv50_context
*cur_ctx
;
31 struct nouveau_bo
*code
;
32 struct nouveau_bo
*uniforms
;
33 struct nouveau_bo
*txc
; /* TIC (offset 0) and TSC (65536) */
34 struct nouveau_bo
*stack_bo
;
35 struct nouveau_bo
*tls_bo
;
39 struct nouveau_heap
*vp_code_heap
;
40 struct nouveau_heap
*gp_code_heap
;
41 struct nouveau_heap
*fp_code_heap
;
43 struct nv50_blitctx
*blitctx
;
48 uint32_t lock
[NV50_TIC_MAX_ENTRIES
/ 32];
54 uint32_t lock
[NV50_TSC_MAX_ENTRIES
/ 32];
59 struct nouveau_bo
*bo
;
62 struct nouveau_object
*sync
;
64 struct nouveau_object
*tesla
;
65 struct nouveau_object
*eng2d
;
66 struct nouveau_object
*m2mf
;
69 static INLINE
struct nv50_screen
*
70 nv50_screen(struct pipe_screen
*screen
)
72 return (struct nv50_screen
*)screen
;
75 boolean
nv50_blitctx_create(struct nv50_screen
*);
77 int nv50_screen_tic_alloc(struct nv50_screen
*, void *);
78 int nv50_screen_tsc_alloc(struct nv50_screen
*, void *);
81 nv50_resource_fence(struct nv04_resource
*res
, uint32_t flags
)
83 struct nv50_screen
*screen
= nv50_screen(res
->base
.screen
);
86 nouveau_fence_ref(screen
->base
.fence
.current
, &res
->fence
);
87 if (flags
& NOUVEAU_BO_WR
)
88 nouveau_fence_ref(screen
->base
.fence
.current
, &res
->fence_wr
);
93 nv50_resource_validate(struct nv04_resource
*res
, uint32_t flags
)
95 if (likely(res
->bo
)) {
96 if (flags
& NOUVEAU_BO_WR
)
97 res
->status
|= NOUVEAU_BUFFER_STATUS_GPU_WRITING
;
98 if (flags
& NOUVEAU_BO_RD
)
99 res
->status
|= NOUVEAU_BUFFER_STATUS_GPU_READING
;
101 nv50_resource_fence(res
, flags
);
112 extern const struct nv50_format nv50_format_table
[];
115 nv50_screen_tic_unlock(struct nv50_screen
*screen
, struct nv50_tic_entry
*tic
)
118 screen
->tic
.lock
[tic
->id
/ 32] &= ~(1 << (tic
->id
% 32));
122 nv50_screen_tsc_unlock(struct nv50_screen
*screen
, struct nv50_tsc_entry
*tsc
)
125 screen
->tsc
.lock
[tsc
->id
/ 32] &= ~(1 << (tsc
->id
% 32));
129 nv50_screen_tic_free(struct nv50_screen
*screen
, struct nv50_tic_entry
*tic
)
132 screen
->tic
.entries
[tic
->id
] = NULL
;
133 screen
->tic
.lock
[tic
->id
/ 32] &= ~(1 << (tic
->id
% 32));
138 nv50_screen_tsc_free(struct nv50_screen
*screen
, struct nv50_tsc_entry
*tsc
)
141 screen
->tsc
.entries
[tsc
->id
] = NULL
;
142 screen
->tsc
.lock
[tsc
->id
/ 32] &= ~(1 << (tsc
->id
% 32));