1 #ifndef __NVC0_SCREEN_H__
2 #define __NVC0_SCREEN_H__
4 #include "nouveau/nouveau_screen.h"
5 #include "nouveau/nouveau_mm.h"
6 #include "nouveau/nouveau_fence.h"
7 #include "nouveau/nouveau_heap.h"
9 #include "nvc0_winsys.h"
10 #include "nvc0_stateobj.h"
12 #define NVC0_TIC_MAX_ENTRIES 2048
13 #define NVC0_TSC_MAX_ENTRIES 2048
17 #define NVC0_SCRATCH_SIZE (2 << 20)
18 #define NVC0_SCRATCH_NR_BUFFERS 2
20 #define NVC0_SCREEN_RESIDENT_BO_COUNT 5
25 struct nouveau_screen base
;
27 struct nvc0_context
*cur_ctx
;
29 int num_occlusion_queries_active
;
31 struct nouveau_bo
*text
;
32 struct nouveau_bo
*uniforms
;
33 struct nouveau_bo
*tls
;
34 struct nouveau_bo
*txc
; /* TIC (offset 0) and TSC (65536) */
35 struct nouveau_bo
*vfetch_cache
;
39 struct nouveau_heap
*text_heap
;
40 struct nouveau_heap
*lib_code
; /* allocated from text_heap */
42 struct nvc0_blitctx
*blitctx
;
45 struct nouveau_bo
*bo
[NVC0_SCRATCH_NR_BUFFERS
];
54 uint32_t lock
[NVC0_TIC_MAX_ENTRIES
/ 32];
60 uint32_t lock
[NVC0_TSC_MAX_ENTRIES
/ 32];
64 struct nouveau_bo
*bo
;
68 struct nouveau_mman
*mm_VRAM_fe0
;
70 struct nouveau_object
*fermi
;
71 struct nouveau_object
*eng2d
;
72 struct nouveau_object
*m2mf
;
73 struct nouveau_object
*dijkstra
;
76 static INLINE
struct nvc0_screen
*
77 nvc0_screen(struct pipe_screen
*screen
)
79 return (struct nvc0_screen
*)screen
;
82 boolean
nvc0_blitctx_create(struct nvc0_screen
*);
84 void nvc0_screen_make_buffers_resident(struct nvc0_screen
*);
86 int nvc0_screen_tic_alloc(struct nvc0_screen
*, void *);
87 int nvc0_screen_tsc_alloc(struct nvc0_screen
*, void *);
90 nvc0_resource_fence(struct nv04_resource
*res
, uint32_t flags
)
92 struct nvc0_screen
*screen
= nvc0_screen(res
->base
.screen
);
95 nouveau_fence_ref(screen
->base
.fence
.current
, &res
->fence
);
96 if (flags
& NOUVEAU_BO_WR
)
97 nouveau_fence_ref(screen
->base
.fence
.current
, &res
->fence_wr
);
102 nvc0_resource_validate(struct nv04_resource
*res
, uint32_t flags
)
104 if (likely(res
->bo
)) {
105 if (flags
& NOUVEAU_BO_WR
)
106 res
->status
|= NOUVEAU_BUFFER_STATUS_GPU_WRITING
;
107 if (flags
& NOUVEAU_BO_RD
)
108 res
->status
|= NOUVEAU_BUFFER_STATUS_GPU_READING
;
110 nvc0_resource_fence(res
, flags
);
121 extern const struct nvc0_format nvc0_format_table
[];
124 nvc0_screen_tic_unlock(struct nvc0_screen
*screen
, struct nv50_tic_entry
*tic
)
127 screen
->tic
.lock
[tic
->id
/ 32] &= ~(1 << (tic
->id
% 32));
131 nvc0_screen_tsc_unlock(struct nvc0_screen
*screen
, struct nv50_tsc_entry
*tsc
)
134 screen
->tsc
.lock
[tsc
->id
/ 32] &= ~(1 << (tsc
->id
% 32));
138 nvc0_screen_tic_free(struct nvc0_screen
*screen
, struct nv50_tic_entry
*tic
)
141 screen
->tic
.entries
[tic
->id
] = NULL
;
142 screen
->tic
.lock
[tic
->id
/ 32] &= ~(1 << (tic
->id
% 32));
147 nvc0_screen_tsc_free(struct nvc0_screen
*screen
, struct nv50_tsc_entry
*tsc
)
150 screen
->tsc
.entries
[tsc
->id
] = NULL
;
151 screen
->tsc
.lock
[tsc
->id
/ 32] &= ~(1 << (tsc
->id
% 32));