Fix the display issue when using UnixUga driver to support graphic display

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5408 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2008-07-04 03:17:52 +00:00
parent 1a24918483
commit 288a3c98c7
2 changed files with 133 additions and 134 deletions

View File

@ -187,12 +187,9 @@ UgaSize(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height)
XResizeWindow (drv->display, drv->win, Width, Height); XResizeWindow (drv->display, drv->win, Width, Height);
/* Allocate image. */ /* Allocate image. */
if (XShmQueryExtension(drv->display) && TryCreateShmImage(drv)) if (XShmQueryExtension(drv->display) && TryCreateShmImage(drv)) {
{
drv->use_shm = 1; drv->use_shm = 1;
} } else {
else
{
drv->use_shm = 0; drv->use_shm = 0;
if (drv->depth > 16) if (drv->depth > 16)
drv->pixel_shift = 2; drv->pixel_shift = 2;
@ -282,6 +279,7 @@ Redraw(UGA_IO_PRIVATE *drv, UINTN X, UINTN Y, UINTN Width, UINTN Height)
else else
XPutImage (drv->display, drv->win, drv->gc, drv->image, XPutImage (drv->display, drv->win, drv->gc, drv->image,
X, Y, X, Y, Width, Height); X, Y, X, Y, Width, Height);
XFlush(drv->display);
} }
static void static void
@ -442,7 +440,7 @@ UgaBlt(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
switch (BltOperation) { switch (BltOperation) {
case EfiUgaVideoToBltBuffer: case EfiUgaVideoToBltBuffer:
Blt = BltBuffer; Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (DestinationY * Delta) + DestinationX * sizeof (EFI_UGA_PIXEL));
Delta -= Width * sizeof (EFI_UGA_PIXEL); Delta -= Width * sizeof (EFI_UGA_PIXEL);
for (SrcY = SourceY; SrcY < (Height + SourceY); SrcY++) { for (SrcY = SourceY; SrcY < (Height + SourceY); SrcY++) {
for (SrcX = SourceX; SrcX < (Width + SourceX); SrcX++) { for (SrcX = SourceX; SrcX < (Width + SourceX); SrcX++) {
@ -453,7 +451,7 @@ UgaBlt(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
} }
break; break;
case EfiUgaBltBufferToVideo: case EfiUgaBltBufferToVideo:
Blt = BltBuffer; Blt = (EFI_UGA_PIXEL *)((UINT8 *)BltBuffer + (SourceY * Delta) + SourceX * sizeof (EFI_UGA_PIXEL));
Delta -= Width * sizeof (EFI_UGA_PIXEL); Delta -= Width * sizeof (EFI_UGA_PIXEL);
for (DstY = DestinationY; DstY < (Height + DestinationY); DstY++) { for (DstY = DestinationY; DstY < (Height + DestinationY); DstY++) {
for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) { for (DstX = DestinationX; DstX < (Width + DestinationX); DstX++) {
@ -523,6 +521,7 @@ UgaBlt(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
XSetForeground(Private->display, Private->gc, Color); XSetForeground(Private->display, Private->gc, Color);
XFillRectangle(Private->display, Private->win, Private->gc, XFillRectangle(Private->display, Private->win, Private->gc,
DestinationX, DestinationY, Width, Height); DestinationX, DestinationY, Width, Height);
XFlush(Private->display);
break; break;
case EfiUgaBltBufferToVideo: case EfiUgaBltBufferToVideo:
Redraw(Private, DestinationX, DestinationY, Width, Height); Redraw(Private, DestinationX, DestinationY, Width, Height);
@ -568,8 +567,8 @@ UgaCreate (EFI_UNIX_UGA_IO_PROTOCOL **Uga, CONST CHAR16 *Title)
drv->win = XCreateSimpleWindow drv->win = XCreateSimpleWindow
(drv->display, RootWindow (drv->display, drv->screen), (drv->display, RootWindow (drv->display, drv->screen),
0, 0, 4, 4, border_width, 0, 0, 4, 4, border_width,
BlackPixel (drv->display, drv->screen), WhitePixel (drv->display, drv->screen),
WhitePixel (drv->display, drv->screen)); BlackPixel (drv->display, drv->screen));
drv->depth = DefaultDepth (drv->display, drv->screen); drv->depth = DefaultDepth (drv->display, drv->screen);

View File

@ -210,7 +210,7 @@ INF UnixPkg/UnixBusDriverDxe/UnixBusDriver.inf
INF UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf INF UnixPkg/UnixBlockIoDxe/UnixBlockIo.inf
INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
INF UnixPkg/UnixUgaDxe/UnixUga.inf INF UnixPkg/UnixUgaDxe/UnixUga.inf
INF UnixPkg/UnixConsoleDxe/UnixConsole.inf #INF UnixPkg/UnixConsoleDxe/UnixConsole.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf