2 #ifndef __NVC0_RESOURCE_H__
3 #define __NVC0_RESOURCE_H__
5 #include "util/u_transfer.h"
6 #include "util/u_double_list.h"
8 #include "nouveau/nouveau_winsys.h"
11 #include "nvc0_fence.h"
16 /* Resources, if mapped into the GPU's address space, are guaranteed to
17 * have constant virtual addresses.
18 * The address of a resource will lie within the nouveau_bo referenced,
19 * and this bo should be added to the memory manager's validation list.
21 struct nvc0_resource
{
22 struct pipe_resource base
;
23 const struct u_resource_vtbl
*vtbl
;
27 struct nouveau_bo
*bo
;
32 struct nvc0_fence
*fence
;
33 struct list_head list
;
36 #define NVC0_TILE_H(m) (8 << ((m >> 4) & 0xf))
37 #define NVC0_TILE_D(m) (1 << (m >> 8))
39 struct nvc0_miptree_level
{
45 #define NVC0_MAX_TEXTURE_LEVELS 16
48 struct nvc0_resource base
;
49 struct nvc0_miptree_level level
[NVC0_MAX_TEXTURE_LEVELS
];
54 static INLINE
struct nvc0_miptree
*
55 nvc0_miptree(struct pipe_resource
*pt
)
57 return (struct nvc0_miptree
*)pt
;
60 static INLINE
struct nvc0_resource
*
61 nvc0_resource(struct pipe_resource
*resource
)
63 return (struct nvc0_resource
*)resource
;
66 /* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
68 nvc0_resource_mapped_by_gpu(struct pipe_resource
*resource
)
70 return nvc0_resource(resource
)->bo
->offset
!= 0ULL;
74 nvc0_init_resource_functions(struct pipe_context
*pcontext
);
77 nvc0_screen_init_resource_functions(struct pipe_screen
*pscreen
);
79 /* Internal functions:
81 struct pipe_resource
*
82 nvc0_miptree_create(struct pipe_screen
*pscreen
,
83 const struct pipe_resource
*tmp
);
85 struct pipe_resource
*
86 nvc0_miptree_from_handle(struct pipe_screen
*pscreen
,
87 const struct pipe_resource
*template,
88 struct winsys_handle
*whandle
);
90 struct pipe_resource
*
91 nvc0_buffer_create(struct pipe_screen
*pscreen
,
92 const struct pipe_resource
*templ
);
94 struct pipe_resource
*
95 nvc0_user_buffer_create(struct pipe_screen
*screen
,
101 struct pipe_surface
*
102 nvc0_miptree_surface_new(struct pipe_screen
*pscreen
, struct pipe_resource
*pt
,
103 unsigned face
, unsigned level
, unsigned zslice
,
107 nvc0_miptree_surface_del(struct pipe_surface
*ps
);