os/graphics/graphicscomposition/surfaceupdate/inc/contentreadyforcomposition.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) 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
// Interface to find out when a particular content update 
sl@0
    15
// for a given surface has been delivered to the compositor
sl@0
    16
// and will be used in future compositions involving that 
sl@0
    17
// surface.
sl@0
    18
// 
sl@0
    19
//
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file
sl@0
    23
 @publishedPartner
sl@0
    24
 @released
sl@0
    25
*/
sl@0
    26
sl@0
    27
#ifndef __CONTENTREADYFORCOMPOSITION_H__
sl@0
    28
#define __CONTENTREADYFORCOMPOSITION_H__
sl@0
    29
sl@0
    30
sl@0
    31
#include <e32std.h>
sl@0
    32
#include <graphics/surface.h>
sl@0
    33
sl@0
    34
sl@0
    35
/**
sl@0
    36
MContentReadyForComposition is an interface to find out when a 
sl@0
    37
particular content update for a given surface has been delivered to
sl@0
    38
the compositor and will be used in future compositions involving that 
sl@0
    39
surface.
sl@0
    40
sl@0
    41
Each compositor in the system maintains its own content update count 
sl@0
    42
for each registered surface that determines when content ready 
sl@0
    43
notifications will be completed. Therefore the content update count is
sl@0
    44
considered per-surface-per-screen. The content update count is 
sl@0
    45
internally incremented by the compositor every time it receives a 
sl@0
    46
valid content update for a registered surface. Frames may be skipped 
sl@0
    47
if the client submits content updates too fast, meaning that not every
sl@0
    48
update is displayed on screen. The first valid content update sets the
sl@0
    49
content update count to one. Updates sent before the surface is 
sl@0
    50
registered do not affect the content update count. Content ready 
sl@0
    51
notifications for aContentUpdate = 1 will only be successfully 
sl@0
    52
completed after at least one content update has been received.
sl@0
    53
*/
sl@0
    54
class MContentReadyForComposition
sl@0
    55
    {
sl@0
    56
public:
sl@0
    57
    enum
sl@0
    58
        {
sl@0
    59
        KUidContentReadyForComposition = 0x2002E6D5,
sl@0
    60
        ETypeId = KUidContentReadyForComposition
sl@0
    61
        };
sl@0
    62
public:
sl@0
    63
sl@0
    64
    /**
sl@0
    65
    Requests a notification when a particular content update for a 
sl@0
    66
    given surface has been delivered to the compositor. Further, 
sl@0
    67
    notification implies that this newest content will be used in 
sl@0
    68
    future compositions until such time that newer content is 
sl@0
    69
    available.
sl@0
    70
sl@0
    71
    @param  aSurface        Id of the surface for which the
sl@0
    72
                            notification is required.
sl@0
    73
    @param  aNotifyReady    Request status that is signaled on the 
sl@0
    74
                            calling thread.
sl@0
    75
    @param  aContentUpdate  Content update number for which 
sl@0
    76
                            notification is required.
sl@0
    77
sl@0
    78
    @note   aContentUpdate is one-based. Content update one 
sl@0
    79
            corresponds to the first content submitted to the 
sl@0
    80
            compositor for a given surface.
sl@0
    81
sl@0
    82
    @note   If aContentUpdate is less than or equal to the current 
sl@0
    83
            content that the compositor uses for aSurface during 
sl@0
    84
            composition, aNotifyReady is completed with KErrNone 
sl@0
    85
            without delay. Else aNotifyReady is completed with 
sl@0
    86
            KErrNone when the compositor has received content update
sl@0
    87
            number aContentUpdate for the surface.
sl@0
    88
sl@0
    89
    @note   aNotifyReady is set to KRequestPending during the call
sl@0
    90
            to NotifyContentReady() and remains set to this value 
sl@0
    91
            until the request is completed with the appropriate 
sl@0
    92
            return code. The client must wait for this asynchronous 
sl@0
    93
            completion before attempting to read the return value.
sl@0
    94
sl@0
    95
    @note   If the registration count for aSurface becomes zero and 
sl@0
    96
            the surface is no longer in use in either the committed 
sl@0
    97
            or uncommitted scene while a notification request is 
sl@0
    98
            outstanding, the notification is completed with KErrAbort,
sl@0
    99
            without delay soon after the surface is unregistered.
sl@0
   100
sl@0
   101
    @note   Due to the 64-bit precision of aContentUpdate, the 
sl@0
   102
            probability of wrap around is considered slim and 
sl@0
   103
            therefore ignored. If wrap around does occur, behaviour of
sl@0
   104
            the API is undefined.
sl@0
   105
sl@0
   106
    @pre    aSurface is registered.
sl@0
   107
    @pre    aContentUpdate >= 1.
sl@0
   108
    @pre    There is no outstanding notification request for aSurface. 
sl@0
   109
sl@0
   110
    @error  If aSurface is not registered, aNotifyReady is completed
sl@0
   111
            with KErrArgument without delay.
sl@0
   112
    @error  If aContentUpdate == 0, aNotifyReady is completed with 
sl@0
   113
            KErrArgument without delay.
sl@0
   114
    @error  If there is an outstanding notification request for 
sl@0
   115
            aSurface, aNotifyReady is completed with KErrInUse without
sl@0
   116
            delay.
sl@0
   117
sl@0
   118
    @post   aNotifyReady will be signaled on the calling thread
sl@0
   119
            according to the above criteria.
sl@0
   120
    */
sl@0
   121
    virtual void NotifyContentReady(const TSurfaceId& aSurface, TUint64 aContentUpdate, TRequestStatus& aNotifyReady) = 0;
sl@0
   122
sl@0
   123
    /**
sl@0
   124
    Cancels a notification request made previously with 
sl@0
   125
    MContentReadyForComposition::NotifyContentReady() for a specific
sl@0
   126
    surface.
sl@0
   127
sl@0
   128
    @see    MContentReadyForComposition::NotifyContentReady().
sl@0
   129
sl@0
   130
    @param  aSurface        Id of the surface for which the 
sl@0
   131
                            notification request will be cancelled.
sl@0
   132
sl@0
   133
    @pre    aSurface is registered. 
sl@0
   134
    
sl@0
   135
    @error  If aSurface is not registered, this function is a noop.
sl@0
   136
sl@0
   137
    @post   If there is an outstanding notification request for 
sl@0
   138
            aSurface at the time of the call, it is completed with 
sl@0
   139
            KErrCancel without delay on the thread that originally 
sl@0
   140
            called NotifyContentReady() to make the request. If there
sl@0
   141
            is no outstanding notification request, this function is 
sl@0
   142
            a noop.
sl@0
   143
sl@0
   144
    @note   Completion of an outstanding request with KErrCancel
sl@0
   145
            must not rely on the calling thread entering the active 
sl@0
   146
            scheduler after the call to NotifyContentReadyCancel(). 
sl@0
   147
            It is valid for the client to call User::
sl@0
   148
            WaitForRequest(aNotifyRequest), where aNotifyRequest is 
sl@0
   149
            the outstanding request, immediately after calling 
sl@0
   150
            NotifyContentReadyCancel().
sl@0
   151
    */
sl@0
   152
    virtual void NotifyContentReadyCancel(const TSurfaceId& aSurface) = 0;
sl@0
   153
    };
sl@0
   154
sl@0
   155
sl@0
   156
#endif //__CONTENTREADYFORCOMPOSITION_H__