194 |
|
// From main_unix.cpp |
195 |
|
extern char *x_display_name; |
196 |
|
extern Display *x_display; |
197 |
– |
extern void *vm_acquire_mac(size_t size); |
197 |
|
|
198 |
|
// From sys_unix.cpp |
199 |
|
extern void SysMountFirstFloppy(void); |
497 |
|
|
498 |
|
|
499 |
|
/* |
500 |
+ |
* Framebuffer allocation routines |
501 |
+ |
*/ |
502 |
+ |
|
503 |
+ |
#ifdef ENABLE_VOSF |
504 |
+ |
#include "vm_alloc.h" |
505 |
+ |
|
506 |
+ |
static void *vm_acquire_framebuffer(uint32 size) |
507 |
+ |
{ |
508 |
+ |
// always try to allocate framebuffer at the same address |
509 |
+ |
static void *fb = VM_MAP_FAILED; |
510 |
+ |
if (fb != VM_MAP_FAILED) { |
511 |
+ |
if (vm_acquire_fixed(fb, size) < 0) |
512 |
+ |
fb = VM_MAP_FAILED; |
513 |
+ |
} |
514 |
+ |
if (fb == VM_MAP_FAILED) |
515 |
+ |
fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT); |
516 |
+ |
return fb; |
517 |
+ |
} |
518 |
+ |
|
519 |
+ |
static inline void vm_release_framebuffer(void *fb, uint32 size) |
520 |
+ |
{ |
521 |
+ |
vm_release(fb, size); |
522 |
+ |
} |
523 |
+ |
#endif |
524 |
+ |
|
525 |
+ |
|
526 |
+ |
/* |
527 |
|
* Display "driver" classes |
528 |
|
*/ |
529 |
|
|
658 |
|
// the_buffer shall always be mapped through vm_acquire() so that we can vm_protect() it at will |
659 |
|
if (the_buffer != VM_MAP_FAILED) { |
660 |
|
D(bug(" releasing the_buffer at %p (%d bytes)\n", the_buffer, the_buffer_size)); |
661 |
< |
vm_release(the_buffer, the_buffer_size); |
661 |
> |
vm_release_framebuffer(the_buffer, the_buffer_size); |
662 |
|
the_buffer = NULL; |
663 |
|
} |
664 |
|
if (the_host_buffer) { |
808 |
|
// Allocate memory for frame buffer (SIZE is extended to page-boundary) |
809 |
|
the_host_buffer = the_buffer_copy; |
810 |
|
the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line); |
811 |
< |
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
811 |
> |
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size); |
812 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
813 |
|
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); |
814 |
|
#else |
1188 |
|
the_host_buffer = the_buffer; |
1189 |
|
the_buffer_size = page_extend((height + 2) * bytes_per_row); |
1190 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
1191 |
< |
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
1191 |
> |
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size); |
1192 |
|
|
1193 |
|
// Fake image for DGA/VOSF mode to know about display bounds |
1194 |
|
img = new FakeXImage(width, height, depth_of_video_mode(mode)); |
1325 |
|
the_host_buffer = the_buffer; |
1326 |
|
the_buffer_size = page_extend((height + 2) * bytes_per_row); |
1327 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
1328 |
< |
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
1328 |
> |
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size); |
1329 |
|
|
1330 |
|
// Fake image for DGA/VOSF mode to know about display bounds |
1331 |
|
img = new FakeXImage((v_width + 7) & ~7, height, depth_of_video_mode(mode)); |