📄 dp_api_query_functions.c
字号:
/*********************************************************************************
*********************************************************************************
**
** Name : dp_api_query_functions.c
** Title : Display pipeline query function module
** Author : T. Whalley
** Created : June 2001
**
** Copyright : 2001 by Imagination Technologies Limited. All rights reserved
** : No part of this software, either material or conceptual
** : may be copied or distributed, transmitted, transcribed,
** : stored in a retrieval system or translated into any
** : human or computer language in any form by any means,
** : electronic, mechanical, manual or other-wise, or
** : disclosed to third parties without the express written
** : permission of Imagination Technologies Limited, Unit 8,
** : HomePark Industrial Estate, King's Langley, Hertfordshire,
** : WD4 8LZ, U.K.
**
** Description :
**
** Platform : Platform independent (modify 'types.h' accordingly)
** $Log: dp_api_query_functions.c $
**
** --- Revision Logs Removed ---
**
*********************************************************************************
*********************************************************************************/
#include "dp_types.h"
#include "dp_init_marathon.h"
#include "dp_hardware.h"
#include "dp_hardware_dispatcher.h"
#if defined DP_SIMULATION_MODE
#include <windows.h>
#include <stdio.h>
#endif
/***********************************************************************************************
*
* Function Name : DP_GetPixelColourFormat
* Inputs : ui16PlaneHandle - The handle by which the plane to be used is
* identified.
*
* pePixelFormat - A pointer to an instance of the
* 'DP_PixelColourFormats' enumerated type, which the
* function will set to the current pixel colour format
* for the specified plane.
*
* pbCositedChromaSamples- A pointer to a 'DP_BOOL' which the function will
* set, if a YUV colour format is being used to
* interpret the plane's input data.
* Following successful completion of the function, if
* 'pePixelFormat' indicates that a YUV format is being
* used then the 'pbOffsetChromaSamples' is interpreted
* as follows :
* If set to 'DP_TRUE', the plane is interpreting
* input data as having cosited chroma samples.
* If set to 'DP_FALSE', the plane is interpreting
* input data as having offset chroma samples.
*
* Outputs : pePixelFormat - See above.
*
* pbCositedChromaSamples- See above.
*
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
* on error types.
*
* Description : This function is used to establish what format the specified plane is
* expecting to receive as input data.
*
***********************************************************************************************/
DP_UINT_16 DP_GetPixelColourFormat ( DP_UINT_16 ui16PlaneHandle,
DP_PixelColourFormats * pePixelFormat,
DP_PBOOL pbCositedChromaSamples )
{
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16ReturnValue = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16ReturnValue = DP_ERR_NO_ERROR_CHECKING;
#endif
DP_UINT_32 ui32FieldAsRead;
DP_UINT_16 ui16i;
#if defined DP_SIMULATION_MODE
printf ("\n DP_GetPixelColourFormat \n");
#endif
#if defined DP_ERROR_CHECKING
if ( !DP_bIsPipelineInitialised )
ui16ReturnValue = DP_ERR_NOT_INITIALISED;
else if ( ui16PlaneHandle > DP_NO_OF_STREAMS )
ui16ReturnValue = DP_ERR_UNKNOWN_PLANE;
/* else if.... (other tests here) */
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Read the field value */
ui32FieldAsRead = DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][ DP_STREAM_SPECIFIC_FIELD_PIXEL_COLOUR_FORMAT ],
&ui16ReturnValue );
#if defined DP_ERROR_CHECKING
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Find out if the field value corresponds to any of the enumerated types */
for ( ui16i = 0; ui16i < DP_PIXEL_COLOUR_FORMAT_NUMBER_OF_MODES; ui16i++ )
{
if ( ui32FieldAsRead == DP_aui8ColourFormatModeVals [ ui16i ] )
break;
}
if ( ui16i != DP_PIXEL_COLOUR_FORMAT_NUMBER_OF_MODES )
{
*pePixelFormat = (DP_PixelColourFormats) ui16i;
}
#if defined DP_ERROR_CHECKING
else
{
ui16ReturnValue = DP_ERR_UNKNOWN_MODE;
}
}
#endif
ui32FieldAsRead = DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][ DP_STREAM_SPECIFIC_FIELD_COSITED_LUMA_SAMPLES ],
DP_NULL );
*pbCositedChromaSamples = (DP_BOOL) (ui32FieldAsRead & 0x01);
#if defined DP_ERROR_CHECKING
}
#endif
return ui16ReturnValue;
}
/***********************************************************************************************
*
* Function Name : DP_GetDestinationFramePosition
* Inputs : ui16PlaneHandle - The handle by which the plane to be used is
* identified.
*
* pi32FrameXPos - A pointer to a 'DP_UINT_16', which the function will
* fill with the cuurent horizontal offset of the
* specified plane's destination frame, in pixels, from
* the left hand edge of the main (output) frame.
*
* pi32FrameYPos - A pointer to a 'DP_UINT_16', which the function will
* fill with the cuurent vertical offset of the
* specified plane's destination frame, in pixels, from
* the top of the main (output) frame.
*
* Outputs : pi32FrameXPos - See above.
*
* pi32FrameYPos - See above.
*
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
* on error types.
*
* Description : This function is used to establish the current position of the specified
* plane's destination frame, relative to the main (output) frame.
*
***********************************************************************************************/
DP_UINT_16 DP_GetDestinationFramePosition( DP_UINT_16 ui16PlaneHandle,
DP_PINT_32 pi32FrameXPos,
DP_PINT_32 pi32FrameYPos )
{
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16ReturnValue = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16ReturnValue = DP_ERR_NO_ERROR_CHECKING;
#endif
DP_UINT_32 ui32XAsRead, ui32YAsRead;
#if defined DP_SIMULATION_MODE
printf ("\n DP_GetDestinationFramePosition \n");
#endif
#if defined DP_ERROR_CHECKING
if ( !DP_bIsPipelineInitialised )
ui16ReturnValue = DP_ERR_NOT_INITIALISED;
else if ( ui16PlaneHandle > DP_NO_OF_STREAMS )
ui16ReturnValue = DP_ERR_UNKNOWN_PLANE;
/* else if.... (other tests here) */
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Establish the current X position of the frame */
ui32XAsRead = DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_DESTINATION_FRAME_XPOS],
&ui16ReturnValue );
#if defined DP_ERROR_CHECKING
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Establish the current Y position of the frame */
ui32YAsRead = DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_DESTINATION_FRAME_YPOS],
&ui16ReturnValue );
#if defined DP_ERROR_CHECKING
}
}
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* If the main (output) frame is interlaced, double the Y co-ordinate before returning it */
if ( DP_bIsDisplayInterlaced )
ui32YAsRead = ui32YAsRead * 2;
*pi32FrameXPos = ui32XAsRead;
*pi32FrameYPos = ui32YAsRead;
#if defined DP_ERROR_CHECKING
}
#endif
return ui16ReturnValue;
}
/***********************************************************************************************
*
* Function Name : DP_GetSourceFrameSize
* Inputs : ui16PlaneHandle - The handle by which the plane to be used is
* identified.
*
* pui16FrameWidth - A pointer to a 'DP_UINT_16' which the function will
* fill with the current width, in pixels, of the
* specified plane's source frame.
*
* pui16FrameHeight - A pointer to a 'DP_UINT_16' which the function will
* fill with the current height, in pixels, of the
* specified plane's source frame.
*
* Outputs : pui16FrameWidth - See above.
*
* pui16FrameHeight - See above.
*
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
* on error types.
*
* Description : This function is used to establish the current size of the specified plane's
* source frame.
*
***********************************************************************************************/
DP_UINT_16 DP_GetSourceFrameSize ( DP_UINT_16 ui16PlaneHandle,
DP_PUINT_16 pui16FrameWidth,
DP_PUINT_16 pui16FrameHeight )
{
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16ReturnValue = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16ReturnValue = DP_ERR_NO_ERROR_CHECKING;
#endif
DP_UINT_16 ui16WidthAsRead, ui16HeightAsRead;
DP_PVOID pvSourceAddress;
DP_UINT_16 ui16Stride;
DP_BOOL bUVStrideHalved;
DP_SourceDataTypes eSourceDataType;
DP_UINT_16 ui16FetchOK;
#if defined DP_SIMULATION_MODE
printf ("\n DP_GetSourceFrameSize \n");
#endif
#if defined DP_ERROR_CHECKING
if ( !DP_bIsPipelineInitialised )
ui16ReturnValue = DP_ERR_NOT_INITIALISED;
else if ( ui16PlaneHandle > DP_NO_OF_STREAMS )
ui16ReturnValue = DP_ERR_UNKNOWN_PLANE;
/* else if.... (other tests here) */
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Establish the current width of the plane */
ui16WidthAsRead = (DP_UINT_16) DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_FRAME_WIDTH],
&ui16ReturnValue );
#if defined DP_ERROR_CHECKING
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* Establish the current height of the plane */
ui16HeightAsRead = (DP_UINT_16) DP_GetField ( (DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_FRAME_HEIGHT],
&ui16ReturnValue );
#if defined DP_ERROR_CHECKING
}
}
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR)
{
#endif
/* The width and height of cursors are stored divided by 8 */
if ( DP_asStreamCapabilities [ ui16PlaneHandle ].bIsCursor )
{
ui16WidthAsRead = ui16WidthAsRead * 8;
ui16HeightAsRead = ui16HeightAsRead * 8;
}
*pui16FrameWidth = ui16WidthAsRead + DP_HARDWARE_SURFACE_WIDTH_COMPENSATE;
*pui16FrameHeight = ui16HeightAsRead + DP_HARDWARE_SURFACE_HEIGHT_COMPENSATE;
ui16FetchOK = DP_GetSourceAddress ( ui16PlaneHandle,
DP_YUV_Y_OR_SOLE_RGB,
&pvSourceAddress,
&ui16Stride,
&bUVStrideHalved,
&eSourceDataType );
if (( ui16FetchOK == DP_STANDARD_CODE_NO_ERROR ) &&
(( eSourceDataType == DP_SOURCE_DATA_TYPE_PROGRESSIVE ) ||
( eSourceDataType == DP_SOURCE_DATA_TYPE_INTERLACED_FIELDS )) )
{
/* Multiply the returned height by whatever it was divided by when writing it to hardware */
/* (change it into 'real' units) */
*pui16FrameHeight = (*pui16FrameHeight) * (DP_pCurrentScalerModifier [ ui16PlaneHandle ]->ui8SourceHeightDivisor);
}
#if defined DP_ERROR_CHECKING
}
#endif
return ui16ReturnValue;
}
/***********************************************************************************************
*
* Function Name : DP_GetGraphicsWrapping
* Inputs : ui16PlaneHandle - The handle (a sixteen bit number) by which the plane
* to be used is identified.
*
* pbWrappingEnabled - A pointer to a flag which the function will use to
* indicate whether the specified plane is currently
* using source graphics wrapping. Following successful
* operation of the function, if the flag is set to
* 'DP_TRUE', then source graphics wrapping is
* currently being used. if the flag is set to
* 'DP_FALSE', then source graphics wrapping is not
* currently being used.
*
* Outputs : pbWrappingEnabled - See above.
*
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -