os/graphics/graphicscomposition/openwfcinterface/include/wfc.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.
     1 /* Copyright (c) 2009 The Khronos Group Inc.
     2  *
     3  * Permission is hereby granted, free of charge, to any person obtaining a
     4  * copy of this software and/or associated documentation files (the
     5  * "Materials"), to deal in the Materials without restriction, including
     6  * without limitation the rights to use, copy, modify, merge, publish,
     7  * distribute, sublicense, and/or sell copies of the Materials, and to
     8  * permit persons to whom the Materials are furnished to do so, subject to
     9  * the following conditions:
    10  *
    11  * The above copyright notice and this permission notice shall be included
    12  * in all copies or substantial portions of the Materials.
    13  *
    14  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    20  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    21  */
    22 
    23 /*! \defgroup wfc OpenWF Composition SI
    24  * @{
    25  */
    26 
    27 /*! \file wfc.h
    28  *
    29  *  \brief OpenWF Composition public API, type definitions and function prototypes
    30  *
    31  *  This is one of the three header files defined by the specification.
    32  *  This file contains the portable definitions of data types
    33  *  and function prototypes.
    34 
    35  *  Refer to OpenWF Composition specification for the
    36  *  additional documentation.
    37  *
    38  */
    39 
    40 /*! @} */
    41 
    42 #ifndef _WFC_H_
    43 #define _WFC_H_
    44 
    45 #include <WF/wfcplatform.h>
    46 
    47 #ifdef __cplusplus
    48 extern "C" {
    49 #endif
    50 
    51 #define OPENWFC_VERSION_1_0       (1)
    52 
    53 #define WFC_NONE                  (0)
    54 
    55 #define WFC_INVALID_HANDLE        ((WFCHandle)0)
    56 
    57 #define WFC_DEFAULT_DEVICE_ID     (0)
    58 
    59 typedef enum {
    60     WFC_FALSE                               = KHR_BOOLEAN_FALSE,
    61     WFC_TRUE                                = KHR_BOOLEAN_TRUE,
    62     WFC_BOOLEAN_FORCE_32BIT                 = 0x7FFFFFFF
    63 } WFCboolean;
    64 
    65 typedef WFCHandle WFCDevice;
    66 typedef WFCHandle WFCContext;
    67 typedef WFCHandle WFCSource;
    68 typedef WFCHandle WFCMask;
    69 typedef WFCHandle WFCElement;
    70 
    71 typedef enum {
    72     WFC_ERROR_NONE                          = 0,
    73     WFC_ERROR_OUT_OF_MEMORY                 = 0x7001,
    74     WFC_ERROR_ILLEGAL_ARGUMENT              = 0x7002,
    75     WFC_ERROR_UNSUPPORTED                   = 0x7003,
    76     WFC_ERROR_BAD_ATTRIBUTE                 = 0x7004,
    77     WFC_ERROR_IN_USE                        = 0x7005,
    78     WFC_ERROR_BUSY                          = 0x7006,
    79     WFC_ERROR_BAD_DEVICE                    = 0x7007,
    80     WFC_ERROR_BAD_HANDLE                    = 0x7008,
    81     WFC_ERROR_INCONSISTENCY                 = 0x7009,
    82     WFC_ERROR_FORCE_32BIT                   = 0x7FFFFFFF
    83 } WFCErrorCode;
    84 
    85 typedef enum {
    86     WFC_DEVICE_FILTER_SCREEN_NUMBER         = 0x7020,
    87     WFC_DEVICE_FILTER_FORCE_32BIT           = 0x7FFFFFFF
    88 } WFCDeviceFilter;
    89 
    90 typedef enum {
    91     /* Read-only */
    92     WFC_DEVICE_CLASS                        = 0x7030,
    93     WFC_DEVICE_ID                           = 0x7031,
    94     WFC_DEVICE_FORCE_32BIT                  = 0x7FFFFFFF
    95 } WFCDeviceAttrib;
    96 
    97 typedef enum {
    98     WFC_DEVICE_CLASS_FULLY_CAPABLE          = 0x7040,
    99     WFC_DEVICE_CLASS_OFF_SCREEN_ONLY        = 0x7041,
   100     WFC_DEVICE_CLASS_FORCE_32BIT            = 0x7FFFFFFF
   101 } WFCDeviceClass;
   102 
   103 typedef enum {
   104     /* Read-only */
   105     WFC_CONTEXT_TYPE                        = 0x7051,
   106     WFC_CONTEXT_TARGET_HEIGHT               = 0x7052,
   107     WFC_CONTEXT_TARGET_WIDTH                = 0x7053,
   108     WFC_CONTEXT_LOWEST_ELEMENT              = 0x7054,
   109 
   110     /* Read-write */
   111     WFC_CONTEXT_ROTATION                    = 0x7061,
   112     WFC_CONTEXT_BG_COLOR                    = 0x7062,
   113     WFC_CONTEXT_FORCE_32BIT                 = 0x7FFFFFFF
   114 } WFCContextAttrib;
   115 
   116 typedef enum {
   117     WFC_CONTEXT_TYPE_ON_SCREEN              = 0x7071,
   118     WFC_CONTEXT_TYPE_OFF_SCREEN             = 0x7072,
   119     WFC_CONTEXT_TYPE_FORCE_32BIT            = 0x7FFFFFFF
   120 } WFCContextType;
   121 
   122 typedef enum {
   123     /* Clockwise rotation */
   124     WFC_ROTATION_0                          = 0x7081,  /* default */
   125     WFC_ROTATION_90                         = 0x7082,
   126     WFC_ROTATION_180                        = 0x7083,
   127     WFC_ROTATION_270                        = 0x7084,
   128     WFC_ROTATION_FORCE_32BIT                = 0x7FFFFFFF
   129 } WFCRotation;
   130 
   131 typedef enum {
   132     WFC_ELEMENT_DESTINATION_RECTANGLE       = 0x7101,
   133     WFC_ELEMENT_SOURCE                      = 0x7102,
   134     WFC_ELEMENT_SOURCE_RECTANGLE            = 0x7103,
   135     WFC_ELEMENT_SOURCE_FLIP                 = 0x7104,
   136     WFC_ELEMENT_SOURCE_ROTATION             = 0x7105,
   137     WFC_ELEMENT_SOURCE_SCALE_FILTER         = 0x7106,
   138     WFC_ELEMENT_TRANSPARENCY_TYPES          = 0x7107,
   139     WFC_ELEMENT_GLOBAL_ALPHA                = 0x7108,
   140     WFC_ELEMENT_MASK                        = 0x7109,
   141     WFC_ELEMENT_FORCE_32BIT                 = 0x7FFFFFFF
   142 } WFCElementAttrib;
   143 
   144 typedef enum {
   145     WFC_SCALE_FILTER_NONE                   = 0x7151,  /* default */
   146     WFC_SCALE_FILTER_FASTER                 = 0x7152,
   147     WFC_SCALE_FILTER_BETTER                 = 0x7153,
   148     WFC_SCALE_FILTER_FORCE_32BIT            = 0x7FFFFFFF
   149 } WFCScaleFilter;
   150 
   151 typedef enum {
   152     WFC_TRANSPARENCY_NONE                   = 0,       /* default */
   153     WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA   = (1 << 0),
   154     WFC_TRANSPARENCY_SOURCE                 = (1 << 1),
   155     WFC_TRANSPARENCY_MASK                   = (1 << 2),
   156     WFC_TRANSPARENCY_FORCE_32BIT            = 0x7FFFFFFF
   157 } WFCTransparencyType;
   158 
   159 typedef enum {
   160     WFC_VENDOR                              = 0x7200,
   161     WFC_RENDERER                            = 0x7201,
   162     WFC_VERSION                             = 0x7202,
   163     WFC_EXTENSIONS                          = 0x7203,
   164     WFC_STRINGID_FORCE_32BIT                = 0x7FFFFFFF
   165 } WFCStringID;
   166 
   167 
   168 /* Function Prototypes */
   169 
   170 /* Device */
   171 WFC_API_CALL WFCint WFC_APIENTRY
   172     wfcEnumerateDevices(WFCint *deviceIds, WFCint deviceIdsCount,
   173         const WFCint *filterList) WFC_APIEXIT;
   174 WFC_API_CALL WFCDevice WFC_APIENTRY
   175     wfcCreateDevice(WFCint deviceId, const WFCint *attribList) WFC_APIEXIT;
   176 WFC_API_CALL WFCErrorCode WFC_APIENTRY
   177     wfcGetError(WFCDevice dev) WFC_APIEXIT;
   178 WFC_API_CALL WFCint WFC_APIENTRY
   179     wfcGetDeviceAttribi(WFCDevice dev, WFCDeviceAttrib attrib) WFC_APIEXIT;
   180 WFC_API_CALL WFCErrorCode WFC_APIENTRY
   181     wfcDestroyDevice(WFCDevice dev) WFC_APIEXIT;
   182 
   183 /* Context */
   184 WFC_API_CALL WFCContext WFC_APIENTRY
   185     wfcCreateOnScreenContext(WFCDevice dev,
   186         WFCint screenNumber,
   187         const WFCint *attribList) WFC_APIEXIT;
   188 WFC_API_CALL WFCContext WFC_APIENTRY
   189     wfcCreateOffScreenContext(WFCDevice dev,
   190         WFCNativeStreamType stream,
   191         const WFCint *attribList) WFC_APIEXIT;
   192 WFC_API_CALL void WFC_APIENTRY
   193     wfcCommit(WFCDevice dev, WFCContext ctx, WFCboolean wait) WFC_APIEXIT;
   194 WFC_API_CALL WFCint WFC_APIENTRY
   195     wfcGetContextAttribi(WFCDevice dev, WFCContext ctx,
   196         WFCContextAttrib attrib) WFC_APIEXIT;
   197 WFC_API_CALL void WFC_APIENTRY
   198     wfcGetContextAttribfv(WFCDevice dev, WFCContext ctx,
   199         WFCContextAttrib attrib, WFCint count, WFCfloat *values) WFC_APIEXIT;
   200 WFC_API_CALL void WFC_APIENTRY
   201     wfcSetContextAttribi(WFCDevice dev, WFCContext ctx,
   202         WFCContextAttrib attrib, WFCint value) WFC_APIEXIT;
   203 WFC_API_CALL void WFC_APIENTRY
   204     wfcSetContextAttribfv(WFCDevice dev, WFCContext ctx,
   205         WFCContextAttrib attrib,
   206         WFCint count, const WFCfloat *values) WFC_APIEXIT;
   207 WFC_API_CALL void WFC_APIENTRY
   208     wfcDestroyContext(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
   209 
   210 /* Source */
   211 WFC_API_CALL WFCSource WFC_APIENTRY
   212     wfcCreateSourceFromStream(WFCDevice dev, WFCContext ctx,
   213         WFCNativeStreamType stream,
   214         const WFCint *attribList) WFC_APIEXIT;
   215 WFC_API_CALL void WFC_APIENTRY
   216     wfcDestroySource(WFCDevice dev, WFCSource src) WFC_APIEXIT;
   217 
   218 /* Mask */
   219 WFC_API_CALL WFCMask WFC_APIENTRY
   220     wfcCreateMaskFromStream(WFCDevice dev, WFCContext ctx,
   221         WFCNativeStreamType stream,
   222         const WFCint *attribList) WFC_APIEXIT;
   223 WFC_API_CALL void WFC_APIENTRY
   224     wfcDestroyMask(WFCDevice dev, WFCMask mask) WFC_APIEXIT;
   225 
   226 /* Element */
   227 WFC_API_CALL WFCElement WFC_APIENTRY
   228     wfcCreateElement(WFCDevice dev, WFCContext ctx,
   229         const WFCint *attribList) WFC_APIEXIT;
   230 WFC_API_CALL WFCint WFC_APIENTRY
   231     wfcGetElementAttribi(WFCDevice dev, WFCElement element,
   232         WFCElementAttrib attrib) WFC_APIEXIT;
   233 WFC_API_CALL WFCfloat WFC_APIENTRY
   234     wfcGetElementAttribf(WFCDevice dev, WFCElement element,
   235         WFCElementAttrib attrib) WFC_APIEXIT;
   236 WFC_API_CALL void WFC_APIENTRY
   237     wfcGetElementAttribiv(WFCDevice dev, WFCElement element,
   238         WFCElementAttrib attrib, WFCint count, WFCint *values) WFC_APIEXIT;
   239 WFC_API_CALL void WFC_APIENTRY
   240     wfcGetElementAttribfv(WFCDevice dev, WFCElement element,
   241         WFCElementAttrib attrib, WFCint count, WFCfloat *values) WFC_APIEXIT;
   242 WFC_API_CALL void WFC_APIENTRY
   243     wfcSetElementAttribi(WFCDevice dev, WFCElement element,
   244         WFCElementAttrib attrib, WFCint value) WFC_APIEXIT;
   245 WFC_API_CALL void WFC_APIENTRY
   246     wfcSetElementAttribf(WFCDevice dev, WFCElement element,
   247         WFCElementAttrib attrib, WFCfloat value) WFC_APIEXIT;
   248 WFC_API_CALL void WFC_APIENTRY
   249     wfcSetElementAttribiv(WFCDevice dev, WFCElement element,
   250         WFCElementAttrib attrib,
   251         WFCint count, const WFCint *values) WFC_APIEXIT;
   252 WFC_API_CALL void WFC_APIENTRY
   253     wfcSetElementAttribfv(WFCDevice dev, WFCElement element,
   254         WFCElementAttrib attrib,
   255         WFCint count, const WFCfloat *values) WFC_APIEXIT;
   256 WFC_API_CALL void WFC_APIENTRY
   257     wfcInsertElement(WFCDevice dev, WFCElement element,
   258         WFCElement subordinate) WFC_APIEXIT;
   259 WFC_API_CALL void WFC_APIENTRY
   260     wfcRemoveElement(WFCDevice dev, WFCElement element) WFC_APIEXIT;
   261 WFC_API_CALL WFCElement WFC_APIENTRY
   262     wfcGetElementAbove(WFCDevice dev, WFCElement element) WFC_APIEXIT;
   263 WFC_API_CALL WFCElement WFC_APIENTRY
   264     wfcGetElementBelow(WFCDevice dev, WFCElement element) WFC_APIEXIT;
   265 WFC_API_CALL void WFC_APIENTRY
   266     wfcDestroyElement(WFCDevice dev, WFCElement element) WFC_APIEXIT;
   267 
   268 /* Rendering */
   269 WFC_API_CALL void WFC_APIENTRY
   270     wfcActivate(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
   271 WFC_API_CALL void WFC_APIENTRY
   272     wfcDeactivate(WFCDevice dev, WFCContext ctx) WFC_APIEXIT;
   273 WFC_API_CALL void WFC_APIENTRY
   274     wfcCompose(WFCDevice dev, WFCContext ctx, WFCboolean wait) WFC_APIEXIT;
   275 WFC_API_CALL void WFC_APIENTRY
   276     wfcFence(WFCDevice dev, WFCContext ctx, WFCEGLDisplay dpy,
   277         WFCEGLSync sync) WFC_APIEXIT;
   278 
   279 /* Renderer and extension information */
   280 WFC_API_CALL WFCint WFC_APIENTRY
   281     wfcGetStrings(WFCDevice dev,
   282         WFCStringID name,
   283         const char **strings,
   284         WFCint stringsCount) WFC_APIEXIT;
   285 WFC_API_CALL WFCboolean WFC_APIENTRY
   286     wfcIsExtensionSupported(WFCDevice dev, const char *string) WFC_APIEXIT;
   287 
   288 #ifdef __cplusplus
   289 }
   290 #endif
   291 
   292 #endif /* _WFC_H_ */