1 
2 #ifndef INTEL_DRM_WINSYS_H
3 #define INTEL_DRM_WINSYS_H
4 
5 #include "i915/i915_batchbuffer.h"
6 
7 #include "drm.h"
8 #include "intel_bufmgr.h"
9 
10 
11 /*
12  * Winsys
13  */
14 
15 
16 struct i915_drm_winsys
17 {
18    struct i915_winsys base;
19 
20    boolean dump_cmd;
21    const char *dump_raw_file;
22    boolean send_cmd;
23 
24    int fd; /**< Drm file discriptor */
25 
26    size_t max_batch_size;
27 
28    drm_intel_bufmgr *gem_manager;
29 };
30 
31 static INLINE struct i915_drm_winsys *
i915_drm_winsys(struct i915_winsys * iws)32 i915_drm_winsys(struct i915_winsys *iws)
33 {
34    return (struct i915_drm_winsys *)iws;
35 }
36 
37 struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo);
38 
39 void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws);
40 void i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws);
41 void i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws);
42 
43 
44 /*
45  * Buffer
46  */
47 
48 
49 struct i915_drm_buffer {
50    unsigned magic;
51 
52    drm_intel_bo *bo;
53 
54    void *ptr;
55    unsigned map_count;
56 
57    boolean flinked;
58    unsigned flink;
59 };
60 
61 static INLINE struct i915_drm_buffer *
i915_drm_buffer(struct i915_winsys_buffer * buffer)62 i915_drm_buffer(struct i915_winsys_buffer *buffer)
63 {
64    return (struct i915_drm_buffer *)buffer;
65 }
66 
67 static INLINE drm_intel_bo *
intel_bo(struct i915_winsys_buffer * buffer)68 intel_bo(struct i915_winsys_buffer *buffer)
69 {
70    return i915_drm_buffer(buffer)->bo;
71 }
72 
73 #endif
74