/* $Id$ */
/** @file
*/
/*
* Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*
This code is based on:
This file produces the graphics abstraction of UGA Draw. It is called by
VBoxVga.c file which deals with the EFI 1.1 driver model.
This file just does graphics.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include "VBoxVga.h"
//
// UGA Draw Protocol Member Functions
//
)
{
if (Private->HardwareNeedsStarting) {
return EFI_NOT_STARTED;
}
if ((HorizontalResolution == NULL) ||
(VerticalResolution == NULL) ||
(ColorDepth == NULL) ||
(RefreshRate == NULL)) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
)
{
DEBUG((DEBUG_INFO, "%a:%d VIDEO: %dx%d %d bpp\n", __FILE__, __LINE__, HorizontalResolution, VerticalResolution, ColorDepth));
continue;
}
continue;
}
continue;
}
#if 0
continue;
}
#endif
if (Private->LineBuffer) {
}
return EFI_OUT_OF_RESOURCES;
}
Private->TmpBuf = AllocatePool(Private->ModeData[Index].HorizontalResolution * Private->ModeData[Index].VerticalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
/* update current mode */
return EFI_SUCCESS;
}
return EFI_NOT_FOUND;
}
)
{
UINTN X;
return EFI_INVALID_PARAMETER;
}
return EFI_INVALID_PARAMETER;
}
//
// If Delta is zero, then the entire BltBuffer is being used, so Delta
// is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
// the number of bytes in each row can be computed.
//
if (Delta == 0) {
}
Delta /= sizeof (EFI_UGA_PIXEL);
//
// We need to fill the Virtual Screen buffer with the blt data.
// The virtual screen is upside down, as the first row is the bootom row of
// the image.
//
//
// Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters
// are valid for the operation and the current screen geometry.
//
if (BltOperation == EfiUgaVideoToBltBuffer) {
//
// Video to BltBuffer: Source is Video, destination is BltBuffer
//
return EFI_INVALID_PARAMETER;
}
return EFI_INVALID_PARAMETER;
}
} else {
//
// BltBuffer to Video: Source is BltBuffer, destination is Video
//
return EFI_INVALID_PARAMETER;
}
return EFI_INVALID_PARAMETER;
}
}
//
// We have to raise to TPL Notify, so we make an atomic write the frame buffer.
// We would not want a timer based event (Cursor, ...) to come in while we are
// doing this operation.
//
switch (BltOperation) {
case EfiUgaVideoToBltBuffer:
//
// Video to BltBuffer: Source is Video, destination is BltBuffer
//
0,
Offset * 4,
);
for (X = 0; X < Width; X++) {
}
}
break;
case EfiUgaVideoToVideo:
//
// Perform hardware acceleration for Video to Video operations
//
SourceOffset = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX);
Offset = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX);
VBoxVgaUgaDrawBlt(This, (EFI_UGA_PIXEL *)Private->TmpBuf, EfiUgaVideoToBltBuffer, SourceX, SourceY, 0, 0, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);
VBoxVgaUgaDrawBlt(This, (EFI_UGA_PIXEL *)Private->TmpBuf, EfiUgaBltBufferToVideo, 0, 0, DestinationX, DestinationY, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);
break;
case EfiUgaVideoFill:
0,
Offset * 4,
);
} else {
0,
Offset * 4,
);
}
}
break;
case EfiUgaBltBufferToVideo:
for (X = 0; X < Width; X++) {
}
0,
Offset * 4,
);
}
break;
default:
break;
}
return EFI_SUCCESS;
}
//
// Construction and Destruction functions
//
)
{
//
// Fill in Private->UgaDraw protocol
//
//
// Initialize the private data
//
Private->CurrentMode = 0;
//
// Initialize the hardware
//
);
DrawLogo (
);
return EFI_SUCCESS;
}