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