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 3... | Line 3... | ||
3 | #include |
3 | #include |
4 | #include |
4 | #include |
Line 5... | Line 5... | ||
5 | 5 | ||
Line -... | Line 6... | ||
- | 6 | #include "sna.h" |
|
- | 7 | ||
- | 8 | #include |
|
- | 9 | ||
6 | #include "sna.h" |
10 | static struct sna_fb sna_fb; |
7 | 11 | ||
8 | typedef struct __attribute__((packed)) |
12 | typedef struct __attribute__((packed)) |
9 | { |
13 | { |
10 | unsigned handle; |
14 | unsigned handle; |
Line 62... | Line 66... | ||
62 | // render->fill = no_render_fill; |
66 | // render->fill = no_render_fill; |
63 | // render->fill_one = no_render_fill_one; |
67 | // render->fill_one = no_render_fill_one; |
64 | // render->clear = no_render_clear; |
68 | // render->clear = no_render_clear; |
Line 65... | Line 69... | ||
65 | 69 | ||
66 | render->reset = no_render_reset; |
70 | render->reset = no_render_reset; |
67 | render->flush = no_render_flush; |
71 | // render->flush = no_render_flush; |
Line 68... | Line 72... | ||
68 | // render->fini = no_render_fini; |
72 | // render->fini = no_render_fini; |
69 | 73 | ||
Line 127... | Line 131... | ||
127 | 131 | ||
128 | // if (!sna_solid_cache_init(sna)) |
132 | // if (!sna_solid_cache_init(sna)) |
Line 129... | Line 133... | ||
129 | // return false; |
133 | // return false; |
130 | - | ||
131 | sna_device = sna; |
- | |
132 | #if 0 |
- | |
133 | { |
- | |
134 | struct kgem_bo *screen_bo; |
- | |
135 | bitmap_t screen; |
- | |
136 | - | ||
137 | screen.pitch = 1024*4; |
- | |
138 | screen.gaddr = 0; |
- | |
139 | screen.width = 1024; |
- | |
Line 140... | Line -... | ||
140 | screen.height = 768; |
- | |
Line 141... | Line 134... | ||
141 | screen.obj = (void*)-1; |
134 | |
142 | - | ||
143 | screen_bo = create_bo(&screen); |
- | |
144 | - | ||
145 | sna->render.clear(sna, &screen, screen_bo); |
- | |
146 | } |
135 | sna_device = sna; |
Line 147... | Line 136... | ||
147 | #endif |
136 | |
148 | 137 | ||
149 | return true; |
138 | return kgem_init_fb(&sna->kgem, &sna_fb); |
Line 337... | Line 326... | ||
337 | } |
326 | } |
Line 338... | Line 327... | ||
338 | 327 | ||
Line 339... | Line 328... | ||
339 | #endif |
328 | #endif |
340 | 329 | ||
Line 341... | Line 330... | ||
341 | 330 | ||
342 | int sna_blit_copy(uint32_t dst_bitmap, int dst_x, int dst_y, |
331 | int sna_blit_copy(bitmap_t *src_bitmap, int dst_x, int dst_y, |
- | 332 | int w, int h, int src_x, int src_y) |
|
343 | int w, int h, uint32_t src_bitmap, int src_x, int src_y) |
333 | |
Line 344... | Line 334... | ||
344 | 334 | { |
|
345 | { |
335 | struct sna_copy_op copy; |
Line 346... | Line 336... | ||
346 | struct sna_copy_op copy; |
336 | struct _Pixmap src, dst; |
347 | struct kgem_bo src_bo, dst_bo; |
337 | struct kgem_bo *src_bo; |
348 | 338 | ||
349 | memset(&src_bo, 0, sizeof(src_bo)); |
339 | memset(&src, 0, sizeof(src)); |
350 | memset(&dst_bo, 0, sizeof(dst_bo)); |
340 | memset(&dst, 0, sizeof(dst)); |
351 | 341 | ||
352 | // src_bo.gaddr = src_bitmap->gaddr; |
342 | src.drawable.bitsPerPixel = 32; |
Line 353... | Line 343... | ||
353 | // src_bo.pitch = src_bitmap->pitch; |
343 | src.drawable.width = src_bitmap->width; |
Line -... | Line 344... | ||
- | 344 | src.drawable.height = src_bitmap->height; |
|
- | 345 | ||
354 | // src_bo.tiling = 0; |
346 | dst.drawable.bitsPerPixel = 32; |
- | 347 | dst.drawable.width = sna_fb.width; |
|
- | 348 | dst.drawable.height = sna_fb.height; |
|
- | 349 | ||
355 | 350 | memset(©, 0, sizeof(copy)); |
|
356 | // dst_bo.gaddr = dst_bitmap->gaddr; |
351 | |
- | 352 | src_bo = (struct kgem_bo*)src_bitmap->handle; |
|
Line -... | Line 353... | ||
- | 353 | ||
Line 357... | Line -... | ||
357 | // dst_bo.pitch = dst_bitmap->pitch; |
- | |
358 | // dst_bo.tiling = 0; |
354 | if( sna_device->render.copy(sna_device, GXcopy, |
Line 359... | Line 355... | ||
359 | 355 | &src, src_bo, |
|
Line -... | Line 356... | ||
- | 356 | &dst, sna_fb.fb_bo, ©) ) |
|
- | 357 | { |
|
- | 358 | copy.blt(sna_device, ©, src_x, src_y, w, h, dst_x, dst_y); |
|
- | 359 | copy.done(sna_device, ©); |
|
- | 360 | } |
|
- | 361 | ||
- | 362 | kgem_submit(&sna_device->kgem); |
|
- | 363 | ||
- | 364 | // __asm__ __volatile__("int3"); |
|
Line -... | Line 365... | ||
- | 365 | ||
- | 366 | }; |
|
- | 367 | ||
- | 368 | int sna_create_bitmap(bitmap_t *bitmap) |
|
- | 369 | { |
|
- | 370 | struct kgem_bo *bo; |
|
- | 371 | ||
- | 372 | bo = kgem_create_2d(&sna_device->kgem, bitmap->width, bitmap->height, |
|
- | 373 | 32,I915_TILING_NONE, CREATE_CPU_MAP); |
|
- | 374 | ||
- | 375 | if(bo == NULL) |
|
- | 376 | goto err_1; |
|
- | 377 | ||
- | 378 | void *map = kgem_bo_map(&sna_device->kgem, bo); |
|
- | 379 | if(map == NULL) |
|
- | 380 | goto err_2; |
|
360 | memset(©, 0, sizeof(copy)); |
381 | |
Line 361... | Line 382... | ||
361 | 382 | bitmap->handle = (uint32_t)bo; |
|
362 | sna_device->render.copy(sna_device, GXcopy, NULL, &src_bo, NULL, &dst_bo, ©); |
383 | bitmap->pitch = bo->pitch; |
363 | copy.blt(sna_device, ©, src_x, src_y, w, h, dst_x, dst_y); |
384 | bitmap->data = map; |