67 |
|
#include "user_strings.h" |
68 |
|
#include "video.h" |
69 |
|
|
70 |
< |
#define DEBUG 1 |
70 |
> |
#define DEBUG 0 |
71 |
|
#include "debug.h" |
72 |
|
|
73 |
|
|
340 |
|
InitFrameBufferMapping(); |
341 |
|
#else |
342 |
|
VideoMonitor.mac_frame_base = Host2MacAddr(the_buffer); |
343 |
– |
D(bug("Host frame buffer = %p, ", the_buffer)); |
343 |
|
#endif |
344 |
|
D(bug("VideoMonitor.mac_frame_base = %08x\n", VideoMonitor.mac_frame_base)); |
345 |
|
} |
505 |
|
} |
506 |
|
#ifdef ENABLE_VOSF |
507 |
|
else { |
508 |
+ |
if (the_host_buffer) { |
509 |
+ |
free(the_host_buffer); |
510 |
+ |
the_host_buffer = NULL; |
511 |
+ |
} |
512 |
|
if (the_buffer != (uint8 *)VM_MAP_FAILED) { |
513 |
|
vm_release(the_buffer, the_buffer_size); |
514 |
|
the_buffer = NULL; |
608 |
|
if (shm_error) { |
609 |
|
shmdt(shminfo.shmaddr); |
610 |
|
XDestroyImage(img); |
611 |
+ |
img = NULL; |
612 |
|
shminfo.shmid = -1; |
613 |
|
} else { |
614 |
|
have_shm = true; |
634 |
|
the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line); |
635 |
|
the_buffer_copy = (uint8 *)vm_acquire(the_buffer_size); |
636 |
|
the_buffer = (uint8 *)vm_acquire(the_buffer_size); |
637 |
+ |
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); |
638 |
|
#else |
639 |
|
// Allocate memory for frame buffer |
640 |
|
the_buffer = (uint8 *)malloc((aligned_height + 2) * img->bytes_per_line); |
641 |
+ |
D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy)); |
642 |
|
#endif |
643 |
|
|
644 |
|
// Create GC |
674 |
|
// Close display |
675 |
|
driver_window::~driver_window() |
676 |
|
{ |
671 |
– |
if (img) |
672 |
– |
XDestroyImage(img); |
677 |
|
if (have_shm) { |
678 |
|
XShmDetach(x_display, &shminfo); |
679 |
+ |
#ifdef ENABLE_VOSF |
680 |
+ |
the_host_buffer = NULL; // don't free() in driver_base dtor |
681 |
+ |
#else |
682 |
|
the_buffer_copy = NULL; // don't free() in driver_base dtor |
683 |
+ |
#endif |
684 |
+ |
} |
685 |
+ |
if (img) |
686 |
+ |
XDestroyImage(img); |
687 |
+ |
if (have_shm) { |
688 |
+ |
shmdt(shminfo.shmaddr); |
689 |
+ |
shmctl(shminfo.shmid, IPC_RMID, 0); |
690 |
|
} |
691 |
|
if (gc) |
692 |
|
XFreeGC(x_display, gc); |