542 |
|
int mouse_last_x, mouse_last_y; // Last mouse position (for relative mode) |
543 |
|
}; |
544 |
|
|
545 |
+ |
class driver_dga; |
546 |
+ |
static void update_display_dga_vosf(driver_dga *drv); |
547 |
+ |
|
548 |
+ |
class driver_dga : public driver_base { |
549 |
+ |
friend void update_display_dga_vosf(driver_dga *drv); |
550 |
+ |
|
551 |
+ |
public: |
552 |
+ |
driver_dga(X11_monitor_desc &monitor); |
553 |
+ |
~driver_dga(); |
554 |
+ |
|
555 |
+ |
void suspend(void); |
556 |
+ |
void resume(void); |
557 |
+ |
|
558 |
+ |
protected: |
559 |
+ |
struct FakeXImage { |
560 |
+ |
int width, height; // size of image |
561 |
+ |
int depth; // depth of image |
562 |
+ |
int bytes_per_line; // accelerator to next line |
563 |
+ |
|
564 |
+ |
FakeXImage(int w, int h, int d) |
565 |
+ |
: width(w), height(h), depth(d) |
566 |
+ |
{ bytes_per_line = TrivialBytesPerRow(width, DepthModeForPixelDepth(depth)); } |
567 |
+ |
}; |
568 |
+ |
FakeXImage *img; |
569 |
+ |
|
570 |
+ |
private: |
571 |
+ |
Window suspend_win; // "Suspend" information window |
572 |
+ |
void *fb_save; // Saved frame buffer for suspend/resume |
573 |
+ |
}; |
574 |
+ |
|
575 |
|
static driver_base *drv = NULL; // Pointer to currently used driver object |
576 |
|
|
577 |
|
#ifdef ENABLE_VOSF |
765 |
|
use_vosf = true; |
766 |
|
// Allocate memory for frame buffer (SIZE is extended to page-boundary) |
767 |
|
the_host_buffer = the_buffer_copy; |
768 |
< |
the_host_buffer_row_bytes = img->bytes_per_line; |
739 |
< |
the_buffer_size = page_extend((aligned_height + 2) * the_host_buffer_row_bytes); |
768 |
> |
the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line); |
769 |
|
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
770 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
771 |
|
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer)); |
913 |
|
* DGA display driver base class |
914 |
|
*/ |
915 |
|
|
887 |
– |
class driver_dga : public driver_base { |
888 |
– |
public: |
889 |
– |
driver_dga(X11_monitor_desc &monitor); |
890 |
– |
~driver_dga(); |
891 |
– |
|
892 |
– |
void suspend(void); |
893 |
– |
void resume(void); |
894 |
– |
|
895 |
– |
private: |
896 |
– |
Window suspend_win; // "Suspend" information window |
897 |
– |
void *fb_save; // Saved frame buffer for suspend/resume |
898 |
– |
}; |
899 |
– |
|
916 |
|
driver_dga::driver_dga(X11_monitor_desc &m) |
917 |
< |
: driver_base(m), suspend_win(0), fb_save(NULL) |
917 |
> |
: driver_base(m), suspend_win(0), fb_save(NULL), img(NULL) |
918 |
|
{ |
919 |
|
} |
920 |
|
|
922 |
|
{ |
923 |
|
XUngrabPointer(x_display, CurrentTime); |
924 |
|
XUngrabKeyboard(x_display, CurrentTime); |
925 |
+ |
|
926 |
+ |
if (img) |
927 |
+ |
delete img; |
928 |
|
} |
929 |
|
|
930 |
|
// Suspend emulation |
1150 |
|
if (use_vosf) { |
1151 |
|
// Allocate memory for frame buffer (SIZE is extended to page-boundary) |
1152 |
|
the_host_buffer = the_buffer; |
1153 |
< |
the_host_buffer_row_bytes = bytes_per_row; |
1135 |
< |
the_buffer_size = page_extend((height + 2) * the_host_buffer_row_bytes); |
1153 |
> |
the_buffer_size = page_extend((height + 2) * bytes_per_row); |
1154 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
1155 |
|
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
1156 |
+ |
|
1157 |
+ |
// Fake image for DGA/VOSF mode to know about display bounds |
1158 |
+ |
img = new FakeXImage(width, height, depth_of_video_mode(mode)); |
1159 |
|
} |
1160 |
|
#else |
1161 |
|
use_vosf = false; |
1293 |
|
if (use_vosf) { |
1294 |
|
// Allocate memory for frame buffer (SIZE is extended to page-boundary) |
1295 |
|
the_host_buffer = the_buffer; |
1296 |
< |
the_host_buffer_row_bytes = bytes_per_row; |
1276 |
< |
the_buffer_size = page_extend((height + 2) * the_host_buffer_row_bytes); |
1296 |
> |
the_buffer_size = page_extend((height + 2) * bytes_per_row); |
1297 |
|
the_buffer_copy = (uint8 *)malloc(the_buffer_size); |
1298 |
|
the_buffer = (uint8 *)vm_acquire_mac(the_buffer_size); |
1299 |
+ |
|
1300 |
+ |
// Fake image for DGA/VOSF mode to know about display bounds |
1301 |
+ |
img = new FakeXImage((v_width + 7) & ~7, height, depth_of_video_mode(mode)); |
1302 |
|
} |
1303 |
|
#else |
1304 |
|
use_vosf = false; |
2494 |
|
tick_counter = 0; |
2495 |
|
if (mainBuffer.dirty) { |
2496 |
|
LOCK_VOSF; |
2497 |
< |
update_display_dga_vosf(); |
2497 |
> |
update_display_dga_vosf(static_cast<driver_dga *>(drv)); |
2498 |
|
UNLOCK_VOSF; |
2499 |
|
} |
2500 |
|
} |