screen_to_screen blit works! (if softcursor used, NM2097 and NM2160)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7054 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2004-03-22 19:32:25 +00:00
parent c04864640e
commit 4f567623c0
3 changed files with 37 additions and 18 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 4/2003-1/2004
Rudolf Cornelissen 4/2003-3/2004
*/
#define MODULE_BIT 0x00200000
@ -134,7 +134,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
nm_crtc_dpms(display,h,v);
/* set up acceleration for this mode */
// nm_acc_init();
nm_acc_init();
/* log currently selected output */
nm_general_output_select();

View File

@ -8,6 +8,8 @@
#include "nm_std.h"
static status_t nm_acc_wait_fifo(uint32 n);
/*acceleration notes*/
/*functions Be's app_server uses:
@ -21,21 +23,25 @@ blit
status_t nm_acc_wait_idle()
{
/* wait until engine completely idle */
switch (si->ps.card_type)
while (ACCR(STATUS) & 0x00000001)
{
case NM2097:
case NM2160:
while (ACCR(STATUS) & 0x00000001)
{
/* snooze a bit so I do not hammer the bus */
snooze (100);
}
break;
/* snooze a bit so I do not hammer the bus */
snooze (100);
}
return B_OK;
}
/* wait for enough room in fifo */
static status_t nm_acc_wait_fifo(uint32 n)
{
while (((ACCR(STATUS) & 0x0000ff00) >> 8) < n)
{
/* snooze a bit so I do not hammer the bus */
snooze (10);
}
}
/* AFAIK this must be done for every new screenmode.
* Engine required init. */
status_t nm_acc_init()
@ -91,6 +97,13 @@ status_t nm_acc_init()
return B_ERROR;
}
/* enable engine FIFO */
//fixme: does not work yet..
si->engine.control |= (1 << 27);
/* setup buffer startadress */
//fixme! setup..
/* fixme?: setup clipping */
return B_OK;
@ -101,22 +114,28 @@ status_t nm_acc_blit(uint16 xs,uint16 ys,uint16 xd,uint16 yd,uint16 w,uint16 h)
{
/* make sure the previous command (if any) is completed */
nm_acc_wait_idle();
//does not work yet:
// nm_acc_wait_fifo(4);
if ((yd < ys) || ((yd == ys) && (xd < xs)))
{
/* start with upper left corner */
ACCW(BLTCNTL, si->engine.control);
/* use ROP GXcopy (b16-19), and use XY coord. system (b24-25) */
ACCW(BLTCNTL, si->engine.control | 0x830c0000);
/* send command and exexute */
ACCW(SRCSTARTOFF, ((ys << 16) | (xs & 0x0000ffff)));
ACCW(DSTSTARTOFF, ((yd << 16) | (xd & 0x0000ffff)));
ACCW(XYEXT, ((h << 16) | (w & 0x0000ffff)));
ACCW(XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
}
else
{
/* start with lower right corner */
ACCW(BLTCNTL, (si->engine.control | 0x00000013));
ACCW(SRCSTARTOFF, (((ys + (h - 1)) << 16) | ((xs + (w - 1)) & 0x0000ffff)));
ACCW(DSTSTARTOFF, (((yd + (h - 1)) << 16) | ((xd + (w - 1)) & 0x0000ffff)));
ACCW(XYEXT, ((h << 16) | (w & 0x0000ffff)));
/* use ROP GXcopy (b16-19), and use XY coord. system (b24-25) */
ACCW(BLTCNTL, (si->engine.control | 0x830c0013));
/* send command and exexute */
ACCW(SRCSTARTOFF, (((ys + h) << 16) | ((xs + w) & 0x0000ffff)));
ACCW(DSTSTARTOFF, (((yd + h) << 16) | ((xd + w) & 0x0000ffff)));
ACCW(XYEXT, (((h + 1) << 16) | ((w + 1) & 0x0000ffff)));
}
return B_OK;

View File

@ -1,5 +1,5 @@
/* Author:
Rudolf Cornelissen 4/2003-1/2004
Rudolf Cornelissen 4/2003-3/2004
*/
#define MODULE_BIT 0x00008000