added NM2200 and later (all MagicMedia cards) 2D acc function screen to screen blit: please test and provide feedback!

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8470 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2004-07-26 15:01:45 +00:00
parent a7b24bba52
commit 03a7a9ae4d
3 changed files with 81 additions and 24 deletions

View File

@ -3,7 +3,7 @@
This file may be used under the terms of the Be Sample Code License.
Other authors:
Rudolf Cornelissen 10/2002-5/2004
Rudolf Cornelissen 10/2002-7/2004
*/
#define MODULE_BIT 0x08000000
@ -183,7 +183,6 @@ status_t check_overlay_capability(uint32 feature)
status_t check_acc_capability(uint32 feature)
{
bool fill = false;
char *msg = "";
/* setup logmessage text */
@ -194,15 +193,12 @@ status_t check_acc_capability(uint32 feature)
break;
case B_FILL_RECTANGLE:
msg = "B_FILL_RECTANGLE";
fill = true;
break;
case B_INVERT_RECTANGLE:
msg = "B_INVERT_RECTANGLE";
fill = true;
break;
case B_FILL_SPAN:
msg = "B_FILL_SPAN";
fill = true;
break;
case B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT:
msg = "B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT";
@ -219,6 +215,13 @@ status_t check_acc_capability(uint32 feature)
* memory pitch.. */
if (si->acc_mode)
{
//fixme: temporary, until acc for these cards is completely setup...
if ((si->ps.card_type >= NM2200) && (feature != B_SCREEN_TO_SCREEN_BLIT))
{
LOG(4, ("Acc: Not exporting hook %s.\n", msg));
return B_ERROR;
}
LOG(4, ("Acc: Exporting hook %s.\n", msg));
return B_OK;
}

View File

@ -1,7 +1,7 @@
/* nm Acceleration functions */
/* Author:
Rudolf Cornelissen 3/2004-5/2004.
Rudolf Cornelissen 3/2004-7/2004.
*/
#define MODULE_BIT 0x00080000
@ -20,6 +20,7 @@ blit
*/
//fixme: acc setup for NM2070, NM2097 and NM2160 only for now...
//fixme: seperate acc routines for different architectures for (marginal) speedup?
status_t nm_acc_wait_idle()
{
/* wait until engine completely idle */
@ -60,7 +61,11 @@ status_t nm_acc_init()
si->engine.depth = 2;
break;
case B_RGB24_LITTLE:
/* no acceleration supported on NM2070, NM2097 and NM2160 */
/* b8-9 determine engine colordepth */
si->engine.control = (3 << 8);
si->engine.depth = 3;
/* no acceleration supported on NM2070 - NM2200: let them fallthrough... */
if (si->ps.card_type >= NM2230) break;
default:
LOG(8,("ACC: init, invalid bit depth\n"));
return B_ERROR;
@ -96,7 +101,7 @@ status_t nm_acc_init()
}
}
/* enable engine FIFO */
/* enable engine FIFO (fixme: works this way on pre NM2200 only (engine.control)) */
/* fixme when/if possible:
* does not work on most cards.. (tried NM2070 and NM2160)
* workaround: always wait until engine completely idle before programming. */
@ -107,7 +112,7 @@ status_t nm_acc_init()
* not possible on all cards or not enough specs known. (tried NM2160)
* workaround: place cursor bitmap at _end_ of cardRAM instead of in _beginning_. */
/* setup clipping */
/* setup clipping (fixme: works this way on pre NM2200 only (engine.control)) */
/* note:
* on NM2160 the max acc engine width of 1600 pixels can be programmed, but
* the max. height is only 1023 pixels (height register holds just 10 bits)!
@ -122,20 +127,42 @@ status_t nm_acc_init()
// ACCW(CLIPLT, 0);
// ACCW(CLIPRB, ((si->dm.virtual_height << 16) | (si->dm.virtual_width & 0x0000ffff)));
/* init some extra registers on NM2070 (memory pitch) */
if(si->ps.card_type == NM2070)
/* init some extra registers on some cards */
switch(si->ps.card_type)
{
case NM2070:
/* make sure the previous command (if any) is completed */
// does not work yet:
// nm_acc_wait_fifo(5);
// so:
nm_acc_wait_idle();
/* setup memory pitch */
ACCW(2070_PLANEMASK, 0x0000ffff);
ACCW(2070_SRCPITCH, si->fbc.bytes_per_row);
ACCW(2070_SRCBITOFF, 0);
ACCW(2070_DSTPITCH, si->fbc.bytes_per_row);
ACCW(2070_DSTBITOFF, 0);
break;
case NM2200:
case NM2230:
case NM2360:
case NM2380:
/* make sure the previous command (if any) is completed */
// does not work yet:
// nm_acc_wait_fifo(2);
// so:
nm_acc_wait_idle();
/* setup engine depth and pixel pitch */
ACCW(STATUS, ((si->engine.control & 0x0000ffff) << 16));
/* setup memory pitch */
ACCW(2200_PITCH,
((si->fbc.bytes_per_row << 16) | (si->fbc.bytes_per_row & 0x0000ffff)));
break;
default:
/* nothing to do */
break;
}
return B_OK;
@ -153,45 +180,67 @@ status_t nm_acc_blit(uint16 xs,uint16 ys,uint16 xd,uint16 yd,uint16 w,uint16 h)
if ((yd < ys) || ((yd == ys) && (xd < xs)))
{
/* start with upper left corner */
if (si->ps.card_type == NM2070)
switch (si->ps.card_type)
{
case NM2070:
/* use ROP GXcopy (b16-19), and use linear adressing system */
ACCW(CONTROL, si->engine.control | 0x000c0000);
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(2070_XYEXT, ((h << 16) | (w & 0x0000ffff)));
ACCW(SRCSTARTOFF, ((ys * si->fbc.bytes_per_row) + (xs * si->engine.depth)));
ACCW(2070_DSTSTARTOFF, ((yd * si->fbc.bytes_per_row) + (xd * si->engine.depth)));
}
else
{
break;
case NM2097:
case NM2160:
/* use ROP GXcopy (b16-19), and use XY coord. system (b24-25) */
ACCW(CONTROL, si->engine.control | 0x830c0000);
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(SRCSTARTOFF, ((ys << 16) | (xs & 0x0000ffff)));
ACCW(2090_DSTSTARTOFF, ((yd << 16) | (xd & 0x0000ffff)));
ACCW(2090_XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
break;
default: /* NM2200 and later */
/* use ROP GXcopy (b16-19), and use linear adressing system */
//fixme? it seems CONTROL nolonger needs direction, and can be pgm'd just once...
ACCW(CONTROL, (si->engine.control | 0x800c0000));
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(SRCSTARTOFF, ((ys * si->fbc.bytes_per_row) + (xs * si->engine.depth)));
ACCW(2090_DSTSTARTOFF, ((yd * si->fbc.bytes_per_row) + (xd * si->engine.depth)));
ACCW(2090_XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
break;
}
}
else
{
/* start with lower right corner */
if (si->ps.card_type == NM2070)
switch (si->ps.card_type)
{
case NM2070:
/* use ROP GXcopy (b16-19), and use linear adressing system */
ACCW(CONTROL, (si->engine.control | 0x000c0013));
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(2070_XYEXT, ((h << 16) | (w & 0x0000ffff)));
ACCW(SRCSTARTOFF, (((ys + h) * si->fbc.bytes_per_row) + ((xs + w) * si->engine.depth)));
ACCW(2070_DSTSTARTOFF, (((yd + h) * si->fbc.bytes_per_row) + ((xd + w) * si->engine.depth)));
}
else
{
break;
case NM2097:
case NM2160:
/* use ROP GXcopy (b16-19), and use XY coord. system (b24-25) */
ACCW(CONTROL, (si->engine.control | 0x830c0013));
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(SRCSTARTOFF, (((ys + h) << 16) | ((xs + w) & 0x0000ffff)));
ACCW(2090_DSTSTARTOFF, (((yd + h) << 16) | ((xd + w) & 0x0000ffff)));
ACCW(2090_XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
break;
default: /* NM2200 and later */
/* use ROP GXcopy (b16-19), and use linear adressing system */
//fixme? it seems CONTROL nolonger needs direction, and can be pgm'd just once...
ACCW(CONTROL, (si->engine.control | 0x800c0013));
/* send command and exexute (warning: order of programming regs is important!) */
ACCW(SRCSTARTOFF, (((ys + h) * si->fbc.bytes_per_row) + ((xs + w) * si->engine.depth)));
ACCW(2090_DSTSTARTOFF, (((yd + h) * si->fbc.bytes_per_row) + ((xd + w) * si->engine.depth)));
ACCW(2090_XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
break;
}
}

View File

@ -1,5 +1,5 @@
/* Author:
Rudolf Cornelissen 4/2003-6/2004
Rudolf Cornelissen 4/2003-7/2004
*/
#define MODULE_BIT 0x00008000
@ -47,7 +47,7 @@ status_t nm_general_powerup()
{
status_t status;
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-final running.\n"));
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.07 running.\n"));
/* detect card type and power it up */
switch(CFGR(DEVID))
@ -490,11 +490,16 @@ status_t nm_general_validate_pic_size (display_mode *target, uint32 *bytes_per_r
case NM2070:
case NM2097:
case NM2160:
if (target->space != B_RGB24) *acc_mode = true;
else *acc_mode = false;
case NM2200:
if (target->space == B_RGB24) *acc_mode = false;
break;
//fixme: no acc implemented for the cards below yet...
case NM2090:
case NM2093:
*acc_mode = false;
break;
default:
*acc_mode = false;
/* NM2230 and later cards support accelerated 24bit modes */
break;
}