1 // SPDX-License-Identifier: MIT 2 /* Copyright © 2024 Intel Corporation */ 3 4 #include <drm/drm_gem.h> 5 6 #include "xe_bo.h" 7 #include "intel_bo.h" 8 9 bool intel_bo_is_tiled(struct drm_gem_object *obj) 10 { 11 /* legacy tiling is unused */ 12 return false; 13 } 14 15 bool intel_bo_is_userptr(struct drm_gem_object *obj) 16 { 17 /* xe does not have userptr bos */ 18 return false; 19 } 20 21 bool intel_bo_is_shmem(struct drm_gem_object *obj) 22 { 23 return false; 24 } 25 26 bool intel_bo_is_protected(struct drm_gem_object *obj) 27 { 28 return false; 29 } 30 31 void intel_bo_flush_if_display(struct drm_gem_object *obj) 32 { 33 } 34 35 int intel_bo_fb_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) 36 { 37 return drm_gem_prime_mmap(obj, vma); 38 } 39 40 int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, int size) 41 { 42 struct xe_bo *bo = gem_to_xe_bo(obj); 43 struct ttm_bo_kmap_obj map; 44 void *src; 45 bool is_iomem; 46 int ret; 47 48 ret = xe_bo_lock(bo, true); 49 if (ret) 50 return ret; 51 52 ret = ttm_bo_kmap(&bo->ttm, offset >> PAGE_SHIFT, 1, &map); 53 if (ret) 54 goto out_unlock; 55 56 offset &= ~PAGE_MASK; 57 src = ttm_kmap_obj_virtual(&map, &is_iomem); 58 src += offset; 59 if (is_iomem) 60 memcpy_fromio(dst, (void __iomem *)src, size); 61 else 62 memcpy(dst, src, size); 63 64 ttm_bo_kunmap(&map); 65 out_unlock: 66 xe_bo_unlock(bo); 67 return ret; 68 } 69 70 struct intel_frontbuffer *intel_bo_get_frontbuffer(struct drm_gem_object *obj) 71 { 72 return NULL; 73 } 74 75 struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj, 76 struct intel_frontbuffer *front) 77 { 78 return front; 79 } 80 81 void intel_bo_describe(struct seq_file *m, struct drm_gem_object *obj) 82 { 83 /* FIXME */ 84 } 85