git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VESA - Debugging issue on VIA S3 BIOS
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
drvutil.c
diff --git
a/KernelLand/Kernel/drvutil.c
b/KernelLand/Kernel/drvutil.c
index
d19a050
..
d2c86bf
100644
(file)
--- a/
KernelLand/Kernel/drvutil.c
+++ b/
KernelLand/Kernel/drvutil.c
@@
-136,7
+136,7
@@
int DrvUtil_Video_WriteLFB(tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t
int x, y;
int bytes_per_px = (FBInfo->Depth + 7) / 8;
ENTER("pFBInfo xOffset xLength pBuffer",
int x, y;
int bytes_per_px = (FBInfo->Depth + 7) / 8;
ENTER("pFBInfo xOffset xLength pBuffer",
-
Mode,
FBInfo, Offset, Length, Buffer);
+ FBInfo, Offset, Length, Buffer);
csr_x = FBInfo->CursorX;
csr_y = FBInfo->CursorY;
csr_x = FBInfo->CursorX;
csr_y = FBInfo->CursorY;
@@
-287,9
+287,12
@@
int DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bi
int csrX = Buf->CursorX, csrY = Buf->CursorY;
size_t size;
int csrX = Buf->CursorX, csrY = Buf->CursorY;
size_t size;
+ ENTER("pBuf pBitmap", Buf, Bitmap);
+
// Clear old bitmap
if( Buf->CursorBitmap )
{
// Clear old bitmap
if( Buf->CursorBitmap )
{
+ LOG("Clearing old cursor");
DrvUtil_Video_RemoveCursor(Buf);
if( !Bitmap || Bitmap->W != Buf->CursorBitmap->W || Bitmap->H != Buf->CursorBitmap->H )
{
DrvUtil_Video_RemoveCursor(Buf);
if( !Bitmap || Bitmap->W != Buf->CursorBitmap->W || Bitmap->H != Buf->CursorBitmap->H )
{
@@
-306,24
+309,29
@@
int DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bi
{
Buf->CursorX = -1;
Buf->CursorY = -1;
{
Buf->CursorX = -1;
Buf->CursorY = -1;
+ LEAVE('i', 0);
return 0;
}
// Sanity check the bitmap
return 0;
}
// Sanity check the bitmap
+ LOG("Sanity checking plox");
if( !CheckMem(Bitmap, sizeof(*Bitmap)) || !CheckMem(Bitmap->Data, Bitmap->W*Bitmap->H*sizeof(Uint32)) )
{
Log_Warning("DrvUtil", "DrvUtil_Video_SetCursor: Bitmap (%p) is in invalid memory", Bitmap);
errno = -EINVAL;
if( !CheckMem(Bitmap, sizeof(*Bitmap)) || !CheckMem(Bitmap->Data, Bitmap->W*Bitmap->H*sizeof(Uint32)) )
{
Log_Warning("DrvUtil", "DrvUtil_Video_SetCursor: Bitmap (%p) is in invalid memory", Bitmap);
errno = -EINVAL;
+ LEAVE('i', -1);
return -1;
}
// Don't take a copy of the DrvUtil provided cursor
if( Bitmap == &gDrvUtil_TextModeCursor )
{
return -1;
}
// Don't take a copy of the DrvUtil provided cursor
if( Bitmap == &gDrvUtil_TextModeCursor )
{
+ LOG("No copy (provided cursor)");
Buf->CursorBitmap = Bitmap;
}
else
{
Buf->CursorBitmap = Bitmap;
}
else
{
+ LOG("Make copy");
size = sizeof(tVideo_IOCtl_Bitmap) + Bitmap->W*Bitmap->H*4;
// Take a copy
size = sizeof(tVideo_IOCtl_Bitmap) + Bitmap->W*Bitmap->H*4;
// Take a copy
@@
-332,7
+340,9
@@
int DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bi
}
// Restore cursor position
}
// Restore cursor position
+ LOG("Drawing");
DrvUtil_Video_DrawCursor(Buf, csrX, csrY);
DrvUtil_Video_DrawCursor(Buf, csrX, csrY);
+ LEAVE('i', 0);
return 0;
}
return 0;
}
@@
-340,24
+350,30
@@
void DrvUtil_Video_DrawCursor(tDrvUtil_Video_BufInfo *Buf, int X, int Y)
{
int render_ox=0, render_oy=0, render_w, render_h;
{
int render_ox=0, render_oy=0, render_w, render_h;
+ ENTER("pBuf iX iY", Buf, X, Y);
DrvUtil_Video_RemoveCursor(Buf);
// X < 0 disables the cursor
if( X < 0 ) {
Buf->CursorX = -1;
DrvUtil_Video_RemoveCursor(Buf);
// X < 0 disables the cursor
if( X < 0 ) {
Buf->CursorX = -1;
+ LEAVE('-');
return ;
}
// Sanity checking
return ;
}
// Sanity checking
- if( X < 0 || Y < 0 ) return;
- if( X >= Buf->Width || Y >= Buf->Height ) return;
+ if( X < 0 || Y < 0 || X >= Buf->Width || Y >= Buf->Height ) {
+ LEAVE('-');
+ return ;
+ }
// Ensure the cursor is enabled
// Ensure the cursor is enabled
- if( !Buf->CursorBitmap ) return ;
+ if( !Buf->CursorBitmap ) {
+ LEAVE('-');
+ return ;
+ }
// Save cursor position (for changing the bitmap)
Buf->CursorX = X; Buf->CursorY = Y;
// Save cursor position (for changing the bitmap)
Buf->CursorX = X; Buf->CursorY = Y;
-
// Apply cursor's center offset
X -= Buf->CursorBitmap->XOfs;
Y -= Buf->CursorBitmap->YOfs;
// Apply cursor's center offset
X -= Buf->CursorBitmap->XOfs;
Y -= Buf->CursorBitmap->YOfs;
@@
-375,8
+391,12
@@
void DrvUtil_Video_DrawCursor(tDrvUtil_Video_BufInfo *Buf, int X, int Y)
Buf->CursorDestX = X; Buf->CursorDestY = Y;
Buf->CursorReadX = render_ox; Buf->CursorReadY = render_oy;
Buf->CursorDestX = X; Buf->CursorDestY = Y;
Buf->CursorReadX = render_ox; Buf->CursorReadY = render_oy;
+ LOG("%ix%i at %i,%i offset %i,%i",
+ render_w, render_h, X, Y, render_ox, render_oy);
+
// Call render routine
DrvUtil_Video_RenderCursor(Buf);
// Call render routine
DrvUtil_Video_RenderCursor(Buf);
+ LEAVE('-');
}
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
}
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
@@
-393,10
+413,13
@@
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
dest = (Uint8*)Buf->Framebuffer + dest_y*Buf->Pitch + dest_x*bytes_per_px;
src = Buf->CursorBitmap->Data + src_y * Buf->CursorBitmap->W + src_x;
dest = (Uint8*)Buf->Framebuffer + dest_y*Buf->Pitch + dest_x*bytes_per_px;
src = Buf->CursorBitmap->Data + src_y * Buf->CursorBitmap->W + src_x;
+ LOG("dest = %p, src = %p", dest, src);
+
// Allocate save buffer if not already
if( !Buf->CursorSaveBuf )
Buf->CursorSaveBuf = malloc( Buf->CursorBitmap->W*Buf->CursorBitmap->H*bytes_per_px );
// Allocate save buffer if not already
if( !Buf->CursorSaveBuf )
Buf->CursorSaveBuf = malloc( Buf->CursorBitmap->W*Buf->CursorBitmap->H*bytes_per_px );
+ LOG("Saving back");
// Save behind the cursor
for( y = 0; y < render_h; y ++ )
memcpy(
// Save behind the cursor
for( y = 0; y < render_h; y ++ )
memcpy(
@@
-413,6
+436,7
@@
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
Log_Warning("DrvUtil", "TODO: Support 15/16 bpp modes in cursor draw");
break;
case 24:
Log_Warning("DrvUtil", "TODO: Support 15/16 bpp modes in cursor draw");
break;
case 24:
+ LOG("24-bit render");
for( y = 0; y < render_h; y ++ )
{
Uint8 *px;
for( y = 0; y < render_h; y ++ )
{
Uint8 *px;
@@
-435,6
+459,7
@@
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
}
break;
case 32:
}
break;
case 32:
+ LOG("32-bit render");
for( y = 0; y < render_h; y ++ )
{
Uint32 *px;
for( y = 0; y < render_h; y ++ )
{
Uint32 *px;
@@
-448,6
+473,7
@@
void DrvUtil_Video_RenderCursor(tDrvUtil_Video_BufInfo *Buf)
else
; // NOP, completely transparent
}
else
; // NOP, completely transparent
}
+ LOG("row %i/%i (%p-%P) done", y+1, render_h, dest, MM_GetPhysAddr(dest));
src += Buf->CursorBitmap->W;
dest = (Uint8*)dest + Buf->Pitch;
}
src += Buf->CursorBitmap->W;
dest = (Uint8*)dest + Buf->Pitch;
}
@@
-556,7
+582,7
@@
void DrvUtil_Video_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uin
// --- Disk Driver Helpers ---
Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,
// --- Disk Driver Helpers ---
Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,
- tDrvUtil_Read_Callback ReadBlocks, Uint64 BlockSize,
Uint
Argument)
+ tDrvUtil_Read_Callback ReadBlocks, Uint64 BlockSize,
void *
Argument)
{
Uint8 tmp[BlockSize]; // C99
Uint64 block = Start / BlockSize;
{
Uint8 tmp[BlockSize]; // C99
Uint64 block = Start / BlockSize;
@@
-566,7
+592,7
@@
Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,
int tailings;
Uint64 ret;
int tailings;
Uint64 ret;
- ENTER("XStart XLength pBuffer pReadBlocks XBlockSize
x
Argument",
+ ENTER("XStart XLength pBuffer pReadBlocks XBlockSize
p
Argument",
Start, Length, Buffer, ReadBlocks, BlockSize, Argument);
// Non aligned start, let's fix that!
Start, Length, Buffer, ReadBlocks, BlockSize, Argument);
// Non aligned start, let's fix that!
@@
-627,7
+653,7
@@
Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,
Uint64 DrvUtil_WriteBlock(Uint64 Start, Uint64 Length, const void *Buffer,
tDrvUtil_Read_Callback ReadBlocks, tDrvUtil_Write_Callback WriteBlocks,
Uint64 DrvUtil_WriteBlock(Uint64 Start, Uint64 Length, const void *Buffer,
tDrvUtil_Read_Callback ReadBlocks, tDrvUtil_Write_Callback WriteBlocks,
- Uint64 BlockSize,
Uint
Argument)
+ Uint64 BlockSize,
void *
Argument)
{
Uint8 tmp[BlockSize]; // C99
Uint64 block = Start / BlockSize;
{
Uint8 tmp[BlockSize]; // C99
Uint64 block = Start / BlockSize;
@@
-637,7
+663,7
@@
Uint64 DrvUtil_WriteBlock(Uint64 Start, Uint64 Length, const void *Buffer,
int tailings;
Uint64 ret;
int tailings;
Uint64 ret;
- ENTER("XStart XLength pBuffer pReadBlocks pWriteBlocks XBlockSize
x
Argument",
+ ENTER("XStart XLength pBuffer pReadBlocks pWriteBlocks XBlockSize
p
Argument",
Start, Length, Buffer, ReadBlocks, WriteBlocks, BlockSize, Argument);
// Non aligned start, let's fix that!
Start, Length, Buffer, ReadBlocks, WriteBlocks, BlockSize, Argument);
// Non aligned start, let's fix that!
UCC
git Repository :: git.ucc.asn.au