summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/i915/drm/i915_drm_winsys.h
blob: 217c4a7eafbe5b90eaff7c70aa836f1aed5210fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

#ifndef INTEL_DRM_WINSYS_H
#define INTEL_DRM_WINSYS_H

#include "i915/i915_batchbuffer.h"

#include "drm.h"
#include "intel_bufmgr.h"


/*
 * Winsys
 */


struct i915_drm_winsys
{
   struct i915_winsys base;

   boolean dump_cmd;

   int fd; /**< Drm file discriptor */

   unsigned id;

   size_t max_batch_size;

   struct {
      drm_intel_bufmgr *gem;
   } pools;
};

static INLINE struct i915_drm_winsys *
i915_drm_winsys(struct i915_winsys *iws)
{
   return (struct i915_drm_winsys *)iws;
}

struct i915_drm_winsys * i915_drm_winsys_create(int fd, unsigned pci_id);
struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo);

void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws);
void i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws);
void i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws);


/*
 * Buffer
 */


struct i915_drm_buffer {
   unsigned magic;

   drm_intel_bo *bo;

   void *ptr;
   unsigned map_count;
   boolean map_gtt;

   boolean flinked;
   unsigned flink;
};

static INLINE struct i915_drm_buffer *
i915_drm_buffer(struct i915_winsys_buffer *buffer)
{
   return (struct i915_drm_buffer *)buffer;
}

static INLINE drm_intel_bo *
intel_bo(struct i915_winsys_buffer *buffer)
{
   return i915_drm_buffer(buffer)->bo;
}

#endif