os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfcdevice.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /* Copyright (c) 2009 The Khronos Group Inc.
     2  * Portions copyright (c) 2009-2010  Nokia Corporation and/or its subsidiary(-ies)
     3  *
     4  * Permission is hereby granted, free of charge, to any person obtaining a
     5  * copy of this software and/or associated documentation files (the
     6  * "Materials"), to deal in the Materials without restriction, including
     7  * without limitation the rights to use, copy, modify, merge, publish,
     8  * distribute, sublicense, and/or sell copies of the Materials, and to
     9  * permit persons to whom the Materials are furnished to do so, subject to
    10  * the following conditions:
    11  *
    12  * The above copyright notice and this permission notice shall be included
    13  * in all copies or substantial portions of the Materials.
    14  *
    15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    22  */
    23 /*! \ingroup wfc
    24  *  \file wfcdevice.h
    25  *
    26  *  \brief Device handling interface
    27  */
    28 #ifndef WFCDEVICE_H_
    29 #define WFCDEVICE_H_
    30 
    31 #include "WF/wfc.h"
    32 #include "wfcstructs.h"
    33 #include "wfcimageprovider.h"
    34 
    35 #ifdef __cplusplus
    36 extern "C" {
    37 #endif
    38 
    39 /*!
    40  *  Get list of available devices.
    41  *
    42  *  \param idList Pointer to list where device IDs should be written
    43  *  \param listCapacity Maximum number of IDs to write
    44  *  \param filterList User provided array
    45  *
    46  *  \return Number of IDs written.
    47  */
    48 OWF_API_CALL WFCint
    49 WFC_Devices_GetIds(WFCint* idList,
    50                    WFCint listCapacity,
    51                    const WFCint* filterList);
    52 
    53 /*!
    54  *  \brief Create instance of a device whose ID
    55  *  matches deviceId
    56  *
    57  *  \param deviceId ID of the device to create. Must be WFC_DEFAULT_DEVICE_ID
    58  *  or some other valid device ID (returned by Devices_GetIds)
    59  *
    60  *  \return Handle to created device or WFC_INVALID_HANDLE
    61  *
    62  */
    63 OWF_API_CALL WFCint
    64 WFC_Device_Create(WFCint deviceId);
    65 
    66 /*!
    67  *  \brief Destroy device, or rather queue it for destruction.
    68  *
    69  *  \param device Device
    70  */
    71 OWF_API_CALL void
    72 WFC_Device_Destroy(WFC_DEVICE* device);
    73 
    74 /*!
    75  *  \brief Set error code for device.
    76  *
    77  *  Obs! In case the previous
    78  *  error code hasn't been read from the device, this function
    79  *  does nothing; the new error is set only if "current" error
    80  *  is none.
    81  *
    82  *  \param dev Device object
    83  *  \param code Error to set
    84  *
    85  */
    86 OWF_API_CALL void OWF_APIENTRY
    87 WFC_Device_SetError(WFCDevice dev,
    88                     WFCErrorCode code);
    89 
    90 /*!
    91  *  \brief Read and reset last error code from device.
    92  *
    93  *  \param device Device object
    94  *
    95  *  \return WFCErrorCode
    96  */
    97 OWF_API_CALL WFCErrorCode
    98 WFC_Device_GetError(WFC_DEVICE* device);
    99 
   100 /*!
   101  *  \brief Find device object by handle
   102  *
   103  *  \param dev Device handle
   104  *
   105  *  \return Mathing device object or NULL
   106  */
   107 OWF_API_CALL WFC_DEVICE*
   108 WFC_Device_FindByHandle(WFCDevice dev);
   109 
   110 /*!
   111  *  \brief Get device attribute
   112  *
   113  *  \param device Device
   114  *  \param attrib Attribute name
   115  *  \param value Pointer to where the value should be saved
   116  *
   117  *  \return WFCErrorCode
   118  */
   119 OWF_API_CALL WFCErrorCode
   120 WFC_Device_GetAttribi(WFC_DEVICE* device,
   121                       WFCDeviceAttrib attrib,
   122                       WFCint* value);
   123 
   124 /*!
   125  *  \brief Create context on device
   126  *
   127  *  \param device Device
   128  *  \param stream Target stream for context
   129  *  \param type Context type
   130  *
   131  *  \return New context
   132  */
   133 OWF_API_CALL WFC_CONTEXT*
   134 WFC_Device_CreateContext(WFC_DEVICE* device,
   135                          OWFNativeStreamType stream,
   136                          WFCContextType type,
   137                          WFCint screenNum);
   138 
   139 /*!
   140  *  \brief Destroy context from device
   141  */
   142 OWF_API_CALL WFCErrorCode
   143 WFC_Device_DestroyContext(WFC_DEVICE* device,
   144                           WFCContext context);
   145 
   146 /*!
   147  *  \brief Destroy all device's contexts
   148  *
   149  *  \param device Device object
   150  */
   151 OWF_API_CALL void
   152 WFC_Device_DestroyContexts(WFC_DEVICE* device);
   153 
   154 /*!
   155  *  \brief Find context context object by handle
   156  *
   157  *  \param device Device
   158  *  \param context Context handle
   159  *
   160  *  \return Corresponding context object or NULL
   161  *  if handle is invalid.
   162  */
   163 OWF_API_CALL WFC_CONTEXT*
   164 WFC_Device_FindContext(WFC_DEVICE* device,
   165                        WFCContext context);
   166 
   167 /*!
   168  *  \brief Create new element
   169  *
   170  *  \param device
   171  *  \param context
   172  *
   173  *  \return New element or NULL
   174  */
   175 OWF_API_CALL WFC_ELEMENT*
   176 WFC_Device_CreateElement(WFC_DEVICE* device, WFC_CONTEXT* context);
   177 
   178 /*!
   179  *  \brief Destroy element
   180  *
   181  *  \param device
   182  *  \param element
   183  */
   184 OWF_API_CALL WFCErrorCode
   185 WFC_Device_DestroyElement(WFC_DEVICE* device,
   186                           WFCElement element);
   187 
   188 /*!
   189  *  \brief Destroy all elements from device
   190  *
   191  *  \param device Device
   192  */
   193 OWF_API_CALL void
   194 WFC_Device_DestroyElements(WFC_DEVICE* device);
   195 
   196 /*!
   197  *  \brief Find element by handle
   198  *
   199  *  \param device Device
   200  *  \param el Element handle
   201  *
   202  *  \return Element object
   203  */
   204 OWF_API_CALL WFC_ELEMENT*
   205 WFC_Device_FindElement(WFC_DEVICE* device,
   206                        WFCElement el);
   207 
   208 /*!
   209  *  \brief Set element integer vector attribute
   210  *
   211  *  \param device Device
   212  *  \param element Element handle
   213  *  \param attrib Attribute name
   214  *  \param count Attribute value vector length (1 for scalar attribute)
   215  *  \param values Pointer to values
   216  *
   217  *  \return WFCErrorCode: WFC_ERROR_BAD_ATTRIBUTE if attribute name is invalid;
   218  *  WFC_ERROR_INVALID_ARGUMENT if values is NULL or if the count doesn't match
   219  *  the attribute's size; WFC_ERROR_BAD_HANDLE if element handle is invalid.
   220  */
   221 OWF_API_CALL WFCErrorCode
   222 WFC_Device_SetElementAttribiv(WFC_DEVICE* device,
   223                               WFCElement element,
   224                               WFCElementAttrib attrib,
   225                               WFCint count,
   226                               const WFCint* values);
   227 
   228 /*!
   229  *  \brief Set element attribute
   230  */
   231 OWF_API_CALL WFCErrorCode
   232 WFC_Device_SetElementAttribfv(WFC_DEVICE* device,
   233                               WFCElement element,
   234                               WFCElementAttrib attrib,
   235                               WFCint count,
   236                               const WFCfloat* values);
   237 /*!
   238  *  \brief Get element attribute
   239  */
   240 OWF_API_CALL WFCErrorCode
   241 WFC_Device_GetElementAttribiv(WFC_DEVICE* device,
   242                               WFCElement element,
   243                               WFCElementAttrib attrib,
   244                               WFCint count,
   245                               WFCint* values);
   246 /*!
   247  *  \brief Get element attribute
   248  */
   249 OWF_API_CALL WFCErrorCode
   250 WFC_Device_GetElementAttribfv(WFC_DEVICE* device,
   251                               WFCElement element,
   252                               WFCElementAttrib attrib,
   253                               WFCint count,
   254                               WFCfloat* values);
   255 
   256 
   257 /*!
   258  *  \brief Destroy all image providers from device
   259  *
   260  *  \param device Device
   261  */
   262 OWF_API_CALL void
   263 WFC_Device_DestroyImageProviders(WFC_DEVICE* device);
   264 
   265 OWF_API_CALL WFC_IMAGE_PROVIDER*
   266 WFC_Device_FindImageProvider(WFC_DEVICE* device,
   267                              WFCHandle handle,
   268                              WFC_IMAGE_PROVIDER_TYPE type);
   269 
   270 OWF_API_CALL WFC_IMAGE_PROVIDER*
   271 WFC_Device_CreateSource(WFC_DEVICE* device,
   272                         WFC_CONTEXT* context,
   273                         WFCNativeStreamType stream);
   274 
   275 OWF_API_CALL WFC_IMAGE_PROVIDER*
   276 WFC_Device_CreateMask(WFC_DEVICE* device,
   277                       WFC_CONTEXT* context,
   278                       WFCNativeStreamType stream);
   279 
   280 OWF_API_CALL WFCErrorCode
   281 WFC_Device_DestroySource(WFC_DEVICE* device, WFCSource source);
   282 
   283 OWF_API_CALL WFCErrorCode
   284 WFC_Device_DestroyMask(WFC_DEVICE* device, WFCMask mask);
   285 
   286 OWF_API_CALL WFC_IMAGE_PROVIDER*
   287 WFC_Device_FindSource(WFC_DEVICE* device, WFCSource source);
   288 
   289 OWF_API_CALL WFC_IMAGE_PROVIDER*
   290 WFC_Device_FindMask(WFC_DEVICE* device, WFCMask mask);
   291 
   292 OWF_API_CALL void
   293 WFC_Device_EnableContentNotifications(WFC_DEVICE* device,
   294                                       WFC_CONTEXT* context,
   295                                       WFCboolean enable);
   296 
   297 OWF_API_CALL WFCboolean
   298 WFC_Device_StreamIsTarget(WFC_DEVICE* device,
   299                           WFCNativeStreamType stream);
   300 
   301 OWF_API_CALL WFC_CONTEXT*
   302 WFC_Device_FindContextByScreen(WFC_DEVICE* device,
   303                                WFCint screenNumber);
   304 
   305 OWF_API_CALL void
   306 WFC_Device_DestroyContextElements(WFC_DEVICE* device,
   307                                   WFC_CONTEXT* context);
   308 
   309 OWF_API_CALL void
   310 WFC_Device_DestroyContextImageProviders(WFC_DEVICE* device,
   311                                         WFC_CONTEXT* context);
   312 
   313 OWF_API_CALL WFCboolean
   314 WFC_Device_FindScreenNumber(WFCint screenNumber);
   315 
   316 #ifdef __cplusplus
   317 }
   318 #endif
   319 
   320 #endif /*WFCDEVICE_H_*/