0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef QXL_OBJECT_H
0026 #define QXL_OBJECT_H
0027
0028 #include "qxl_drv.h"
0029
0030 static inline int qxl_bo_reserve(struct qxl_bo *bo)
0031 {
0032 int r;
0033
0034 r = ttm_bo_reserve(&bo->tbo, true, false, NULL);
0035 if (unlikely(r != 0)) {
0036 if (r != -ERESTARTSYS) {
0037 struct drm_device *ddev = bo->tbo.base.dev;
0038
0039 dev_err(ddev->dev, "%p reserve failed\n", bo);
0040 }
0041 return r;
0042 }
0043 return 0;
0044 }
0045
0046 static inline void qxl_bo_unreserve(struct qxl_bo *bo)
0047 {
0048 ttm_bo_unreserve(&bo->tbo);
0049 }
0050
0051 static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
0052 {
0053 return bo->tbo.base.size;
0054 }
0055
0056 extern int qxl_bo_create(struct qxl_device *qdev,
0057 unsigned long size,
0058 bool kernel, bool pinned, u32 domain,
0059 u32 priority,
0060 struct qxl_surface *surf,
0061 struct qxl_bo **bo_ptr);
0062 int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map);
0063 int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map);
0064 int qxl_bo_vunmap(struct qxl_bo *bo);
0065 void qxl_bo_vunmap_locked(struct qxl_bo *bo);
0066 void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset);
0067 void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map);
0068 extern struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo);
0069 extern void qxl_bo_unref(struct qxl_bo **bo);
0070 extern int qxl_bo_pin(struct qxl_bo *bo);
0071 extern int qxl_bo_unpin(struct qxl_bo *bo);
0072 extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain);
0073 extern bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo);
0074
0075 #endif