nouveau: Split nouveau_buffers into nouveau_mem and nouveau_fbo
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_bufferobj.h
1 #ifndef __NOUVEAU_BUFFEROBJ_H__
2 #define __NOUVEAU_BUFFEROBJ_H__
3
4 #include "mtypes.h"
5 #include "nouveau_mem.h"
6
7 #define NOUVEAU_BO_VRAM_OK (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE)
8 #define NOUVEAU_BO_GART_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
9
10 typedef struct nouveau_bufferobj_region_t {
11 uint32_t start;
12 uint32_t end;
13 } nouveau_bufferobj_region;
14
15 typedef struct nouveau_bufferobj_dirty_t {
16 nouveau_bufferobj_region *dirty;
17 int nr_dirty;
18 } nouveau_bufferobj_dirty;
19
20 typedef struct nouveau_buffer_object_t {
21 /* Base class, must be first */
22 struct gl_buffer_object mesa;
23
24 GLboolean mapped;
25 GLenum usage;
26
27 /* Memory used for GPU access to the buffer*/
28 GLuint gpu_mem_flags;
29 nouveau_mem * gpu_mem;
30 nouveau_bufferobj_dirty gpu_dirty;
31
32 /* Memory used for CPU access to the buffer */
33 GLuint cpu_mem_flags;
34 nouveau_mem * cpu_mem;
35 GLvoid * cpu_mem_sys;
36 nouveau_bufferobj_dirty cpu_dirty;
37 } nouveau_buffer_object;
38
39 extern void
40 nouveau_bo_init_storage(GLcontext *ctx, GLuint valid_gpu_access,
41 GLsizeiptrARB size, const GLvoid *data, GLenum usage,
42 struct gl_buffer_object *bo);
43
44 extern GLboolean
45 nouveau_bo_move_in(GLcontext *ctx, struct gl_buffer_object *bo);
46
47 extern GLboolean
48 nouveau_bo_move_out(GLcontext *ctx, struct gl_buffer_object *bo);
49
50 extern void *
51 nouveau_bo_map(GLcontext *ctx, GLenum usage, struct gl_buffer_object *bo);
52
53 extern void
54 nouveau_bo_unmap(GLcontext *ctx, struct gl_buffer_object *bo);
55
56 extern uint32_t
57 nouveau_bo_gpu_ref(GLcontext *ctx, struct gl_buffer_object *bo);
58
59 extern void
60 nouveau_bo_dirty_linear(GLcontext *ctx, GLboolean on_card,
61 uint32_t offset, uint32_t size,
62 struct gl_buffer_object *bo);
63
64 extern void
65 nouveau_bo_dirty_all(GLcontext *ctx, GLboolean on_card,
66 struct gl_buffer_object *bo);
67
68 extern GLuint
69 nouveau_bo_upload_dirty(GLcontext *ctx, struct gl_buffer_object *bo);
70
71 extern GLuint
72 nouveau_bo_download_dirty(GLcontext *ctx, struct gl_buffer_object *bo);
73
74 extern void
75 nouveauInitBufferObjects(GLcontext *ctx);
76
77 #endif