radeon/r200/r300: cleanup some of the renderbuffer code
[mesa.git] / src / gallium / winsys / drm / intel / common / intel_be_device.h
1 #ifndef INTEL_DRM_DEVICE_H
2 #define INTEL_DRM_DEVICE_H
3
4 #include "pipe/internal/p_winsys_screen.h"
5 #include "pipe/p_context.h"
6
7 /*
8 * Device
9 */
10
11 struct intel_be_device
12 {
13 struct pipe_winsys base;
14
15 /**
16 * Hw level screen
17 */
18 struct pipe_screen *screen;
19
20 int fd; /**< Drm file discriptor */
21
22 size_t max_batch_size;
23 size_t max_vertex_size;
24
25 struct _DriFenceMgr *fenceMgr;
26
27 struct _DriBufferPool *batchPool;
28 struct _DriBufferPool *regionPool;
29 struct _DriBufferPool *mallocPool;
30 struct _DriBufferPool *vertexPool;
31 struct _DriBufferPool *staticPool;
32 struct _DriFreeSlabManager *fMan;
33 };
34
35 boolean
36 intel_be_init_device(struct intel_be_device *device, int fd, unsigned id);
37
38 void
39 intel_be_destroy_device(struct intel_be_device *dev);
40
41 /*
42 * Buffer
43 */
44
45 struct intel_be_buffer {
46 struct pipe_buffer base;
47 struct _DriBufferPool *pool;
48 struct _DriBufferObject *driBO;
49 };
50
51 /**
52 * Create a be buffer from a drm bo handle
53 *
54 * Takes a reference
55 */
56 struct pipe_buffer *
57 intel_be_buffer_from_handle(struct intel_be_device *device,
58 const char* name, unsigned handle);
59
60 static INLINE struct intel_be_buffer *
61 intel_be_buffer(struct pipe_buffer *buf)
62 {
63 return (struct intel_be_buffer *)buf;
64 }
65
66 static INLINE struct _DriBufferObject *
67 dri_bo(struct pipe_buffer *buf)
68 {
69 return intel_be_buffer(buf)->driBO;
70 }
71
72 #endif