1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresourceadaptation/inc/sgimage_sw.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,118 @@
1.4 +// Copyright (c) 2007-2009 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 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @internalTechnology
1.22 + @prototype
1.23 +*/
1.24 +
1.25 +#ifndef SGIMAGE_SW_H
1.26 +#define SGIMAGE_SW_H
1.27 +
1.28 +#include <e32def.h>
1.29 +
1.30 +
1.31 +/**
1.32 +@internalTechnology
1.33 +@prototype
1.34 +
1.35 +This interface allows direct access to the pixel data of an image from user-side
1.36 +code. It is intended for use by software implementations of functions in the
1.37 +Graphics subsystem.
1.38 +
1.39 +This interface is only supported if the image is or can be stored in system memory.
1.40 +This is always the case on platforms without hardware acceleration and also on
1.41 +platforms with Unified Memory Architecture (UMA) hardware accelerators.
1.42 +*/
1.43 +class MSgImage_Sw
1.44 + {
1.45 +public:
1.46 + enum { EInterfaceUid = 0x102858F0 };
1.47 + /**
1.48 + @internalTechnology
1.49 + @prototype
1.50 +
1.51 + Retrieves the base address of the pixel data in system memory.
1.52 +
1.53 + @pre In builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE, the image has been prepared
1.54 + for CPU access to its pixel data by a previous call to BeginDataAccess().
1.55 + @post None.
1.56 + @return The base address of the pixel data in system memory.
1.57 + @panic SGRES-ADAPTER 4 in debug builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE,
1.58 + if the image has not been prepared for CPU access to its pixel data by
1.59 + a previous call to BeginDataAccess().
1.60 + */
1.61 + virtual TAny* DataAddress() const = 0;
1.62 + /**
1.63 + @internalTechnology
1.64 + @prototype
1.65 +
1.66 + Retrieves the number of bytes between rows of the pixel data in system memory.
1.67 +
1.68 + @pre None.
1.69 + @post None.
1.70 + @return The number of bytes between rows of the pixel data in system memory.
1.71 + */
1.72 + virtual TInt DataStride() const = 0;
1.73 + /**
1.74 + @internalTechnology
1.75 + @prototype
1.76 +
1.77 + Marks the beginning of CPU access to the pixel data. This function must be
1.78 + called before DataAddress() in builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE
1.79 + and prepares the image for CPU access to its pixel data in system memory. Calls
1.80 + to BeginDataAccess() must be coupled with subsequent calls to EndDataAccess().
1.81 +
1.82 + @pre aCpuAccess is not ESgCpuAccessNone.
1.83 + @pre The image has not been mapped for CPU access to its pixel data by a
1.84 + call to RSgImage::MapReadOnly(), RSgImage::MapWriteOnly() or
1.85 + RSgImage::MapReadWrite().
1.86 + @pre The image has not been prepared for CPU access to its pixel data by a
1.87 + call to BeginDataAccess().
1.88 + @post The image is prepared for CPU access to its pixel data.
1.89 + @param aCpuAccess Whether the pixel data is going to be only read, only
1.90 + written or read and written by the CPU until the corresponding call
1.91 + to EndDataAccess().
1.92 + @return KErrNone if successful.
1.93 + @return KErrArgument if aCpuAccess is ESgCpuAccessNone.
1.94 + @return KErrInUse if the image was already mapped or prepared for CPU access
1.95 + to its pixel data.
1.96 + @return KErrNoMemory if there is not enough system memory.
1.97 + */
1.98 + virtual TInt BeginDataAccess(TSgCpuAccess aCpuAccess) = 0;
1.99 + /**
1.100 + @internalTechnology
1.101 + @prototype
1.102 +
1.103 + Marks the end of CPU access to the pixel data. This function must be called
1.104 + when finished using the values returned by DataAddress() in builds with
1.105 + SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE and ensures that, if the CPU has modified
1.106 + the pixel data, any subsequent usage of the image by the GPU will reflect
1.107 + its new state. Calls to EndDataAccess() must correspond to prior calls to
1.108 + BeginDataAccess().
1.109 +
1.110 + @pre The image has been prepared for CPU access to its pixel data by a
1.111 + successful call to BeginDataAccess().
1.112 + @post The image is no longer prepared for CPU access to its pixel data.
1.113 + @return KErrNone if successful.
1.114 + @return KErrGeneral if the image had not been prepared for CPU access to its
1.115 + pixel data by a successful call to BeginDataAccess().
1.116 + */
1.117 + virtual TInt EndDataAccess() = 0;
1.118 + };
1.119 +
1.120 +
1.121 +#endif // SGIMAGE_SW_H