/* $Id$ */
/** @file
*/
/*
* Copyright (C) 2009-2012 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:
Copyright (c) 2007, 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.
Module Name:
Abstract:
This file produces the graphics abstraction of Graphics Output Protocol. It is called by
VBoxVga.c file which deals with the EFI 1.1 driver model.
This file just does graphics.
*/
#include "VBoxVga.h"
#include <IndustryStandard/Acpi.h>
)
{
}
)
{
0,
NULL,
(VOID**) &FrameBufDesc
);
* sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL); /* 32bpp only! */
return EFI_SUCCESS;
}
//
// Graphics Output Protocol Member Functions
//
)
/*++
Routine Description:
Graphics Output protocol interface to query video mode
Arguments:
This - Protocol instance pointer.
ModeNumber - The mode number to return information on.
Info - Caller allocated buffer that returns information about ModeNumber.
SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.
Returns:
EFI_SUCCESS - Mode information returned.
EFI_BUFFER_TOO_SMALL - The Info buffer was too small.
EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.
EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
EFI_INVALID_PARAMETER - One of the input args was NULL.
--*/
{
if (Private->HardwareNeedsStarting) {
return EFI_NOT_STARTED;
}
return EFI_INVALID_PARAMETER;
}
return EFI_OUT_OF_RESOURCES;
}
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Graphics Output protocol interface to set video mode
Arguments:
This - Protocol instance pointer.
ModeNumber - The mode number to be set.
Returns:
EFI_SUCCESS - Graphics mode was changed.
EFI_DEVICE_ERROR - The device had an error and could not complete the request.
EFI_UNSUPPORTED - ModeNumber is not supported by this device.
--*/
{
return EFI_UNSUPPORTED;
}
if (Private->LineBuffer) {
}
Private->LineBuffer = AllocatePool (ModeData->HorizontalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
return EFI_OUT_OF_RESOURCES;
}
Private->TmpBuf = AllocatePool(ModeData->HorizontalResolution * ModeData->VerticalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
/* update current mode */
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Graphics Output protocol instance to block transfer for CirrusLogic device
Arguments:
This - Pointer to Graphics Output protocol instance
BltBuffer - The data to transfer to screen
BltOperation - The operation to perform
SourceX - The X coordinate of the source for BltOperation
SourceY - The Y coordinate of the source for BltOperation
DestinationX - The X coordinate of the destination for BltOperation
DestinationY - The Y coordinate of the destination for BltOperation
Width - The width of a rectangle in the blt rectangle in pixels
Height - The height of a rectangle in the blt rectangle in pixels
Delta - Not used for EfiBltVideoFill and EfiBltVideoToVideo operation.
If a Delta of 0 is used, the entire BltBuffer will be operated on.
If a subrectangle of the BltBuffer is used, then Delta represents
the number of bytes in a row of the BltBuffer.
Returns:
EFI_INVALID_PARAMETER - Invalid parameter passed in
EFI_SUCCESS - Blt operation success
--*/
{
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.
//
/* vvl: Delta passed in bytes to use it for coordinate arithmetic
we need convert it to pixels value.
*/
if (Delta == 0) {
}
Delta /= 4;
//
// 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 == EfiBltVideoToBltBuffer) {
//
// 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 EfiBltVideoToBltBuffer:
//
// Video to BltBuffer: Source is Video, destination is BltBuffer
//
for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY) && BltBuffer; SrcY++, DstY++) {
0,
Offset * 4,
);
for (X = 0; X < Width; X++) {
}
}
break;
case EfiBltVideoToVideo:
//
// Perform hardware acceleration for Video to Video operations
//
VBoxVgaGraphicsOutputBlt(This, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)Private->TmpBuf, EfiBltVideoToBltBuffer, SourceX, SourceY, 0, 0, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);
VBoxVgaGraphicsOutputBlt(This, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)Private->TmpBuf, EfiBltBufferToVideo, 0, 0, DestinationX, DestinationY, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);
break;
case EfiBltVideoFill:
0,
Offset * 4,
);
} else {
0,
Offset * 4,
);
}
}
break;
case EfiBltBufferToVideo:
for (X = 0; X < Width; X++) {
Blt =
((SourceX + X) )
);
}
0,
Offset * 4,
);
}
break;
default:
}
return EFI_SUCCESS;
}
)
{
//
// Initialize the private data
//
sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE),
);
return Status;
}
sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
);
return Status;
}
//
// Initialize the hardware
//
DrawLogo (
);
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Arguments:
Returns:
None
--*/
{
}
}
return EFI_SUCCESS;
}