full 2D acc works on NM2097 and NM2160 (still with softcursor)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7062 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1ed3192432
commit
7e2c8d2a0d
@ -3,7 +3,7 @@
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
|
||||
Other authors:
|
||||
Rudolf Cornelissen 4/2003-
|
||||
Rudolf Cornelissen 4/2003-3/2004
|
||||
*/
|
||||
|
||||
#define MODULE_BIT 0x40000000
|
||||
@ -13,7 +13,7 @@
|
||||
void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*do each blit*/
|
||||
/* do each blit */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -33,7 +33,7 @@ void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count) {
|
||||
void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*do each blit*/
|
||||
/* do each blit */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -55,7 +55,7 @@ void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params
|
||||
void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*do each blit*/
|
||||
/* do each blit */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -76,7 +76,10 @@ void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colo
|
||||
void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*draw each rectangle*/
|
||||
/* init acc engine for fill function */
|
||||
nm_acc_setup_rectangle(colorIndex);
|
||||
|
||||
/* draw each rectangle */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -85,8 +88,7 @@ void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list,
|
||||
list[i].left,
|
||||
(list[i].right)+1,
|
||||
list[i].top,
|
||||
(list[i].bottom-list[i].top)+1,
|
||||
colorIndex
|
||||
(list[i].bottom-list[i].top)+1
|
||||
);
|
||||
i++;
|
||||
}
|
||||
@ -95,7 +97,10 @@ void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list,
|
||||
void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*draw each rectangle*/
|
||||
/* init acc engine for invert function */
|
||||
nm_acc_setup_rect_invert();
|
||||
|
||||
/* invert each rectangle */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -104,8 +109,7 @@ void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) {
|
||||
list[i].left,
|
||||
(list[i].right)+1,
|
||||
list[i].top,
|
||||
(list[i].bottom-list[i].top)+1,
|
||||
0
|
||||
(list[i].bottom-list[i].top)+1
|
||||
);
|
||||
i++;
|
||||
}
|
||||
@ -114,7 +118,10 @@ void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) {
|
||||
void FILL_SPAN(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count) {
|
||||
int i;
|
||||
|
||||
/*draw each span*/
|
||||
/* init acc engine for fill function */
|
||||
nm_acc_setup_rectangle(colorIndex);
|
||||
|
||||
/* draw each span */
|
||||
i=0;
|
||||
while (count--)
|
||||
{
|
||||
@ -123,8 +130,7 @@ void FILL_SPAN(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count)
|
||||
list[i+1],
|
||||
list[i+2]+1,
|
||||
list[i],
|
||||
1,
|
||||
colorIndex
|
||||
1
|
||||
);
|
||||
i+=3;
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ void * get_accelerant_hook(uint32 feature, void *data)
|
||||
/* only export 2D acceleration functions in modes that are capable of it */
|
||||
/* used by the app_server and applications (BWindowScreen) */
|
||||
CHKA(SCREEN_TO_SCREEN_BLIT);
|
||||
// CHKA(FILL_RECTANGLE);
|
||||
// CHKA(INVERT_RECTANGLE);
|
||||
// CHKA(FILL_SPAN);
|
||||
CHKA(FILL_RECTANGLE);
|
||||
CHKA(INVERT_RECTANGLE);
|
||||
CHKA(FILL_SPAN);
|
||||
/* not (yet) used by the app_server:
|
||||
* so just for application use (BWindowScreen) */
|
||||
// CHKA(SCREEN_TO_SCREEN_TRANSPARENT_BLIT);
|
||||
//CHKA(SCREEN_TO_SCREEN_TRANSPARENT_BLIT);
|
||||
//CHKA(SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "nm_std.h"
|
||||
|
||||
static status_t nm_acc_wait_fifo(uint32 n);
|
||||
//static status_t nm_acc_wait_fifo(uint32 n);
|
||||
|
||||
/*acceleration notes*/
|
||||
|
||||
@ -33,35 +33,31 @@ status_t nm_acc_wait_idle()
|
||||
}
|
||||
|
||||
/* wait for enough room in fifo */
|
||||
static status_t nm_acc_wait_fifo(uint32 n)
|
||||
{
|
||||
while (((ACCR(STATUS) & 0x0000ff00) >> 8) < n)
|
||||
{
|
||||
//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);
|
||||
}
|
||||
}
|
||||
// snooze (10);
|
||||
// }
|
||||
//}
|
||||
|
||||
/* AFAIK this must be done for every new screenmode.
|
||||
* Engine required init. */
|
||||
status_t nm_acc_init()
|
||||
{
|
||||
uint32 depth;
|
||||
|
||||
/* Set pixel width */
|
||||
switch(si->dm.space)
|
||||
{
|
||||
case B_CMAP8:
|
||||
/* b8-9 determine engine colordepth */
|
||||
si->engine.control = (1 << 8);
|
||||
// nAcl->ColorShiftAmt = 8;
|
||||
depth = 1;
|
||||
si->engine.depth = 1;
|
||||
break;
|
||||
case B_RGB15_LITTLE:case B_RGB16_LITTLE:
|
||||
/* b8-9 determine engine colordepth */
|
||||
si->engine.control = (2 << 8);
|
||||
// nAcl->ColorShiftAmt = 0;
|
||||
depth = 2;
|
||||
si->engine.depth = 2;
|
||||
break;
|
||||
case B_RGB24_LITTLE:
|
||||
/* no acceleration supported on NM2097 and NM2160 */
|
||||
@ -72,7 +68,7 @@ status_t nm_acc_init()
|
||||
|
||||
/* setup memory pitch (b10-12):
|
||||
* this works with a table, there are very few fixed settings.. */
|
||||
switch(si->fbc.bytes_per_row / depth)
|
||||
switch(si->fbc.bytes_per_row / si->engine.depth)
|
||||
{
|
||||
case 640:
|
||||
si->engine.control |= (2 << 10);
|
||||
@ -98,13 +94,18 @@ status_t nm_acc_init()
|
||||
}
|
||||
|
||||
/* enable engine FIFO */
|
||||
//fixme: does not work yet..
|
||||
si->engine.control |= (1 << 27);
|
||||
/* fixme when/if possible:
|
||||
* does not work on most cards.. (tried NM2160)
|
||||
* workaround: always wait until engine completely idle before programming. */
|
||||
// si->engine.control |= (1 << 27);
|
||||
|
||||
/* setup buffer startadress */
|
||||
//fixme! setup..
|
||||
/* fixme when/if possible:
|
||||
* not possible on all cards or not enough specs known :-/ (tried NM2160)
|
||||
* workaround: place cursor bitmap _after_ screenbuffer instead of vice versa. */
|
||||
|
||||
/* fixme?: setup clipping */
|
||||
/* setup clipping */
|
||||
/* apparantly not needed. */
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -113,9 +114,10 @@ status_t nm_acc_init()
|
||||
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:
|
||||
// does not work yet:
|
||||
// nm_acc_wait_fifo(4);
|
||||
// so:
|
||||
nm_acc_wait_idle();
|
||||
|
||||
if ((yd < ys) || ((yd == ys) && (xd < xs)))
|
||||
{
|
||||
@ -141,129 +143,79 @@ status_t nm_acc_blit(uint16 xs,uint16 ys,uint16 xd,uint16 yd,uint16 w,uint16 h)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* screen to screen tranparent blit - not sure what uses this.
|
||||
* Engine function bitblit, paragraph 4.5.7.2 */
|
||||
/* rectangle fill - i.e. workspace and window background color */
|
||||
/* span fill - i.e. (selected) menuitem background color (Dano) */
|
||||
status_t nm_acc_setup_rectangle(uint32 color)
|
||||
{
|
||||
// does not work yet:
|
||||
// nm_acc_wait_fifo(2);
|
||||
// so:
|
||||
nm_acc_wait_idle();
|
||||
|
||||
/* use ROP GXcopy (b16-19), use XY coord. system (b24-25), do foreground color (b3) */
|
||||
ACCW(BLTCNTL, (si->engine.control | 0x830c0008));
|
||||
/* setup color */
|
||||
ACCW(FGCOLOR, color);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t nm_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl)
|
||||
{
|
||||
/* make sure the previous command (if any) is completed */
|
||||
// does not work yet:
|
||||
// nm_acc_wait_fifo(2);
|
||||
// so:
|
||||
nm_acc_wait_idle();
|
||||
|
||||
/* send command and exexute */
|
||||
ACCW(DSTSTARTOFF, ((ys << 16) | (xs & 0x0000ffff)));
|
||||
ACCW(XYEXT, ((yl << 16) | ((xe - xs) & 0x0000ffff)));
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* rectangle invert - i.e. text cursor and text selection */
|
||||
status_t nm_acc_setup_rect_invert()
|
||||
{
|
||||
/* make sure the previous command (if any) is completed */
|
||||
// does not work yet:
|
||||
// nm_acc_wait_fifo(4);
|
||||
// so:
|
||||
nm_acc_wait_idle();
|
||||
|
||||
/* use ROP GXinvert (b16-19), use XY coord. system (b24-25), do foreground color (b3) */
|
||||
ACCW(BLTCNTL, (si->engine.control | 0x83050008));
|
||||
/* reset color */
|
||||
ACCW(FGCOLOR, 0);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t nm_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl)
|
||||
{
|
||||
/* make sure the previous command (if any) is completed */
|
||||
// does not work yet:
|
||||
// nm_acc_wait_fifo(4);
|
||||
// so:
|
||||
nm_acc_wait_idle();
|
||||
|
||||
/* send command and exexute */
|
||||
ACCW(DSTSTARTOFF, ((ys << 16) | (xs & 0x0000ffff)));
|
||||
ACCW(XYEXT, ((yl << 16) | ((xe - xs) & 0x0000ffff)));
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* screen to screen tranparent blit */
|
||||
status_t nm_acc_transparent_blit(uint16 xs,uint16 ys,uint16 xd,uint16 yd,uint16 w,uint16 h,uint32 colour)
|
||||
{
|
||||
//fixme: implement.
|
||||
|
||||
return B_ERROR;
|
||||
|
||||
/*find where the top,bottom and offset are*/
|
||||
// offset = (si->fbc.bytes_per_row / (depth >> 3));
|
||||
|
||||
// t_end = t_start = xs + (offset*ys) + src_dst;
|
||||
// t_end += w;
|
||||
|
||||
// b_end = b_start = xs + (offset*(ys+h)) + src_dst;
|
||||
// b_end +=w;
|
||||
|
||||
/* sgnzero bit _must_ be '0' before accessing SGN! */
|
||||
// ACCW(DWGCTL,0x00000000);
|
||||
|
||||
/*find which quadrant */
|
||||
switch((yd>ys)|((xd>xs)<<1))
|
||||
{
|
||||
case 0: /*L->R,down*/
|
||||
// ACCW(SGN,0);
|
||||
|
||||
// ACCW(AR3,t_start);
|
||||
// ACCW(AR0,t_end);
|
||||
// ACCW(AR5,offset);
|
||||
|
||||
// ACCW_YDSTLEN(yd,h+1);
|
||||
break;
|
||||
case 1: /*L->R,up*/
|
||||
// ACCW(SGN,4);
|
||||
|
||||
// ACCW(AR3,b_start);
|
||||
// ACCW(AR0,b_end);
|
||||
// ACCW(AR5,-offset);
|
||||
|
||||
// ACCW_YDSTLEN(yd+h,h+1);
|
||||
break;
|
||||
case 2: /*R->L,down*/
|
||||
// ACCW(SGN,1);
|
||||
|
||||
// ACCW(AR3,t_end);
|
||||
// ACCW(AR0,t_start);
|
||||
// ACCW(AR5,offset);
|
||||
|
||||
// ACCW_YDSTLEN(yd,h+1);
|
||||
break;
|
||||
case 3: /*R->L,up*/
|
||||
// ACCW(SGN,5);
|
||||
|
||||
// ACCW(AR3,b_end);
|
||||
// ACCW(AR0,b_start);
|
||||
// ACCW(AR5,-offset);
|
||||
|
||||
// ACCW_YDSTLEN(yd+h,h+1);
|
||||
break;
|
||||
}
|
||||
// ACCW(FXBNDRY,((xd+w)<<16)|xd);
|
||||
|
||||
/*do the blit*/
|
||||
// ACCW(FCOL,colour);
|
||||
// ACCW(BCOL,0xffffffff);
|
||||
// ACCGO(DWGCTL,0x440C4018); // atype RSTR
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* rectangle fill.
|
||||
* Engine function rectangle_fill: paragraph 4.5.5.2 */
|
||||
/*colorIndex,fill_rect_params,count*/
|
||||
status_t nm_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col)
|
||||
{
|
||||
/*
|
||||
FXBNDRY - left and right coordinates a
|
||||
YDSTLEN - y start and no of lines a
|
||||
(or YDST and LEN)
|
||||
DWGCTL - atype must be RSTR or BLK a
|
||||
FCOL - foreground colour a
|
||||
*/
|
||||
|
||||
// ACCW(FXBNDRY,(xe<<16)|xs); /*set x start and end*/
|
||||
// ACCW_YDSTLEN(ys,yl); /*set y start and length*/
|
||||
// ACCW(FCOL,col); /*set colour*/
|
||||
|
||||
//acc fixme: checkout blockmode constraints for G100+ (mil: nc?): also add blockmode
|
||||
// for other functions, and use fastblt on MIL1/2 if possible...
|
||||
//or is CMAP8 contraint a non-blockmode contraint? (linearisation problem maybe?)
|
||||
if (si->dm.space==B_CMAP8)
|
||||
{
|
||||
// ACCGO(DWGCTL,0x400C7814); // atype RSTR
|
||||
}
|
||||
else
|
||||
{
|
||||
// ACCGO(DWGCTL,0x400C7844); // atype BLK
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* rectangle invert.
|
||||
* Engine function rectangle_fill: paragraph 4.5.5.2 */
|
||||
/*colorIndex,fill_rect_params,count*/
|
||||
status_t nm_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col)
|
||||
{
|
||||
/*
|
||||
FXBNDRY - left and right coordinates a
|
||||
YDSTLEN - y start and no of lines a
|
||||
(or YDST and LEN)
|
||||
DWGCTL - atype must be RSTR or BLK a
|
||||
FCOL - foreground colour a
|
||||
*/
|
||||
|
||||
// ACCW(FXBNDRY,(xe<<16)|xs); /*set x start and end*/
|
||||
// ACCW_YDSTLEN(ys,yl); /*set y start and length*/
|
||||
// ACCW(FCOL,col); /*set colour*/
|
||||
|
||||
/*draw it! top nibble is c is clipping enabled*/
|
||||
// ACCGO(DWGCTL,0x40057814); // atype RSTR
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* screen to screen scaled filtered blit - i.e. scale video in memory.
|
||||
* Engine function texture mapping for video, paragraphs 4.5.5.5 - 4.5.5.9 */
|
||||
/* screen to screen scaled filtered blit - i.e. scale video in memory */
|
||||
status_t nm_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
|
||||
uint16 xd,uint16 yd,uint16 wd,uint16 hd)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ status_t nm_general_powerup()
|
||||
{
|
||||
status_t status;
|
||||
|
||||
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-2 running.\n"));
|
||||
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-3 running.\n"));
|
||||
|
||||
/* detect card type and power it up */
|
||||
switch(CFGR(DEVID))
|
||||
|
@ -55,9 +55,11 @@ status_t nm_crtc_cursor_hide(void);
|
||||
/*acceleration functions*/
|
||||
status_t check_acc_capability(uint32 feature);
|
||||
status_t nm_acc_init(void);
|
||||
status_t nm_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col);
|
||||
status_t nm_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col);
|
||||
status_t nm_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 );
|
||||
status_t nm_acc_setup_rectangle(uint32 color);
|
||||
status_t nm_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
|
||||
status_t nm_acc_setup_rect_invert(void);
|
||||
status_t nm_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
|
||||
status_t nm_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32);
|
||||
status_t nm_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
|
||||
uint16 xd,uint16 yd,uint16 wd,uint16 hd);
|
||||
|
@ -4,14 +4,14 @@
|
||||
</head>
|
||||
<body>
|
||||
<p><h2>Changes done for each driverversion:</h2></p>
|
||||
<p><h1>head (0.06-2, Rudolf)</h1></p>
|
||||
<p><h1>head (0.06-3, Rudolf)</h1></p>
|
||||
<ul>
|
||||
<li>Updated modelist to include one more suggested mode for 800x600 resolution: Done by Andrew Bachmann;
|
||||
<li>CRTC timing restriction checking updated: Modelists exported adhere to every cards max. CRTC capability now: the oldest cards support upto and including 1024x1000, while the newest cards support upto and including 1280x1024 resolution;
|
||||
<li>Kernel driver now signals abort on not being able to setup the INT routine instead of letting the machine freeze during accelerant initialisation;
|
||||
<li>BWindowScreen R3-style function update for acceleration (once setup) and page flipping/virtualscreens in apps ('Allegro' update): fixed cloning accelerants;
|
||||
<li>Updated acceleration engine management code;
|
||||
<li>Added partial acceleration for NM2097 and NM2160 (screen_to_screen blit).
|
||||
<li>Added full 2D acceleration for NM2097 and NM2160 cards (the others will be added later): use <strong>softcursor</strong> for now!!
|
||||
</ul>
|
||||
<p><h1>nm_driver 0.05 (Rudolf)</h1></p>
|
||||
<ul>
|
||||
|
Loading…
Reference in New Issue
Block a user