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

Comparing SheepShaver/src/Unix/video_x.cpp (file contents):
Revision 1.39 by gbeauche, 2005-03-28T09:05:28Z vs.
Revision 1.40 by gbeauche, 2005-03-28T16:19:28Z

# Line 577 | Line 577 | static bool open_window(int width, int h
577          use_vosf = true;
578          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
579          the_host_buffer = the_buffer_copy;
580 <        the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line);
580 >        the_buffer_size = page_extend((aligned_height + 2) * (the_host_buffer_row_bytes = img->bytes_per_line));
581          the_buffer = (uint8 *)vm_acquire(the_buffer_size);
582          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
583          D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
# Line 643 | Line 643 | static bool open_fbdev(int width, int he
643          }
644          D(bug("[fbdev] Device ID: %s\n", fb_finfo.id));
645          D(bug("[fbdev] smem_start: %p [%d bytes]\n", fb_finfo.smem_start, fb_finfo.smem_len));
646 +
647          int fb_type = fb_finfo.type;
648          const char *fb_type_str = NULL;
649          switch (fb_type) {
# Line 654 | Line 655 | static bool open_fbdev(int width, int he
655          default:                                                        fb_type_str = "<unknown>";                              break;
656          }
657          D(bug("[fbdev] type: %s\n", fb_type_str));
658 +
659 +        if (fb_type != FB_TYPE_PACKED_PIXELS) {
660 +                D(bug("[fbdev] type '%s' not supported\n", fb_type_str));
661 +                return false;
662 +        }
663 +
664          int fb_visual = fb_finfo.visual;
665          const char *fb_visual_str;
666          switch (fb_visual) {
# Line 667 | Line 674 | static bool open_fbdev(int width, int he
674          }
675          D(bug("[fbdev] visual: %s\n", fb_visual_str));
676  
677 <        if (fb_type != FB_TYPE_PACKED_PIXELS) {
678 <                D(bug("[fbdev] type %s not supported\n", fb_type_str));
677 >        if (fb_visual != FB_VISUAL_TRUECOLOR) {
678 >                D(bug("[fbdev] visual '%s' not supported\n", fb_visual_str));
679                  return false;
680          }
681          
# Line 686 | Line 693 | static bool open_fbdev(int width, int he
693          XSetWindowAttributes wattr;
694          wattr.event_mask = eventmask = dga_eventmask;
695          wattr.override_redirect = True;
689        wattr.colormap = (depth == 1 ? DefaultColormap(x_display, screen) : cmap[0]);
696          the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth,
697 <                                                        InputOutput, vis, CWEventMask | CWOverrideRedirect |
698 <                                                        (color_class == DirectColor ? CWColormap : 0), &wattr);
697 >                                                        InputOutput, DefaultVisual(x_display, screen),
698 >                                                        CWEventMask | CWOverrideRedirect, &wattr);
699  
700          // Show window
701          XMapRaised(x_display, the_win);
# Line 711 | Line 717 | static bool open_fbdev(int width, int he
717          XDefineCursor(x_display, the_win, mac_cursor);
718  
719          // Init blitting routines
714        int bytes_per_row = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(depth));
720   #if ENABLE_VOSF
721 <        bool native_byte_order;
722 < #ifdef WORDS_BIGENDIAN
723 <        native_byte_order = (XImageByteOrder(x_display) == MSBFirst);
724 < #else
725 <        native_byte_order = (XImageByteOrder(x_display) == LSBFirst);
726 < #endif
727 < #if REAL_ADDRESSING || DIRECT_ADDRESSING
721 >        // Extract current screen color masks (we are in True Color mode)
722 >        VisualFormat visualFormat;
723 >        visualFormat.depth = xdepth = DefaultDepth(x_display, screen);
724 >        XMatchVisualInfo(x_display, screen, xdepth, TrueColor, &visualInfo);
725 >        assert(visualFormat.depth == visualInfo.depth);
726 >        visualFormat.Rmask = visualInfo.red_mask;
727 >        visualFormat.Gmask = visualInfo.green_mask;
728 >        visualFormat.Bmask = visualInfo.blue_mask;
729 >        D(bug("[fbdev] %d bpp, (%08x,%08x,%08x)\n",
730 >                  visualFormat.depth,
731 >                  visualFormat.Rmask, visualFormat.Gmask, visualFormat.Bmask));
732 >        D(bug("[fbdev] Mac depth %d bpp\n", depth));
733 >
734          // Screen_blitter_init() returns TRUE if VOSF is mandatory
735          // i.e. the framebuffer update function is not Blit_Copy_Raw
736 <        use_vosf = Screen_blitter_init(visualFormat, native_byte_order, depth);
737 <        
727 <        if (use_vosf) {
728 <          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
729 <          the_host_buffer = the_buffer;
730 <          the_buffer_size = page_extend((height + 2) * bytes_per_row);
731 <          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
732 <          the_buffer = (uint8 *)vm_acquire(the_buffer_size);
733 <          D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
734 <        }
736 > #ifdef WORDS_BIGENDIAN
737 >        const bool native_byte_order = (XImageByteOrder(x_display) == MSBFirst);
738   #else
739 <        use_vosf = false;
739 >        const bool native_byte_order = (XImageByteOrder(x_display) == LSBFirst);
740   #endif
741 +        Screen_blitter_init(visualFormat, native_byte_order, depth);
742 +        
743 +        // Allocate memory for frame buffer (SIZE is extended to page-boundary)
744 +        the_host_buffer = the_buffer;
745 +        the_host_buffer_row_bytes = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(visualFormat.depth));
746 +        the_buffer_size = page_extend((height + 2) * the_host_buffer_row_bytes);
747 +        the_buffer_copy = (uint8 *)malloc(the_buffer_size);
748 +        the_buffer = (uint8 *)vm_acquire(the_buffer_size);
749 +        D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
750   #endif
751  
752          // Set frame buffer base
753          D(bug("the_buffer = %p, use_vosf = %d\n", the_buffer, use_vosf));
754          screen_base = Host2MacAddr(the_buffer);
755 <        VModes[cur_mode].viRowBytes = bytes_per_row;
755 >        VModes[cur_mode].viRowBytes = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(depth));
756          return true;
757   #else
758          ErrorAlert("SheepShaver has been compiled with DGA support disabled.");
# Line 822 | Line 834 | static bool open_dga(int width, int heig
834          if (use_vosf) {
835            // Allocate memory for frame buffer (SIZE is extended to page-boundary)
836            the_host_buffer = the_buffer;
837 <          the_buffer_size = page_extend((height + 2) * bytes_per_row);
837 >          the_buffer_size = page_extend((height + 2) * (the_host_buffer_row_bytes = bytes_per_row));
838            the_buffer_copy = (uint8 *)malloc(the_buffer_size);
839            the_buffer = (uint8 *)vm_acquire(the_buffer_size);
840            D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
# Line 858 | Line 870 | static bool open_display(void)
870          }
871  
872          // Build up visualFormat structure
873 +        visualFormat.fullscreen = (display_type == DIS_SCREEN);
874          visualFormat.depth = visualInfo.depth;
875          visualFormat.Rmask = visualInfo.red_mask;
876          visualFormat.Gmask = visualInfo.green_mask;
# Line 1458 | Line 1471 | bool VideoInit(void)
1471                                          add_custom_mode(p, display_type, default_width, default_height, d, APPLE_CUSTOM);
1472                                  }
1473                          }
1474 + #ifdef ENABLE_VOSF
1475 +                } else if (display_type == DIS_SCREEN && is_fbdev_dga_mode) {
1476 +                        for (unsigned int d = APPLE_1_BIT; d <= default_mode; d++)
1477 +                                if (find_visual_for_depth(d))
1478 +                                        add_custom_mode(p, display_type, default_width, default_height, d, APPLE_CUSTOM);
1479 + #endif
1480                  } else
1481                          add_custom_mode(p, display_type, default_width, default_height, default_mode, APPLE_CUSTOM);
1482          } else if (window_modes) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines