| .. | .. |
|---|
| 23 | 23 | */ |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | #include "qxl_drv.h" |
|---|
| 26 | +#include "qxl_object.h" |
|---|
| 26 | 27 | |
|---|
| 27 | 28 | /* Empty Implementations as there should not be any other driver for a virtual |
|---|
| 28 | 29 | * device that might share buffers with qxl */ |
|---|
| 29 | 30 | |
|---|
| 30 | 31 | int qxl_gem_prime_pin(struct drm_gem_object *obj) |
|---|
| 31 | 32 | { |
|---|
| 32 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 33 | | - return -ENOSYS; |
|---|
| 33 | + struct qxl_bo *bo = gem_to_qxl_bo(obj); |
|---|
| 34 | + |
|---|
| 35 | + return qxl_bo_pin(bo); |
|---|
| 34 | 36 | } |
|---|
| 35 | 37 | |
|---|
| 36 | 38 | void qxl_gem_prime_unpin(struct drm_gem_object *obj) |
|---|
| 37 | 39 | { |
|---|
| 38 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 39 | | -} |
|---|
| 40 | + struct qxl_bo *bo = gem_to_qxl_bo(obj); |
|---|
| 40 | 41 | |
|---|
| 42 | + qxl_bo_unpin(bo); |
|---|
| 43 | +} |
|---|
| 41 | 44 | |
|---|
| 42 | 45 | struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj) |
|---|
| 43 | 46 | { |
|---|
| 44 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 45 | 47 | return ERR_PTR(-ENOSYS); |
|---|
| 46 | 48 | } |
|---|
| 47 | 49 | |
|---|
| .. | .. |
|---|
| 49 | 51 | struct drm_device *dev, struct dma_buf_attachment *attach, |
|---|
| 50 | 52 | struct sg_table *table) |
|---|
| 51 | 53 | { |
|---|
| 52 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 53 | 54 | return ERR_PTR(-ENOSYS); |
|---|
| 54 | 55 | } |
|---|
| 55 | 56 | |
|---|
| 56 | 57 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) |
|---|
| 57 | 58 | { |
|---|
| 58 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 59 | | - return ERR_PTR(-ENOSYS); |
|---|
| 59 | + struct qxl_bo *bo = gem_to_qxl_bo(obj); |
|---|
| 60 | + void *ptr; |
|---|
| 61 | + int ret; |
|---|
| 62 | + |
|---|
| 63 | + ret = qxl_bo_kmap(bo, &ptr); |
|---|
| 64 | + if (ret < 0) |
|---|
| 65 | + return ERR_PTR(ret); |
|---|
| 66 | + |
|---|
| 67 | + return ptr; |
|---|
| 60 | 68 | } |
|---|
| 61 | 69 | |
|---|
| 62 | 70 | void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) |
|---|
| 63 | 71 | { |
|---|
| 64 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 72 | + struct qxl_bo *bo = gem_to_qxl_bo(obj); |
|---|
| 73 | + |
|---|
| 74 | + qxl_bo_kunmap(bo); |
|---|
| 65 | 75 | } |
|---|
| 66 | 76 | |
|---|
| 67 | 77 | int qxl_gem_prime_mmap(struct drm_gem_object *obj, |
|---|
| 68 | 78 | struct vm_area_struct *area) |
|---|
| 69 | 79 | { |
|---|
| 70 | | - WARN_ONCE(1, "not implemented"); |
|---|
| 71 | 80 | return -ENOSYS; |
|---|
| 72 | 81 | } |
|---|