This source file includes following definitions.
- qxl_bo_reserve
- qxl_bo_unreserve
- qxl_bo_gpu_offset
- qxl_bo_size
- qxl_bo_mmap_offset
- qxl_bo_wait
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 #ifndef QXL_OBJECT_H
26 #define QXL_OBJECT_H
27
28 #include "qxl_drv.h"
29
30 static inline int qxl_bo_reserve(struct qxl_bo *bo, bool no_wait)
31 {
32 int r;
33
34 r = ttm_bo_reserve(&bo->tbo, true, no_wait, NULL);
35 if (unlikely(r != 0)) {
36 if (r != -ERESTARTSYS) {
37 struct drm_device *ddev = bo->tbo.base.dev;
38
39 dev_err(ddev->dev, "%p reserve failed\n", bo);
40 }
41 return r;
42 }
43 return 0;
44 }
45
46 static inline void qxl_bo_unreserve(struct qxl_bo *bo)
47 {
48 ttm_bo_unreserve(&bo->tbo);
49 }
50
51 static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo)
52 {
53 return bo->tbo.offset;
54 }
55
56 static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
57 {
58 return bo->tbo.num_pages << PAGE_SHIFT;
59 }
60
61 static inline u64 qxl_bo_mmap_offset(struct qxl_bo *bo)
62 {
63 return drm_vma_node_offset_addr(&bo->tbo.base.vma_node);
64 }
65
66 static inline int qxl_bo_wait(struct qxl_bo *bo, u32 *mem_type,
67 bool no_wait)
68 {
69 int r;
70
71 r = ttm_bo_reserve(&bo->tbo, true, no_wait, NULL);
72 if (unlikely(r != 0)) {
73 if (r != -ERESTARTSYS) {
74 struct drm_device *ddev = bo->tbo.base.dev;
75
76 dev_err(ddev->dev, "%p reserve failed for wait\n",
77 bo);
78 }
79 return r;
80 }
81 if (mem_type)
82 *mem_type = bo->tbo.mem.mem_type;
83
84 r = ttm_bo_wait(&bo->tbo, true, no_wait);
85 ttm_bo_unreserve(&bo->tbo);
86 return r;
87 }
88
89 extern int qxl_bo_create(struct qxl_device *qdev,
90 unsigned long size,
91 bool kernel, bool pinned, u32 domain,
92 struct qxl_surface *surf,
93 struct qxl_bo **bo_ptr);
94 extern int qxl_bo_kmap(struct qxl_bo *bo, void **ptr);
95 extern void qxl_bo_kunmap(struct qxl_bo *bo);
96 void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset);
97 void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map);
98 extern struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo);
99 extern void qxl_bo_unref(struct qxl_bo **bo);
100 extern int qxl_bo_pin(struct qxl_bo *bo);
101 extern int qxl_bo_unpin(struct qxl_bo *bo);
102 extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned);
103 extern bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo);
104
105 #endif