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