2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __PROVIDER_BUFFER_H
18 #define __PROVIDER_BUFFER_H
25 * \addtogroup CAPI_PROVIDER_MODULE
31 * This enumeration value has to be sync'd with the liblivebox interface. (only for inhouse livebox)
41 * This enumeration value should be sync'd with liblivebox interface. (only for inhouse livebox)
44 BUFFER_EVENT_ENTER, /*!< */
45 BUFFER_EVENT_LEAVE, /*!< */
46 BUFFER_EVENT_DOWN, /*!< */
47 BUFFER_EVENT_MOVE, /*!< */
48 BUFFER_EVENT_UP, /*!< */
50 BUFFER_EVENT_KEY_DOWN, /*!< */
51 BUFFER_EVENT_KEY_UP, /*!< */
52 BUFFER_EVENT_KEY_FOCUS_IN, /*!< */
53 BUFFER_EVENT_KEY_FOCUS_OUT, /*!< */
55 BUFFER_EVENT_HIGHLIGHT,
56 BUFFER_EVENT_HIGHLIGHT_NEXT,
57 BUFFER_EVENT_HIGHLIGHT_PREV,
58 BUFFER_EVENT_ACTIVATE,
59 BUFFER_EVENT_ACTION_UP,
60 BUFFER_EVENT_ACTION_DOWN,
61 BUFFER_EVENT_SCROLL_UP,
62 BUFFER_EVENT_SCROLL_MOVE,
63 BUFFER_EVENT_SCROLL_DOWN,
64 BUFFER_EVENT_UNHIGHLIGHT
67 struct buffer_event_data {
68 enum buffer_event type;
81 struct livebox_buffer;
84 * \brief Send request for acquiring buffer of given type.
87 * \param[in] type TYPE_LB or TYPE_PD, select the type of buffer. is it for LB? or PD?
88 * \param[in] pkgname Package name of a livebox instance
89 * \param[in] id Instance Id
90 * \param[in] width Width of buffer
91 * \param[in] height Height of buffer
92 * \param[in] pixel_size Normally, use "4" for this. it is fixed.
93 * \param[in] handler Event handler. Viewer will send the events such as mouse down,move,up, accessibilty event, etc,. via this callback function.
94 * \param[in] data Callback data for event handler
95 * \return livebox_buffer
96 * \retval Livebox buffer object handler
97 * \retval NULL if it fails to acquire buffer
100 * \see provider_buffer_release
102 extern struct livebox_buffer *provider_buffer_acquire(enum target_type type, const char *pkgname, const char *id, int width, int height, int pixel_size, int (*handler)(struct livebox_buffer *, enum buffer_event, double, double, double, void *), void *data);
106 extern struct livebox_buffer *provider_buffer_create(enum target_type type, const char *pkgname, const char *id, int (*handler)(struct livebox_buffer *, struct buffer_event_data *, void *), void *data);
110 extern int provider_buffer_acquire_NEW(struct livebox_buffer *info, int width, int height, int pixel_size);
120 * \retval LB_STATUS_ERROR_INVALID
121 * \retval LB_STATUS_SUCCESS
126 extern int provider_buffer_resize(struct livebox_buffer *info, int w, int h);
129 * \brief Get the buffer address of given livebox buffer handle.
132 * \param[in] info Handle of livebox buffer
134 * \retval Address of buffer
138 * \see provider_buffer_unref
140 extern void *provider_buffer_ref(struct livebox_buffer *info);
143 * \brief Decrease the reference count of given buffer handle.
146 * \param[in] ptr Address that gets by provider_buffer_ref
150 * \see provider_buffer_ref
152 extern int provider_buffer_unref(void *ptr);
155 * \brief Release the acquired buffer handle.
158 * \param[in] info Handle of livebox buffer
160 * \retval LB_STATUS_ERROR_INVALID
161 * \retval LB_STATUS_SUCCESS
164 * \see provider_buffer_acquire
166 extern int provider_buffer_release(struct livebox_buffer *info);
170 extern int provider_buffer_release_NEW(struct livebox_buffer *info);
173 extern int provider_buffer_destroy(struct livebox_buffer *info);
176 *\brief Make content sync with master.
179 * \param[in] info Handle of livebox buffer
181 * \retval LB_STATUS_ERROR_INVALID
182 * \retval LB_STATUS_SUCCESS
187 extern int provider_buffer_sync(struct livebox_buffer *info);
190 * \brief Get the buffer type
193 * \param[in] info Handle of livebox buffer
194 * \return target type PD or LB
202 extern enum target_type provider_buffer_type(struct livebox_buffer *info);
205 * \brief Get the package name
209 * \return const char *
211 * \retval pkgname package name
216 extern const char *provider_buffer_pkgname(struct livebox_buffer *info);
222 * \param[in] info Handle of livebox buffer
223 * \return const char *
224 * \retval instance Id
230 extern const char *provider_buffer_id(struct livebox_buffer *info);
233 * \brief Give the URI of buffer information.
236 * \param[in] info Handle of livebox buffer
237 * \return const char *
244 extern const char *provider_buffer_uri(struct livebox_buffer *info);
250 * \param[in] info Handle of livebox buffer
253 * \param[out] pixel_size
255 * \retval LB_STATUS_SUCCESS
256 * \retval LB_STATUS_ERROR_INVALID
261 extern int provider_buffer_get_size(struct livebox_buffer *info, int *w, int *h, int *pixel_size);
264 * \brief Getting the PIXMAP id of mapped on this livebox_buffer
267 * \param[in] info Handle of livebox buffer
270 * \retval pixmap id, has to be casted to unsigned int type
275 extern unsigned long provider_buffer_pixmap_id(struct livebox_buffer *info);
278 * \brief Initialize the provider buffer system
281 * \param[in] disp Display information for handling the XPixmap type.
283 * \retval LB_STATUS_ERROR_FAULT
284 * \retval LB_STATUS_SUCCESS
289 extern int provider_buffer_init(void *disp);
292 * \brief Finalize the provider buffer system
296 * \retval LB_STATUS_SUCCESS
301 extern int provider_buffer_fini(void);
304 * \brief Check whether current livebox buffer support H/W(GEM) buffer
307 * \param[in] info Handle of livebox buffer
309 * \retval LB_STATUS_ERROR_INVALID
310 * \retval 1 if support
311 * \retval 0 if not supported
316 extern int provider_buffer_pixmap_is_support_hw(struct livebox_buffer *info);
319 * \brief Create H/W(GEM) Buffer
322 * \param[in] info Handle of livebox buffer
324 * \retval LB_STATUS_SUCCESS
325 * \retval LB_STATUS_ERROR_INVALID
326 * \retval LB_STATUS_ERROR_FAULT
329 * \see provider_buffer_pixmap_destroy_hw
331 extern int provider_buffer_pixmap_create_hw(struct livebox_buffer *info);
334 * \brief Destroy H/W(GEM) Buffer
337 * \param[in] info Handle of livebox buffer
339 * \retval LB_STATUS_SUCCESS
340 * \retval LB_STATUS_ERROR_INVALID
343 * \see provider_buffer_pixmap_create_hw
345 extern int provider_buffer_pixmap_destroy_hw(struct livebox_buffer *info);
348 * \brief Get the H/W system mapped buffer address(GEM buffer) if a buffer support it.
351 * \param[in] info Handle of livebox buffer
353 * \retval H/W system mapped buffer address
354 * \retval NULL fails to get buffer address
357 * \see provider_buffer_pixmap_create_hw
358 * \see provider_buffer_pixmap_destroy_hw
360 extern void *provider_buffer_pixmap_hw_addr(struct livebox_buffer *info);
363 * \brief Prepare the render buffer to write or read something on it.
366 * \param[in] info Handle of livebox buffer
368 * \retval LB_STATUS_SUCCESS
369 * \retval LB_STATUS_ERROR_INVALID
370 * \retval LB_STATUS_ERROR_FAULT
373 * \see provider_buffer_post_render
375 extern int provider_buffer_pre_render(struct livebox_buffer *info);
378 * \brief Finish the render buffer acessing.
381 * \param[in] info Handle of livebox buffer
383 * \retval LB_STATUS_SUCCESS
384 * \retval LB_STATUS_ERROR_INVALID
387 * \see provider_buffer_pre_render
389 extern int provider_buffer_post_render(struct livebox_buffer *info);
395 * \param[in] handle Handle of livebox buffer
400 * \see provider_buffer_set_user_data
402 extern void *provider_buffer_user_data(struct livebox_buffer *handle);
408 * \param[in] handle Handle of livebox buffer
409 * \param[in] data User data
411 * \retval LB_STATUS_SUCCESS
412 * \retval LB_STATUS_ERROR_INVALID
415 * \see provider_buffer_user_data
417 extern int provider_buffer_set_user_data(struct livebox_buffer *handle, void *data);
426 * \return livebox_buffer
432 extern struct livebox_buffer *provider_buffer_find_buffer(enum target_type type, const char *pkgname, const char *id);