1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicshwdrivers/surfacemgr/inc/surface_hints.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,210 @@
1.4 +// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Surface Manager API
1.18 +//
1.19 +
1.20 +#ifndef __SURFACE_HINTS_H__
1.21 +#define __SURFACE_HINTS_H__
1.22 +
1.23 +//- Include Files ----------------------------------------------------------
1.24 +
1.25 +#include <e32cmn.h>
1.26 +
1.27 +
1.28 +//- Namespace ---------------------------------------------------------------
1.29 +
1.30 +namespace surfaceHints
1.31 +{
1.32 +
1.33 +//- Constants ---------------------------------------------------------------
1.34 +
1.35 +/** Hint of the surface content.
1.36 + @see TSurfaceContent for possible values
1.37 +*/
1.38 +const TInt KSurfaceContent = 0x1;
1.39 +
1.40 +/** Hint of the expected update rate of the surface content.
1.41 + Value for a surface containing e.g. 25 fps video the value should be 25.
1.42 + For a static UI element the value should be 0.
1.43 + @see TSurfaceUpdate
1.44 +*/
1.45 +const TInt KSurfaceUpdate = 0x2;
1.46 +
1.47 +/** Hint whether the surface content is copy protected and can it be
1.48 + shown on external displays.
1.49 + @see TSurfaceProtection for possible values.
1.50 +*/
1.51 +const TInt KSurfaceProtection = 0x3;
1.52 +
1.53 +/** Hint about the surface’s characteristics or properties,
1.54 + For example if a surface can be persisted by the effects engine.
1.55 + @see TSurfaceCharacteristics for possible values.
1.56 +*/
1.57 +const TInt KSurfaceCharacteristics = 0x4;
1.58 +
1.59 +
1.60 +/** Values used for the KSurfaceContent key */
1.61 +enum TSurfaceContent
1.62 + {
1.63 + /** No specific use-case */
1.64 + EGeneric,
1.65 + /** Camera viewfinder frames */
1.66 + EViewFinder,
1.67 + /** Images captured by camera */
1.68 + EStillImage,
1.69 + /** Decoded video frames */
1.70 + EVideoPlayback,
1.71 + /** Video frames from video telephony */
1.72 + EVideoTelephony,
1.73 + /** EGL surface */
1.74 + EGfx,
1.75 + /** Main UI surface */
1.76 + EUi,
1.77 + /** Composition target surface */
1.78 + ECompositionTarget,
1.79 + /** Indicates that the surface has to accessible by ARM.
1.80 + This can be orr'ed with other TSurfaceContent enumerations. */
1.81 + EArmAccess = 0x80000000
1.82 + };
1.83 +
1.84 +
1.85 +/** Values used for the KSurfaceProtection key. The values are bitmasks and can be combined
1.86 +* e.g. EAllowAnalogProtectionRequired | EAllowDigitalProtectionRequired.
1.87 +*/
1.88 +enum TSurfaceProtection
1.89 + {
1.90 + /**
1.91 + * Not allowed on external outputs
1.92 + */
1.93 + EAllowInternalOnly = 0x00000000,
1.94 +
1.95 + /**
1.96 + * Allowed on all external outputs
1.97 + */
1.98 + EAllowAllExternals = 0xFFFFFFFF,
1.99 +
1.100 + /**
1.101 + * Allow passing content over analog outputs,
1.102 + * e.g. composite and S-video
1.103 + */
1.104 + EAllowAnalog = 0x00000010,
1.105 +
1.106 + /**
1.107 + * Allow output over an analog output channel which has a protection
1.108 + * mechanism
1.109 + */
1.110 + EAllowAnalogProtectionRequired = 0x00000020,
1.111 +
1.112 + /**
1.113 + * Allow passing content over digital outputs,
1.114 + * e.g. DVI and HDMI
1.115 + */
1.116 + EAllowDigital = 0x00000200,
1.117 +
1.118 + /**
1.119 + * Licensed product must attempt to engage HDCP to protect the content.
1.120 + * However it should be passed through to HDMI even if HDCP is not engaged or fails to engage.
1.121 + */
1.122 + EAllowDigitalProtectionRequested = 0x00000400,
1.123 +
1.124 + /**
1.125 + * Licensed product is required to engage HDCP to protect the content.
1.126 + * If HDCP is not engaged or can not be engaged the content must not be passed through to HDMI.
1.127 + */
1.128 + EAllowDigitalProtectionRequired = 0x00000800,
1.129 + };
1.130 +
1.131 +
1.132 +/** Values used for the KSurfaceCharacteristics key. The values are bitmasks and can be combined.
1.133 +*/
1.134 +enum TSurfaceCharacteristics
1.135 + {
1.136 + /**
1.137 + * Surface cannot be persisted once it has been closed by the creator
1.138 + */
1.139 + ENotPersistable = 1,
1.140 + };
1.141 +
1.142 +
1.143 +class TSurfaceUpdate
1.144 + {
1.145 + /** Constructor.
1.146 + @param aUpdateRate How often the surface content is redrawn per second.
1.147 + @param aTearingFree When ETrue surface updates should be synchronized
1.148 + with display refresh rate, otherwise surface can
1.149 + be updated as fast as possible.
1.150 + */
1.151 + inline TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree);
1.152 +
1.153 + /** Converts a value to TSurfaceUpdate */
1.154 + inline TSurfaceUpdate(TInt aValue);
1.155 +
1.156 + /** Converts TSurfaceUpdate to a signed integer, so it can be used as
1.157 + a value for KSurfaceUpdate key. */
1.158 + inline operator TInt() const;
1.159 +
1.160 + /** Getter for surface update rate.
1.161 + @return updates per second
1.162 + */
1.163 + inline TUint UpdateRate() const;
1.164 +
1.165 + /** Getter for surface update synchronization.
1.166 + @return ETrue - updates should be synchronized with display refresh rate,
1.167 + EFalse - surface can be updated as fast as possible.
1.168 + */
1.169 + inline TBool TearingFree() const;
1.170 +
1.171 + private:
1.172 + TUint iValue;
1.173 + };
1.174 +
1.175 +
1.176 +//- Forward Declarations ----------------------------------------------------
1.177 +
1.178 +
1.179 +//- Class Definitions -------------------------------------------------------
1.180 +
1.181 +
1.182 +//- Inline Functions --------------------------------------------------------
1.183 +
1.184 +TSurfaceUpdate::TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree)
1.185 + : iValue( ( aUpdateRate & 0xFFFF ) | ( aTearingFree ? 0x80000000 : 0x0 ) )
1.186 + {
1.187 + }
1.188 +TSurfaceUpdate::TSurfaceUpdate(TInt aValue)
1.189 + : iValue( static_cast<TUint>( aValue ) )
1.190 + {
1.191 + }
1.192 +
1.193 +TSurfaceUpdate::operator TInt() const
1.194 + {
1.195 + return static_cast<TInt>( iValue );
1.196 + }
1.197 +
1.198 +TUint TSurfaceUpdate::UpdateRate() const
1.199 + {
1.200 + return ( iValue & 0xFFFF );
1.201 + }
1.202 +
1.203 +TBool TSurfaceUpdate::TearingFree() const
1.204 + {
1.205 + return ( iValue & 0x80000000 ) ? ETrue : EFalse;
1.206 + }
1.207 +
1.208 +} //namespace surfaceHints
1.209 +
1.210 +#endif //__SURFACE_HINTS_H__
1.211 +
1.212 +// End of File
1.213 +