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

Comparing SheepShaver/src/gfxaccel.cpp (file contents):
Revision 1.2 by gbeauche, 2004-11-13T14:09:15Z vs.
Revision 1.6 by gbeauche, 2008-01-01T09:47:38Z

# Line 1 | Line 1
1   /*
2   *  gfxaccel.cpp - Generic Native QuickDraw acceleration
3   *
4 < *  SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer
4 > *  SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 52 | Line 52 | static inline int bytes_per_pixel(int de
52          return bpp;
53   }
54  
55 + // Pass-through dirty areas to redraw functions
56 + static inline void NQD_set_dirty_area(uint32 p)
57 + {
58 +        if (ReadMacInt32(p + acclDestBaseAddr) == screen_base) {
59 +                int16 x = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2);
60 +                int16 y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0);
61 +                int16 w  = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2);
62 +                int16 h = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0);
63 +                video_set_dirty_area(x, y, w, h);
64 +        }
65 + }
66 +
67  
68   /*
69   *      Rectangle inversion
# Line 282 | Line 294 | void NQD_fillrect(uint32 p)
294   bool NQD_fillrect_hook(uint32 p)
295   {
296          D(bug("accl_fillrect_hook %08x\n", p));
297 +        NQD_set_dirty_area(p);
298  
299          // Check if we can accelerate this fillrect
300          if (ReadMacInt32(p + 0x284) != 0 && ReadMacInt32(p + acclDestPixelSize) >= 8) {
301                  const int transfer_mode = ReadMacInt32(p + acclTransferMode);
302                  if (transfer_mode == 8) {
303                          // Fill
304 <                        WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_FILLRECT));
304 >                        WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_FILLRECT));
305                          return true;
306                  }
307                  else if (transfer_mode == 10) {
308                          // Invert
309 <                        WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_INVRECT));
309 >                        WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_INVRECT));
310                          return true;
311                  }
312          }
# Line 305 | Line 318 | bool NQD_fillrect_hook(uint32 p)
318   *      Isomorphic rectangle blitting
319   */
320  
308 // TODO: optimize for VOSF and target pixmap == screen
321   void NQD_bitblt(uint32 p)
322   {
323          D(bug("accl_bitblt %08x\n", p));
# Line 372 | Line 384 | void NQD_bitblt(uint32 p)
384   bool NQD_bitblt_hook(uint32 p)
385   {
386          D(bug("accl_draw_hook %08x\n", p));
387 +        NQD_set_dirty_area(p);
388  
389          // Check if we can accelerate this bitblt
390          if (ReadMacInt32(p + 0x018) + ReadMacInt32(p + 0x128) == 0 &&
391                  ReadMacInt32(p + 0x130) == 0 &&
392                  ReadMacInt32(p + acclSrcPixelSize) >= 8 &&
393                  ReadMacInt32(p + acclSrcPixelSize) == ReadMacInt32(p + acclDestPixelSize) &&
394 <                (ReadMacInt32(p + acclSrcRowBytes) ^ ReadMacInt32(p + acclDestRowBytes)) >= 0 && // same sign?
395 <                ReadMacInt32(p + acclTransferMode) == 0 &&                                                                               // srcCopy?
396 <                ReadMacInt32(p + 0x15c) > 0) {
394 >                (int32)(ReadMacInt32(p + acclSrcRowBytes) ^ ReadMacInt32(p + acclDestRowBytes)) >= 0 && // same sign?
395 >                ReadMacInt32(p + acclTransferMode) == 0 &&                                                                                              // srcCopy?
396 >                (int32)ReadMacInt32(p + 0x15c) > 0) {
397  
398                  // Yes, set function pointer
399 <                WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_BITBLT));
399 >                WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_NQD_BITBLT));
400                  return true;
401          }
402          return false;
403   }
404  
405 + // Unknown hook
406 + bool NQD_unknown_hook(uint32 arg)
407 + {
408 +        D(bug("accl_unknown_hook %08x\n", arg));
409 +        NQD_set_dirty_area(arg);
410 +
411 +        return false;
412 + }
413 +
414   // Wait for graphics operation to finish
415   bool NQD_sync_hook(uint32 arg)
416   {
# Line 410 | Line 432 | void VideoInstallAccel(void)
432  
433                  SheepVar bitblt_hook_info(sizeof(accl_hook_info));
434                  base = bitblt_hook_info.addr();
435 <                WriteMacInt32(base + 0, NativeTVECT(NATIVE_BITBLT_HOOK));
436 <                WriteMacInt32(base + 4, NativeTVECT(NATIVE_SYNC_HOOK));
435 >                WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_BITBLT_HOOK));
436 >                WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK));
437                  WriteMacInt32(base + 8, ACCL_BITBLT);
438                  NQDMisc(6, bitblt_hook_info.addr());
439  
440                  SheepVar fillrect_hook_info(sizeof(accl_hook_info));
441                  base = fillrect_hook_info.addr();
442 <                WriteMacInt32(base + 0, NativeTVECT(NATIVE_FILLRECT_HOOK));
443 <                WriteMacInt32(base + 4, NativeTVECT(NATIVE_SYNC_HOOK));
442 >                WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_FILLRECT_HOOK));
443 >                WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK));
444                  WriteMacInt32(base + 8, ACCL_FILLRECT);
445                  NQDMisc(6, fillrect_hook_info.addr());
446 +
447 +                for (int op = 0; op < 8; op++) {
448 +                        switch (op) {
449 +                        case ACCL_BITBLT:
450 +                        case ACCL_FILLRECT:
451 +                                continue;
452 +                        }
453 +                        SheepVar unknown_hook_info(sizeof(accl_hook_info));
454 +                        base = unknown_hook_info.addr();
455 +                        WriteMacInt32(base + 0, NativeTVECT(NATIVE_NQD_UNKNOWN_HOOK));
456 +                        WriteMacInt32(base + 4, NativeTVECT(NATIVE_NQD_SYNC_HOOK));
457 +                        WriteMacInt32(base + 8, op);
458 +                        NQDMisc(6, unknown_hook_info.addr());
459 +                }
460          }
461   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines