Rev 3258 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3258 | Rev 3263 | ||
---|---|---|---|
Line 106... | Line 106... | ||
106 | #define LOCAL_I915_PARAM_HAS_HANDLE_LUT 26 |
106 | #define LOCAL_I915_PARAM_HAS_HANDLE_LUT 26 |
Line 107... | Line 107... | ||
107 | 107 | ||
108 | #define LOCAL_I915_EXEC_IS_PINNED (1<<10) |
108 | #define LOCAL_I915_EXEC_IS_PINNED (1<<10) |
109 | #define LOCAL_I915_EXEC_NO_RELOC (1<<11) |
109 | #define LOCAL_I915_EXEC_NO_RELOC (1<<11) |
- | 110 | #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) |
|
- | 111 | struct local_i915_gem_userptr { |
|
- | 112 | uint64_t user_ptr; |
|
- | 113 | uint32_t user_size; |
|
- | 114 | uint32_t flags; |
|
- | 115 | #define I915_USERPTR_READ_ONLY (1<<0) |
|
- | 116 | #define I915_USERPTR_UNSYNCHRONIZED (1<<31) |
|
- | 117 | uint32_t handle; |
|
- | 118 | }; |
|
110 | #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) |
119 | |
111 | #define UNCACHED 0 |
120 | #define UNCACHED 0 |
Line 112... | Line 121... | ||
112 | #define SNOOPED 1 |
121 | #define SNOOPED 1 |
113 | 122 | ||
114 | struct local_i915_gem_cacheing { |
123 | struct local_i915_gem_cacheing { |
115 | uint32_t handle; |
124 | uint32_t handle; |
Line 116... | Line 125... | ||
116 | uint32_t cacheing; |
125 | uint32_t cacheing; |
Line -... | Line 126... | ||
- | 126 | }; |
|
- | 127 | ||
- | 128 | #define LOCAL_IOCTL_I915_GEM_SET_CACHEING SRV_I915_GEM_SET_CACHEING |
|
- | 129 | ||
- | 130 | struct local_fbinfo { |
|
- | 131 | int width; |
|
- | 132 | int height; |
|
117 | }; |
133 | int pitch; |
118 | 134 | int tiling; |
|
119 | #define LOCAL_IOCTL_I915_GEM_SET_CACHEING SRV_I915_GEM_SET_CACHEING |
135 | }; |
120 | 136 | ||
121 | struct kgem_buffer { |
137 | struct kgem_buffer { |
Line 187... | Line 203... | ||
187 | set_tiling.stride = stride; |
203 | set_tiling.stride = stride; |
Line 188... | Line 204... | ||
188 | 204 | ||
189 | ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling); |
205 | ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling); |
190 | } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); |
206 | } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); |
191 | */ |
207 | */ |
192 | return ret == 0; |
208 | return false;//ret == 0; |
Line 193... | Line 209... | ||
193 | } |
209 | } |
194 | 210 | ||
195 | static bool gem_set_cacheing(int fd, uint32_t handle, int cacheing) |
211 | static bool gem_set_cacheing(int fd, uint32_t handle, int cacheing) |
Line 258... | Line 274... | ||
258 | } |
274 | } |
Line 259... | Line 275... | ||
259 | 275 | ||
260 | retry_mmap: |
276 | retry_mmap: |
261 | // ptr = mmap(0, bytes(bo), PROT_READ | PROT_WRITE, MAP_SHARED, |
277 | // ptr = mmap(0, bytes(bo), PROT_READ | PROT_WRITE, MAP_SHARED, |
262 | // kgem->fd, mmap_arg.offset); |
278 | // kgem->fd, mmap_arg.offset); |
263 | if (ptr == 0) { |
279 | // if (ptr == 0) { |
264 | printf("%s: failed to mmap %d, %d bytes, into GTT domain: %d\n", |
280 | printf("%s: failed to mmap %d, %d bytes, into GTT domain: %d\n", |
265 | __FUNCTION__, bo->handle, bytes(bo), 0); |
281 | __FUNCTION__, bo->handle, bytes(bo), 0); |
266 | if (__kgem_throttle_retire(kgem, 0)) |
282 | // if (__kgem_throttle_retire(kgem, 0)) |
Line 267... | Line 283... | ||
267 | goto retry_mmap; |
283 | // goto retry_mmap; |
268 | 284 | ||
269 | if (kgem->need_expire) { |
285 | // if (kgem->need_expire) { |
270 | kgem_cleanup_cache(kgem); |
286 | // kgem_cleanup_cache(kgem); |
Line 271... | Line 287... | ||
271 | goto retry_mmap; |
287 | // goto retry_mmap; |
272 | } |
288 | // } |
Line 273... | Line 289... | ||
273 | 289 | ||
274 | ptr = NULL; |
290 | ptr = NULL; |
Line 275... | Line 291... | ||
275 | } |
291 | // } |
Line 637... | Line 653... | ||
637 | return detected; |
653 | return detected; |
638 | } |
654 | } |
Line 639... | Line 655... | ||
639 | 655 | ||
640 | static bool __kgem_throttle(struct kgem *kgem) |
656 | static bool __kgem_throttle(struct kgem *kgem) |
641 | { |
657 | { |
642 | // if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_THROTTLE, NULL) == 0) |
658 | if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_THROTTLE, NULL) == 0) |
Line 643... | Line 659... | ||
643 | return false; |
659 | return false; |
644 | 660 | ||
Line 645... | Line 661... | ||
645 | // return errno == EIO; |
661 | return errno == EIO; |
646 | } |
662 | } |
647 | 663 | ||
Line 1071... | Line 1087... | ||
1071 | kgem->batch_flags_base |= LOCAL_I915_EXEC_NO_RELOC; |
1087 | kgem->batch_flags_base |= LOCAL_I915_EXEC_NO_RELOC; |
1072 | if (kgem->has_handle_lut) |
1088 | if (kgem->has_handle_lut) |
1073 | kgem->batch_flags_base |= LOCAL_I915_EXEC_HANDLE_LUT; |
1089 | kgem->batch_flags_base |= LOCAL_I915_EXEC_HANDLE_LUT; |
1074 | if (kgem->has_pinned_batches) |
1090 | if (kgem->has_pinned_batches) |
1075 | kgem->batch_flags_base |= LOCAL_I915_EXEC_IS_PINNED; |
1091 | kgem->batch_flags_base |= LOCAL_I915_EXEC_IS_PINNED; |
- | 1092 | } |
|
- | 1093 | ||
- | 1094 | /* XXX hopefully a good approximation */ |
|
- | 1095 | static uint32_t kgem_get_unique_id(struct kgem *kgem) |
|
- | 1096 | { |
|
- | 1097 | uint32_t id; |
|
- | 1098 | id = ++kgem->unique_id; |
|
- | 1099 | if (id == 0) |
|
- | 1100 | id = ++kgem->unique_id; |
|
- | 1101 | return id; |
|
- | 1102 | } |
|
- | 1103 | ||
- | 1104 | inline static uint32_t kgem_pitch_alignment(struct kgem *kgem, unsigned flags) |
|
- | 1105 | { |
|
- | 1106 | if (flags & CREATE_PRIME) |
|
- | 1107 | return 256; |
|
- | 1108 | if (flags & CREATE_SCANOUT) |
|
- | 1109 | return 64; |
|
- | 1110 | return kgem->min_alignment; |
|
- | 1111 | } |
|
- | 1112 | ||
- | 1113 | static uint32_t kgem_untiled_pitch(struct kgem *kgem, |
|
- | 1114 | uint32_t width, uint32_t bpp, |
|
- | 1115 | unsigned flags) |
|
- | 1116 | { |
|
- | 1117 | width = ALIGN(width, 2) * bpp >> 3; |
|
- | 1118 | return ALIGN(width, kgem_pitch_alignment(kgem, flags)); |
|
- | 1119 | } |
|
- | 1120 | static uint32_t kgem_surface_size(struct kgem *kgem, |
|
- | 1121 | bool relaxed_fencing, |
|
- | 1122 | unsigned flags, |
|
- | 1123 | uint32_t width, |
|
- | 1124 | uint32_t height, |
|
- | 1125 | uint32_t bpp, |
|
- | 1126 | uint32_t tiling, |
|
- | 1127 | uint32_t *pitch) |
|
- | 1128 | { |
|
- | 1129 | uint32_t tile_width, tile_height; |
|
- | 1130 | uint32_t size; |
|
- | 1131 | ||
- | 1132 | assert(width <= MAXSHORT); |
|
- | 1133 | assert(height <= MAXSHORT); |
|
- | 1134 | ||
- | 1135 | if (kgem->gen <= 030) { |
|
- | 1136 | if (tiling) { |
|
- | 1137 | if (kgem->gen < 030) { |
|
- | 1138 | tile_width = 128; |
|
- | 1139 | tile_height = 32; |
|
- | 1140 | } else { |
|
- | 1141 | tile_width = 512; |
|
- | 1142 | tile_height = 16; |
|
- | 1143 | } |
|
- | 1144 | } else { |
|
- | 1145 | tile_width = 2 * bpp >> 3; |
|
- | 1146 | tile_width = ALIGN(tile_width, |
|
- | 1147 | kgem_pitch_alignment(kgem, flags)); |
|
- | 1148 | tile_height = 2; |
|
- | 1149 | } |
|
- | 1150 | } else switch (tiling) { |
|
- | 1151 | default: |
|
- | 1152 | case I915_TILING_NONE: |
|
- | 1153 | tile_width = 2 * bpp >> 3; |
|
- | 1154 | tile_width = ALIGN(tile_width, |
|
- | 1155 | kgem_pitch_alignment(kgem, flags)); |
|
- | 1156 | tile_height = 2; |
|
- | 1157 | break; |
|
- | 1158 | ||
- | 1159 | /* XXX align to an even tile row */ |
|
- | 1160 | case I915_TILING_X: |
|
- | 1161 | tile_width = 512; |
|
- | 1162 | tile_height = 16; |
|
- | 1163 | break; |
|
- | 1164 | case I915_TILING_Y: |
|
- | 1165 | tile_width = 128; |
|
- | 1166 | tile_height = 64; |
|
- | 1167 | break; |
|
- | 1168 | } |
|
- | 1169 | ||
- | 1170 | *pitch = ALIGN(width * bpp / 8, tile_width); |
|
- | 1171 | height = ALIGN(height, tile_height); |
|
- | 1172 | if (kgem->gen >= 040) |
|
- | 1173 | return PAGE_ALIGN(*pitch * height); |
|
- | 1174 | ||
- | 1175 | /* If it is too wide for the blitter, don't even bother. */ |
|
- | 1176 | if (tiling != I915_TILING_NONE) { |
|
- | 1177 | if (*pitch > 8192) |
|
- | 1178 | return 0; |
|
- | 1179 | ||
- | 1180 | for (size = tile_width; size < *pitch; size <<= 1) |
|
- | 1181 | ; |
|
- | 1182 | *pitch = size; |
|
- | 1183 | } else { |
|
- | 1184 | if (*pitch >= 32768) |
|
- | 1185 | return 0; |
|
- | 1186 | } |
|
Line -... | Line 1187... | ||
- | 1187 | ||
- | 1188 | size = *pitch * height; |
|
- | 1189 | if (relaxed_fencing || tiling == I915_TILING_NONE) |
|
- | 1190 | return PAGE_ALIGN(size); |
|
- | 1191 | ||
- | 1192 | /* We need to allocate a pot fence region for a tiled buffer. */ |
|
- | 1193 | if (kgem->gen < 030) |
|
- | 1194 | tile_width = 512 * 1024; |
|
- | 1195 | else |
|
- | 1196 | tile_width = 1024 * 1024; |
|
- | 1197 | while (tile_width < size) |
|
- | 1198 | tile_width *= 2; |
|
- | 1199 | return tile_width; |
|
- | 1200 | } |
|
- | 1201 | ||
- | 1202 | static uint32_t kgem_aligned_height(struct kgem *kgem, |
|
- | 1203 | uint32_t height, uint32_t tiling) |
|
- | 1204 | { |
|
- | 1205 | uint32_t tile_height; |
|
- | 1206 | ||
- | 1207 | if (kgem->gen <= 030) { |
|
- | 1208 | tile_height = tiling ? kgem->gen < 030 ? 32 : 16 : 1; |
|
- | 1209 | } else switch (tiling) { |
|
- | 1210 | /* XXX align to an even tile row */ |
|
- | 1211 | default: |
|
- | 1212 | case I915_TILING_NONE: |
|
- | 1213 | tile_height = 1; |
|
- | 1214 | break; |
|
- | 1215 | case I915_TILING_X: |
|
- | 1216 | tile_height = 16; |
|
- | 1217 | break; |
|
- | 1218 | case I915_TILING_Y: |
|
- | 1219 | tile_height = 64; |
|
- | 1220 | break; |
|
- | 1221 | } |
|
- | 1222 | ||
1076 | 1223 | return ALIGN(height, tile_height); |
|
Line 1077... | Line 1224... | ||
1077 | } |
1224 | } |
1078 | 1225 | ||
1079 | static struct drm_i915_gem_exec_object2 * |
1226 | static struct drm_i915_gem_exec_object2 * |
Line 1761... | Line 1908... | ||
1761 | kgem->retire(kgem); |
1908 | kgem->retire(kgem); |
Line 1762... | Line 1909... | ||
1762 | 1909 | ||
1763 | return retired; |
1910 | return retired; |
Line -... | Line 1911... | ||
- | 1911 | } |
|
- | 1912 | ||
- | 1913 | bool __kgem_ring_is_idle(struct kgem *kgem, int ring) |
|
Line -... | Line 1914... | ||
- | 1914 | { |
|
Line -... | Line 1915... | ||
- | 1915 | struct kgem_request *rq; |
|
- | 1916 | ||
- | 1917 | assert(!list_is_empty(&kgem->requests[ring])); |
|
- | 1918 | ||
- | 1919 | rq = list_last_entry(&kgem->requests[ring], |
|
- | 1920 | struct kgem_request, list); |
|
- | 1921 | if (__kgem_busy(kgem, rq->bo->handle)) { |
|
Line -... | Line 1922... | ||
- | 1922 | DBG(("%s: last requests handle=%d still busy\n", |
|
- | 1923 | __FUNCTION__, rq->bo->handle)); |
|
Line -... | Line 1924... | ||
- | 1924 | return false; |
|
- | 1925 | } |
|
- | 1926 | ||
1764 | } |
1927 | DBG(("%s: ring=%d idle (handle=%d)\n", |
Line 1765... | Line 1928... | ||
1765 | 1928 | __FUNCTION__, ring, rq->bo->handle)); |
|
1766 | 1929 | ||
1767 | 1930 | kgem_retire__requests_ring(kgem, ring); |
|
1768 | 1931 | assert(list_is_empty(&kgem->requests[ring])); |
|
Line 2326... | Line 2489... | ||
2326 | execbuf.rsvd1 = 0; |
2489 | execbuf.rsvd1 = 0; |
2327 | execbuf.rsvd2 = 0; |
2490 | execbuf.rsvd2 = 0; |
Line 2328... | Line 2491... | ||
2328 | 2491 | ||
2329 | 2492 | ||
2330 | 2493 | ||
2331 | // ret = drmIoctl(kgem->fd, |
2494 | ret = drmIoctl(kgem->fd, |
2332 | // DRM_IOCTL_I915_GEM_EXECBUFFER2, |
2495 | DRM_IOCTL_I915_GEM_EXECBUFFER2, |
2333 | // &execbuf); |
2496 | &execbuf); |
2334 | // while (ret == -1 && errno == EBUSY && retry--) { |
2497 | while (ret == -1 && errno == EBUSY && retry--) { |
2335 | // __kgem_throttle(kgem); |
2498 | __kgem_throttle(kgem); |
2336 | // ret = drmIoctl(kgem->fd, |
2499 | ret = drmIoctl(kgem->fd, |
2337 | // DRM_IOCTL_I915_GEM_EXECBUFFER2, |
2500 | DRM_IOCTL_I915_GEM_EXECBUFFER2, |
2338 | // &execbuf); |
2501 | &execbuf); |
Line 2339... | Line 2502... | ||
2339 | // } |
2502 | } |
2340 | if (DEBUG_SYNC && ret == 0) { |
2503 | if (DEBUG_SYNC && ret == 0) { |
Line 2896... | Line 3059... | ||
2896 | size *= 2; |
3059 | size *= 2; |
Line 2897... | Line 3060... | ||
2897 | 3060 | ||
2898 | return size; |
3061 | return size; |
Line 2899... | Line -... | ||
2899 | } |
- | |
2900 | - | ||
2901 | #if 0 |
3062 | } |
2902 | 3063 | ||
2903 | struct kgem_bo *kgem_create_2d(struct kgem *kgem, |
3064 | struct kgem_bo *kgem_create_2d(struct kgem *kgem, |
2904 | int width, |
3065 | int width, |
2905 | int height, |
3066 | int height, |
Line 3377... | Line 3538... | ||
3377 | bo->pitch, bo->tiling, bo->handle, bo->unique_id, |
3538 | bo->pitch, bo->tiling, bo->handle, bo->unique_id, |
3378 | size, num_pages(bo), bucket(bo))); |
3539 | size, num_pages(bo), bucket(bo))); |
3379 | return bo; |
3540 | return bo; |
3380 | } |
3541 | } |
Line -... | Line 3542... | ||
- | 3542 | ||
3381 | 3543 | #if 0 |
|
3382 | struct kgem_bo *kgem_create_cpu_2d(struct kgem *kgem, |
3544 | struct kgem_bo *kgem_create_cpu_2d(struct kgem *kgem, |
3383 | int width, |
3545 | int width, |
3384 | int height, |
3546 | int height, |
3385 | int bpp, |
3547 | int bpp, |
Line 3495... | Line 3657... | ||
3495 | } |
3657 | } |
Line 3496... | Line 3658... | ||
3496 | 3658 | ||
3497 | __kgem_bo_destroy(kgem, bo); |
3659 | __kgem_bo_destroy(kgem, bo); |
Line -... | Line 3660... | ||
- | 3660 | } |
|
- | 3661 | ||
- | 3662 | void __kgem_flush(struct kgem *kgem, struct kgem_bo *bo) |
|
- | 3663 | { |
|
- | 3664 | assert(bo->rq); |
|
Line -... | Line 3665... | ||
- | 3665 | assert(bo->exec == NULL); |
|
- | 3666 | assert(bo->needs_flush); |
|
- | 3667 | ||
Line -... | Line 3668... | ||
- | 3668 | /* The kernel will emit a flush *and* update its own flushing lists. */ |
|
- | 3669 | if (!__kgem_busy(kgem, bo->handle)) |
|
- | 3670 | __kgem_bo_clear_busy(bo); |
|
Line -... | Line 3671... | ||
- | 3671 | ||
- | 3672 | DBG(("%s: handle=%d, busy?=%d\n", |
|
- | 3673 | __FUNCTION__, bo->handle, bo->rq != NULL)); |
|
- | 3674 | } |
|
Line -... | Line 3675... | ||
- | 3675 | ||
- | 3676 | inline static bool needs_semaphore(struct kgem *kgem, struct kgem_bo *bo) |
|
- | 3677 | { |
|
- | 3678 | return kgem->nreloc && bo->rq && RQ_RING(bo->rq) != kgem->ring; |
|
- | 3679 | } |
|
- | 3680 | ||
- | 3681 | bool kgem_check_bo(struct kgem *kgem, ...) |
|
- | 3682 | { |
|
- | 3683 | va_list ap; |
|
- | 3684 | struct kgem_bo *bo; |
|
- | 3685 | int num_exec = 0; |
|
- | 3686 | int num_pages = 0; |
|
- | 3687 | bool flush = false; |
|
- | 3688 | ||
- | 3689 | va_start(ap, kgem); |
|
- | 3690 | while ((bo = va_arg(ap, struct kgem_bo *))) { |
|
- | 3691 | while (bo->proxy) |
|
- | 3692 | bo = bo->proxy; |
|
- | 3693 | if (bo->exec) |
|
- | 3694 | continue; |
|
- | 3695 | ||
- | 3696 | if (needs_semaphore(kgem, bo)) |
|
- | 3697 | return false; |
|
- | 3698 | ||
- | 3699 | num_pages += num_pages(bo); |
|
- | 3700 | num_exec++; |
|
- | 3701 | ||
- | 3702 | flush |= bo->flush; |
|
- | 3703 | } |
|
- | 3704 | va_end(ap); |
|
- | 3705 | ||
- | 3706 | DBG(("%s: num_pages=+%d, num_exec=+%d\n", |
|
- | 3707 | __FUNCTION__, num_pages, num_exec)); |
|
- | 3708 | ||
- | 3709 | if (!num_pages) |
|
- | 3710 | return true; |
|
- | 3711 | ||
- | 3712 | if (kgem_flush(kgem, flush)) |
|
- | 3713 | return false; |
|
- | 3714 | ||
Line -... | Line 3715... | ||
- | 3715 | if (kgem->aperture > kgem->aperture_low && |
|
- | 3716 | kgem_ring_is_idle(kgem, kgem->ring)) { |
|
- | 3717 | DBG(("%s: current aperture usage (%d) is greater than low water mark (%d)\n", |
|
- | 3718 | __FUNCTION__, kgem->aperture, kgem->aperture_low)); |
|
- | 3719 | return false; |
|
- | 3720 | } |
|
- | 3721 | ||
- | 3722 | if (num_pages + kgem->aperture > kgem->aperture_high) { |
|
- | 3723 | DBG(("%s: final aperture usage (%d) is greater than high water mark (%d)\n", |
|
- | 3724 | __FUNCTION__, num_pages + kgem->aperture, kgem->aperture_high)); |
|
- | 3725 | return false; |
|
- | 3726 | } |
|
- | 3727 | ||
- | 3728 | if (kgem->nexec + num_exec >= KGEM_EXEC_SIZE(kgem)) { |
|
Line 3543... | Line 3774... | ||
3543 | DBG(("%s: handle=%d, pos=%d, delta=%d, domains=%08x\n", |
3774 | DBG(("%s: handle=%d, pos=%d, delta=%d, domains=%08x\n", |
3544 | __FUNCTION__, bo ? bo->handle : 0, pos, delta, read_write_domain)); |
3775 | __FUNCTION__, bo ? bo->handle : 0, pos, delta, read_write_domain)); |
Line 3545... | Line 3776... | ||
3545 | 3776 | ||
Line -... | Line 3777... | ||
- | 3777 | assert((read_write_domain & 0x7fff) == 0 || bo != NULL); |
|
- | 3778 | ||
- | 3779 | // if( bo != NULL && bo->handle == -1) |
|
3546 | assert((read_write_domain & 0x7fff) == 0 || bo != NULL); |
3780 | // return 0; |
3547 | 3781 | ||
3548 | index = kgem->nreloc++; |
3782 | index = kgem->nreloc++; |
3549 | assert(index < ARRAY_SIZE(kgem->reloc)); |
3783 | assert(index < ARRAY_SIZE(kgem->reloc)); |
3550 | kgem->reloc[index].offset = pos * sizeof(kgem->batch[0]); |
3784 | kgem->reloc[index].offset = pos * sizeof(kgem->batch[0]); |
Line 3849... | Line 4083... | ||
3849 | 4083 | ||
3850 | bo->dirty = false; |
4084 | bo->dirty = false; |
3851 | } |
4085 | } |
Line -... | Line 4086... | ||
- | 4086 | } |
|
- | 4087 | ||
- | 4088 | struct kgem_bo *kgem_create_proxy(struct kgem *kgem, |
|
- | 4089 | struct kgem_bo *target, |
|
- | 4090 | int offset, int length) |
|
- | 4091 | { |
|
- | 4092 | struct kgem_bo *bo; |
|
- | 4093 | ||
- | 4094 | DBG(("%s: target handle=%d [proxy? %d], offset=%d, length=%d, io=%d\n", |
|
- | 4095 | __FUNCTION__, target->handle, target->proxy ? target->proxy->delta : -1, |
|
- | 4096 | offset, length, target->io)); |
|
- | 4097 | ||
- | 4098 | bo = __kgem_bo_alloc(target->handle, length); |
|
- | 4099 | if (bo == NULL) |
|
- | 4100 | return NULL; |
|
- | 4101 | ||
- | 4102 | bo->unique_id = kgem_get_unique_id(kgem); |
|
- | 4103 | bo->reusable = false; |
|
- | 4104 | bo->size.bytes = length; |
|
- | 4105 | ||
- | 4106 | bo->io = target->io && target->proxy == NULL; |
|
- | 4107 | bo->dirty = target->dirty; |
|
- | 4108 | bo->tiling = target->tiling; |
|
- | 4109 | bo->pitch = target->pitch; |
|
- | 4110 | ||
- | 4111 | assert(!bo->scanout); |
|
- | 4112 | bo->proxy = kgem_bo_reference(target); |
|
- | 4113 | bo->delta = offset; |
|
- | 4114 | ||
- | 4115 | if (target->exec) { |
|
- | 4116 | list_move_tail(&bo->request, &kgem->next_request->buffers); |
|
- | 4117 | bo->exec = &_kgem_dummy_exec; |
|
- | 4118 | } |
|
- | 4119 | bo->rq = target->rq; |
|
- | 4120 | ||
- | 4121 | return bo; |
|
3852 | } |
4122 | } |
3853 | 4123 | ||
3854 | uint32_t kgem_bo_get_binding(struct kgem_bo *bo, uint32_t format) |
4124 | uint32_t kgem_bo_get_binding(struct kgem_bo *bo, uint32_t format) |
Line 3855... | Line 4125... | ||
3855 | { |
4125 | { |
Line 3887... | Line 4157... | ||
3887 | bo->binding.next = b; |
4157 | bo->binding.next = b; |
3888 | } |
4158 | } |
3889 | }=>=>>=>>>>>=>>>=>>=>>=>=>>=>>>>>=>>>=>=>>>>=>=>>>>>=>>>>>>>>>>=>>=>=>=>=>=>=>=>=>>>>=>>=>>=>>=>>>>>>>>><>><>>>>>>>>>>>>>>>>>>>>>=>12) |
4159 | } |
Line -... | Line 4160... | ||
- | 4160 | ||
- | 4161 | ||
- | 4162 | int kgem_init_fb(struct kgem *kgem, struct sna_fb *fb) |
|
- | 4163 | { |
|
- | 4164 | struct kgem_bo *bo; |
|
- | 4165 | size_t size; |
|
- | 4166 | int ret; |
|
- | 4167 | ||
- | 4168 | ret = drmIoctl(kgem->fd, SRV_FBINFO, fb); |
|
- | 4169 | if( ret != 0 ) |
|
- | 4170 | return 0; |
|
- | 4171 | ||
- | 4172 | size = fb->pitch * fb->height / PAGE_SIZE; |
|
- | 4173 | ||
- | 4174 | bo = __kgem_bo_alloc(-2, size); |
|
- | 4175 | if (!bo) { |
|
- | 4176 | return 0; |
|
- | 4177 | } |
|
- | 4178 | ||
- | 4179 | bo->domain = DOMAIN_GTT; |
|
- | 4180 | bo->unique_id = kgem_get_unique_id(kgem); |
|
- | 4181 | bo->pitch = fb->pitch; |
|
- | 4182 | bo->tiling = I915_TILING_NONE; |
|
- | 4183 | bo->scanout = 1; |
|
- | 4184 | fb->fb_bo = bo; |
|
- | 4185 | ||
- | 4186 | printf("fb width %d height %d pitch %d bo %p\n", |
|
- | 4187 | fb->width, fb->height, fb->pitch, fb->fb_bo); |
|
- | 4188 | ||
- | 4189 | return 1; |
|
- | 4190 | };=>=>>=>>>>>=>>>=>>=>>=>=>>=>>>>>=>>>=>=>>>>=>=>>>>>=>>>>>>>>>>=>>=>=>=>=>=>=>=>=>>>>=>>=>>=>>=>>>>>>>>=>>>=><=>>>=>=>=>>><>><>>>>>>>>>>>>>>>>>>>>>=>31) |
|
- | 4191 | ><31) |