os/graphics/graphicshwdrivers/surfacemgr/inc/surface_hints.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Surface Manager API
    15 //
    16 
    17 #ifndef __SURFACE_HINTS_H__
    18 #define __SURFACE_HINTS_H__
    19 
    20 //- Include Files  ----------------------------------------------------------
    21 
    22 #include <e32cmn.h>
    23 
    24 
    25 //- Namespace ---------------------------------------------------------------
    26 
    27 namespace surfaceHints
    28 {
    29 
    30 //- Constants ---------------------------------------------------------------
    31 
    32 /** Hint of the surface content.
    33     @see TSurfaceContent for possible values
    34 */
    35 const TInt KSurfaceContent = 0x1;
    36 
    37 /** Hint of the expected update rate of the surface content.
    38     Value for a surface containing e.g. 25 fps video the value should be 25.
    39     For a static UI element the value should be 0.
    40     @see TSurfaceUpdate
    41 */
    42 const TInt KSurfaceUpdate = 0x2;
    43 
    44 /** Hint whether the surface content is copy protected and can it be
    45     shown on external displays.
    46     @see TSurfaceProtection for possible values.
    47 */
    48 const TInt KSurfaceProtection = 0x3;
    49 
    50 /** Hint about the surface’s characteristics or properties,
    51    For example if a surface can be persisted by the effects engine.
    52    @see TSurfaceCharacteristics for possible values.
    53 */
    54 const TInt KSurfaceCharacteristics = 0x4;
    55 
    56 
    57 /** Values used for the KSurfaceContent key */
    58 enum TSurfaceContent
    59     {
    60     /** No specific use-case */
    61     EGeneric,
    62     /** Camera viewfinder frames */
    63     EViewFinder,
    64     /** Images captured by camera */
    65     EStillImage,
    66     /** Decoded video frames */
    67     EVideoPlayback,
    68     /** Video frames from video telephony */
    69     EVideoTelephony,
    70     /** EGL surface */
    71     EGfx,
    72     /** Main UI surface */
    73     EUi,
    74     /** Composition target surface */
    75     ECompositionTarget,
    76     /** Indicates that the surface has to accessible by ARM.
    77         This can be orr'ed with other TSurfaceContent enumerations. */
    78     EArmAccess = 0x80000000
    79     };
    80 
    81 
    82 /** Values used for the KSurfaceProtection key. The values are bitmasks and can be combined
    83 * e.g. EAllowAnalogProtectionRequired | EAllowDigitalProtectionRequired.
    84 */
    85 enum TSurfaceProtection
    86     {
    87     /**
    88     * Not allowed on external outputs
    89     */
    90     EAllowInternalOnly                  = 0x00000000,
    91 
    92     /**
    93     * Allowed on all external outputs
    94     */
    95     EAllowAllExternals                  = 0xFFFFFFFF,
    96 
    97     /**
    98     * Allow passing content over analog outputs,
    99     * e.g. composite and S-video
   100     */
   101     EAllowAnalog                        = 0x00000010,
   102 
   103     /**
   104     * Allow output over an analog output channel which has a protection
   105     * mechanism
   106     */
   107     EAllowAnalogProtectionRequired      = 0x00000020,
   108 
   109     /**
   110     * Allow passing content over digital outputs,
   111     * e.g. DVI and HDMI
   112     */
   113     EAllowDigital                       = 0x00000200,
   114 
   115     /**
   116     * Licensed product must attempt to engage HDCP to protect the content.
   117     * However it should be passed through to HDMI even if HDCP is not engaged or fails to engage.
   118     */
   119     EAllowDigitalProtectionRequested    = 0x00000400,
   120 
   121     /**
   122     * Licensed product is required to engage HDCP to protect the content.
   123     * If HDCP is not engaged or can not be engaged the content must not be passed through to HDMI.
   124     */
   125     EAllowDigitalProtectionRequired     = 0x00000800,
   126     };
   127 
   128 
   129 /** Values used for the KSurfaceCharacteristics key. The values are bitmasks and can be combined.
   130 */
   131 enum TSurfaceCharacteristics
   132     {
   133     /**
   134     * Surface cannot be persisted once it has been closed by the creator
   135     */
   136     ENotPersistable = 1,
   137     };
   138 
   139 
   140 class TSurfaceUpdate
   141     {
   142     /** Constructor.
   143         @param aUpdateRate   How often the surface content is redrawn per second.
   144         @param aTearingFree  When ETrue surface updates should be synchronized
   145                              with display refresh rate, otherwise surface can
   146                              be updated as fast as possible.
   147     */
   148     inline TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree);
   149 
   150     /** Converts a value to TSurfaceUpdate */
   151     inline TSurfaceUpdate(TInt aValue);
   152 
   153     /** Converts TSurfaceUpdate to a signed integer, so it can be used as
   154         a value for KSurfaceUpdate key. */
   155     inline operator TInt() const;
   156 
   157     /** Getter for surface update rate.
   158         @return updates per second
   159     */
   160     inline TUint UpdateRate() const;
   161 
   162     /** Getter for surface update synchronization.
   163         @return ETrue - updates should be synchronized with display refresh rate,
   164                 EFalse - surface can be updated as fast as possible.
   165     */
   166     inline TBool TearingFree() const;
   167 
   168     private:
   169         TUint iValue;
   170     };
   171 
   172 
   173 //- Forward Declarations ----------------------------------------------------
   174 
   175 
   176 //- Class Definitions -------------------------------------------------------
   177 
   178 
   179 //- Inline Functions --------------------------------------------------------
   180 
   181 TSurfaceUpdate::TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree)
   182     : iValue( ( aUpdateRate & 0xFFFF ) | ( aTearingFree ? 0x80000000 : 0x0 ) )
   183     {
   184     }
   185 TSurfaceUpdate::TSurfaceUpdate(TInt aValue)
   186     : iValue( static_cast<TUint>( aValue ) )
   187     {
   188     }
   189 
   190 TSurfaceUpdate::operator TInt() const
   191     {
   192     return static_cast<TInt>( iValue );
   193     }
   194 
   195 TUint TSurfaceUpdate::UpdateRate() const
   196     {
   197     return ( iValue & 0xFFFF );
   198     }
   199 
   200 TBool TSurfaceUpdate::TearingFree() const
   201     {
   202     return ( iValue & 0x80000000 ) ? ETrue : EFalse;
   203     }
   204 
   205 } //namespace surfaceHints
   206 
   207 #endif //__SURFACE_HINTS_H__
   208 
   209 // End of File
   210