graphicshwdrivers/surfacemgr/inc/surface_hints.h
branchbug235_bringup_0
changeset 147 af143508cc47
parent 146 4d1fe4a7ce83
child 148 706129140cfc
equal deleted inserted replaced
146:4d1fe4a7ce83 147:af143508cc47
     1 // Copyright (c) 2007-2009 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 
       
    51 /** Values used for the KSurfaceContent key */
       
    52 enum TSurfaceContent
       
    53     {
       
    54     /** No specific use-case */
       
    55     EGeneric,
       
    56     /** Camera viewfinder frames */
       
    57     EViewFinder,
       
    58     /** Images captured by camera */
       
    59     EStillImage,
       
    60     /** Decoded video frames */
       
    61     EVideoPlayback,
       
    62     /** Video frames from video telephony */
       
    63     EVideoTelephony,
       
    64     /** EGL surface */
       
    65     EGfx,
       
    66     /** Main UI surface */
       
    67     EUi,
       
    68     /** Composition target surface */
       
    69     ECompositionTarget,
       
    70     /** Indicates that the surface has to accessible by ARM.
       
    71         This can be orr'ed with other TSurfaceContent enumerations. */
       
    72     EArmAccess = 0x80000000
       
    73     };
       
    74 
       
    75 
       
    76 /** Values used for the KSurfaceProtection key. The values are bitmasks and can be combined
       
    77 * e.g. EAllowAnalogProtectionRequired | EAllowDigitalProtectionRequired.
       
    78 */
       
    79 enum TSurfaceProtection
       
    80     {
       
    81     /**
       
    82     * Not allowed on external outputs
       
    83     */
       
    84     EAllowInternalOnly                  = 0x00000000,
       
    85 
       
    86     /**
       
    87     * Allowed on all external outputs
       
    88     */
       
    89     EAllowAllExternals                  = 0xFFFFFFFF,
       
    90 
       
    91     /**
       
    92     * Allow passing content over analog outputs,
       
    93     * e.g. composite and S-video
       
    94     */
       
    95     EAllowAnalog                        = 0x00000010,
       
    96 
       
    97     /**
       
    98     * Allow output over an analog output channel which has a protection
       
    99     * mechanism
       
   100     */
       
   101     EAllowAnalogProtectionRequired      = 0x00000020,
       
   102 
       
   103     /**
       
   104     * Allow passing content over digital outputs,
       
   105     * e.g. DVI and HDMI
       
   106     */
       
   107     EAllowDigital                       = 0x00000200,
       
   108 
       
   109     /**
       
   110     * Licensed product must attempt to engage HDCP to protect the content.
       
   111     * However it should be passed through to HDMI even if HDCP is not engaged or fails to engage.
       
   112     */
       
   113     EAllowDigitalProtectionRequested    = 0x00000400,
       
   114 
       
   115     /**
       
   116     * Licensed product is required to engage HDCP to protect the content.
       
   117     * If HDCP is not engaged or can not be engaged the content must not be passed through to HDMI.
       
   118     */
       
   119     EAllowDigitalProtectionRequired     = 0x00000800,
       
   120     };
       
   121 
       
   122 
       
   123 class TSurfaceUpdate
       
   124     {
       
   125     /** Constructor.
       
   126         @param aUpdateRate   How often the surface content is redrawn per second.
       
   127         @param aTearingFree  When ETrue surface updates should be synchronized
       
   128                              with display refresh rate, otherwise surface can
       
   129                              be updated as fast as possible.
       
   130     */
       
   131     inline TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree);
       
   132 
       
   133     /** Converts a value to TSurfaceUpdate */
       
   134     inline TSurfaceUpdate(TInt aValue);
       
   135 
       
   136     /** Converts TSurfaceUpdate to a signed integer, so it can be used as
       
   137         a value for KSurfaceUpdate key. */
       
   138     inline operator TInt() const;
       
   139 
       
   140     /** Getter for surface update rate.
       
   141         @return updates per second
       
   142     */
       
   143     inline TUint UpdateRate() const;
       
   144 
       
   145     /** Getter for surface update synchronization.
       
   146         @return ETrue - updates should be synchronized with display refresh rate,
       
   147                 EFalse - surface can be updated as fast as possible.
       
   148     */
       
   149     inline TBool TearingFree() const;
       
   150 
       
   151     private:
       
   152         TUint iValue;
       
   153     };
       
   154 
       
   155 
       
   156 //- Forward Declarations ----------------------------------------------------
       
   157 
       
   158 
       
   159 //- Class Definitions -------------------------------------------------------
       
   160 
       
   161 
       
   162 //- Inline Functions --------------------------------------------------------
       
   163 
       
   164 TSurfaceUpdate::TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree)
       
   165     : iValue( ( aUpdateRate & 0xFFFF ) | ( aTearingFree ? 0x80000000 : 0x0 ) )
       
   166     {
       
   167     }
       
   168 TSurfaceUpdate::TSurfaceUpdate(TInt aValue)
       
   169     : iValue( static_cast<TUint>( aValue ) )
       
   170     {
       
   171     }
       
   172 
       
   173 TSurfaceUpdate::operator TInt() const
       
   174     {
       
   175     return static_cast<TInt>( iValue );
       
   176     }
       
   177 
       
   178 TUint TSurfaceUpdate::UpdateRate() const
       
   179     {
       
   180     return ( iValue & 0xFFFF );
       
   181     }
       
   182 
       
   183 TBool TSurfaceUpdate::TearingFree() const
       
   184     {
       
   185     return ( iValue & 0x80000000 ) ? ETrue : EFalse;
       
   186     }
       
   187 
       
   188 }; //namespace surfaceHints
       
   189 
       
   190 #endif //__SURFACE_HINTS_H__
       
   191 
       
   192 // End of File
       
   193