ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_x.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/video_x.cpp (file contents):
Revision 1.61 by cebix, 2001-07-14T15:02:47Z vs.
Revision 1.62 by gbeauche, 2001-07-14T18:41:05Z

# Line 523 | Line 523 | driver_base::~driver_base()
523          }
524   #ifdef ENABLE_VOSF
525          else {
526 +                // the_buffer shall always be mapped through vm_acquire() so that we can vm_protect() it at will
527 +                if (the_buffer != VM_MAP_FAILED) {
528 +                        D(bug(" releasing the_buffer at %p (%d bytes)\n", the_buffer, the_buffer_size));
529 +                        vm_release(the_buffer, the_buffer_size);
530 +                        the_buffer = NULL;
531 +                }
532                  if (the_host_buffer) {
533                          D(bug(" freeing the_host_buffer at %p\n", the_host_buffer));
534                          free(the_host_buffer);
535                          the_host_buffer = NULL;
536                  }
531                if (the_buffer) {
532                        D(bug(" freeing the_buffer at %p\n", the_buffer));
533                        free(the_buffer);
534                        the_buffer = NULL;
535                }
537                  if (the_buffer_copy) {
538                          D(bug(" freeing the_buffer_copy at %p\n", the_buffer_copy));
539                          free(the_buffer_copy);
# Line 583 | Line 584 | driver_window::driver_window(const video
584          // Set absolute mouse mode
585          ADBSetRelMouseMode(mouse_grabbed);
586  
587 <        // Create window (setting backround_pixel, border_pixel and colormap is
587 >        // Create window (setting background_pixel, border_pixel and colormap is
588          // mandatory when using a non-default visual; in 1-bit mode we use the
589          // default visual, so we can also use the default colormap)
590          XSetWindowAttributes wattr;
# Line 675 | Line 676 | driver_window::driver_window(const video
676          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
677          the_host_buffer = the_buffer_copy;
678          the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line);
678        the_buffer_copy = (uint8 *)vm_acquire(the_buffer_size);
679          the_buffer = (uint8 *)vm_acquire(the_buffer_size);
680 +        the_buffer_copy = (uint8 *)malloc(the_buffer_size);
681          D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
682   #else
683          // Allocate memory for frame buffer
# Line 725 | Line 726 | driver_window::~driver_window()
726                  the_buffer_copy = NULL; // don't free() in driver_base dtor
727   #endif
728          }
728 #ifdef ENABLE_VOSF
729        if (use_vosf) {
730                // don't free() memory mapped buffers in driver_base dtor
731                if (the_buffer != VM_MAP_FAILED) {
732                        D(bug(" releasing the_buffer at %p\n", the_buffer));
733                        vm_release(the_buffer, the_buffer_size);
734                        the_buffer = NULL;
735                }
736                if (the_buffer_copy != VM_MAP_FAILED) {
737                        D(bug(" releasing the_buffer_copy at %p\n", the_buffer_copy));
738                        vm_release(the_buffer_copy, the_buffer_size);
739                        the_buffer_copy = NULL;
740                }
741        }
742 #endif
729          if (img) {
730                  if (!have_shm)
731                          img->data = NULL;
# Line 1086 | Line 1072 | driver_fbdev::driver_fbdev(const video_m
1072            // Allocate memory for frame buffer (SIZE is extended to page-boundary)
1073            the_host_buffer = the_buffer;
1074            the_buffer_size = page_extend((height + 2) * bytes_per_row);
1075 <          the_buffer_copy = (uint8 *)vm_acquire(the_buffer_size);
1075 >          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
1076            the_buffer = (uint8 *)vm_acquire(the_buffer_size);
1077          }
1078   #else
# Line 1121 | Line 1107 | driver_fbdev::~driver_fbdev()
1107                          munmap(the_host_buffer, the_buffer_size);
1108                          the_host_buffer = NULL;
1109                  }
1124                if (the_buffer_copy != VM_MAP_FAILED) {
1125                        vm_release(the_buffer_copy, the_buffer_size);
1126                        the_buffer_copy = NULL;
1127                }
1128                if (the_buffer != VM_MAP_FAILED) {
1129                        vm_release(the_buffer, the_buffer_size);
1130                        the_buffer = NULL;
1131                }
1110          }
1111   #endif
1112   }
# Line 1227 | Line 1205 | driver_xf86dga::driver_xf86dga(const vid
1205            // Allocate memory for frame buffer (SIZE is extended to page-boundary)
1206            the_host_buffer = the_buffer;
1207            the_buffer_size = page_extend((height + 2) * bytes_per_row);
1208 <          the_buffer_copy = (uint8 *)vm_acquire(the_buffer_size);
1208 >          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
1209            the_buffer = (uint8 *)vm_acquire(the_buffer_size);
1210          }
1211   #else
# Line 1256 | Line 1234 | driver_xf86dga::~driver_xf86dga()
1234          else {
1235                  // don't free() the screen buffer in driver_base dtor
1236                  the_host_buffer = NULL;
1259                
1260                if (the_buffer_copy != VM_MAP_FAILED) {
1261                        vm_release(the_buffer_copy, the_buffer_size);
1262                        the_buffer_copy = NULL;
1263                }
1264                if (the_buffer != VM_MAP_FAILED) {
1265                        vm_release(the_buffer, the_buffer_size);
1266                        the_buffer = NULL;
1267                }
1237          }
1238   #endif
1239   #ifdef ENABLE_XF86_VIDMODE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines