...
drm_layer_get_capability,
...
- };
+ };
static tdm_drm_data *drm_data;
tdm_backend_module tdm_backend_module_data =
{
- "drm",
+ "drm",
"Samsung",
TDM_BACKEND_ABI_VERSION,
tdm_drm_init,
*/
typedef enum
{
- TDM_DISPLAY_CAPABILITY_PP = (1<<0), /**< if hardware supports pp operation */
- TDM_DISPLAY_CAPABILITY_CAPTURE = (1<<1), /**< if hardware supports capture operation */
+ TDM_DISPLAY_CAPABILITY_PP = (1<<0), /**< if hardware supports pp operation */
+ TDM_DISPLAY_CAPABILITY_CAPTURE = (1<<1), /**< if hardware supports capture operation */
} tdm_display_capability;
/**
* @return A display object
* @see tdm_display_deinit
*/
-tdm_display* tdm_display_init(tdm_error *error);
+tdm_display *
+tdm_display_init(tdm_error *error);
/**
* @brief Deinitialize a display object
* @param[in] dpy A display object
* @see tdm_display_init
*/
-void tdm_display_deinit(tdm_display *dpy);
+void
+tdm_display_deinit(tdm_display *dpy);
/**
* @brief Update a display object
* @param[in] dpy A display object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_update(tdm_display *dpy);
+tdm_error
+tdm_display_update(tdm_display *dpy);
/**
* @brief Get the file descriptor
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_display_handle_events
*/
-tdm_error tdm_display_get_fd(tdm_display *dpy, int *fd);
+tdm_error
+tdm_display_get_fd(tdm_display *dpy, int *fd);
/**
* @brief Handle the events
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_display_get_fd
*/
-tdm_error tdm_display_handle_events(tdm_display *dpy);
+tdm_error
+tdm_display_handle_events(tdm_display *dpy);
/**
* @brief Get the capabilities of a display object.
* @param[out] capabilities The capabilities of a display object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_capabilities(tdm_display *dpy, tdm_display_capability *capabilities);
+tdm_error
+tdm_display_get_capabilities(tdm_display *dpy,
+ tdm_display_capability *capabilities);
/**
* @brief Get the pp capabilities of a display object.
* @param[out] capabilities The pp capabilities
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_pp_capabilities(tdm_display *dpy, tdm_pp_capability *capabilities);
+tdm_error
+tdm_display_get_pp_capabilities(tdm_display *dpy,
+ tdm_pp_capability *capabilities);
/**
* @brief Get the pp available format array of a display object.
* @param[out] count The count of formats
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_pp_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
+tdm_error
+tdm_display_get_pp_available_formats(tdm_display *dpy,
+ const tbm_format **formats, int *count);
/**
* @brief Get the pp available size of a display object.
* @param[out] preferred_align The preferred align width which TDM can handle
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
+tdm_error
+tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
+ int *max_w, int *max_h, int *preferred_align);
/**
* @brief Get the capture capabilities of a display object.
* @param[out] capabilities The capture capabilities
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_capture_capabilities(tdm_display *dpy, tdm_capture_capability *capabilities);
+tdm_error
+tdm_display_get_capture_capabilities(tdm_display *dpy,
+ tdm_capture_capability *capabilities);
/**
* @brief Get the capture available format array of a display object.
* @param[out] count The count of formats
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_display_get_catpure_available_formats(tdm_display *dpy, const tbm_format **formats, int *count);
+tdm_error
+tdm_display_get_catpure_available_formats(tdm_display *dpy,
+ const tbm_format **formats, int *count);
/**
* @brief Get the output counts which a display object has.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_display_get_output
*/
-tdm_error tdm_display_get_output_count(tdm_display *dpy, int *count);
+tdm_error
+tdm_display_get_output_count(tdm_display *dpy, int *count);
/**
* @brief Get a output object which has the given index.
* @return A output object if success. Otherwise, NULL.
* @see tdm_display_get_output_count
*/
-tdm_output* tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
+tdm_output *
+tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error);
/**
* @brief Create a pp object.
* @return A pp object if success. Otherwise, NULL.
* @see tdm_pp_destroy
*/
-tdm_pp* tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
+tdm_pp *
+tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
/**
* @brief Get the model information of a output object.
* @param[out] name The output name.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_model_info(tdm_output *output, const char **maker, const char **model, const char **name);
+tdm_error
+tdm_output_get_model_info(tdm_output *output, const char **maker,
+ const char **model, const char **name);
/**
* @brief Get the connection status of a output object.
* @param[out] status The connection status.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
+tdm_error
+tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
/**
* @brief Get the connection type of a output object.
* @param[out] type The connection type.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
+tdm_error
+tdm_output_get_output_type(tdm_output *output, tdm_output_type *type);
/**
* @brief Get the layer counts which a output object has.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_output_get_layer
*/
-tdm_error tdm_output_get_layer_count(tdm_output *output, int *count);
+tdm_error
+tdm_output_get_layer_count(tdm_output *output, int *count);
/**
* @brief Get a layer object which has the given index.
* @return A layer object if success. Otherwise, NULL.
* @see tdm_output_get_layer_count
*/
-tdm_layer* tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
+tdm_layer *
+tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
/**
* @brief Get the available property array of a output object.
* @param[out] count The count of properties
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, int *count);
+tdm_error
+tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
+ int *count);
/**
* @brief Get the available mode array of a output object.
* @param[out] count The count of modes
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_available_modes(tdm_output *output, const tdm_output_mode **modes, int *count);
+tdm_error
+tdm_output_get_available_modes(tdm_output *output,
+ const tdm_output_mode **modes, int *count);
/**
* @brief Get the available size of a output object.
* @param[out] preferred_align The preferred align width which TDM can handle
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h, int *max_w, int *max_h, int *preferred_align);
+tdm_error
+tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
+ int *max_w, int *max_h, int *preferred_align);
/**
* @brief Get the physical size of a output object.
* @param[out] mmHeight The milimeter height
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, unsigned int *mmHeight);
+tdm_error
+tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
+ unsigned int *mmHeight);
/**
* @brief Get the subpixel of a output object.
* @param[out] subpixel The subpixel
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
+tdm_error
+tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel);
/**
* @brief Get the pipe of a output object.
* @param[out] pipe The pipe
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
+tdm_error
+tdm_output_get_pipe(tdm_output *output, unsigned int *pipe);
/**
* @brief Set the property which has a given id.
* @param[in] value The value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
+tdm_error
+tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
/**
* @brief Get the property which has a given id
* @param[out] value The value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
+tdm_error
+tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
/**
* @brief Wait for VBLANK
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see #tdm_output_vblank_handler
*/
-tdm_error tdm_output_wait_vblank(tdm_output *output, int interval, int sync, tdm_output_vblank_handler func, void *user_data);
+tdm_error
+tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
+ tdm_output_vblank_handler func, void *user_data);
/**
* @brief Commit changes for a output object
* @param[in] user_data The user data
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
+tdm_error
+tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
+ void *user_data);
/**
* @brief Set one of available modes of a output object
* @param[in] mode A output mode
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
+tdm_error
+tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
/**
* @brief Get the mode of a output object
* @param[out] mode A output mode
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
+tdm_error
+tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
/**
* @brief Set DPMS of a output object
* @param[in] dpms_value DPMS value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
+tdm_error
+tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
/**
* @brief Get DPMS of a output object
* @param[out] dpms_value DPMS value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
+tdm_error
+tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
/**
* @brief Create a capture object of a output object
* @return A capture object
* @see tdm_capture_destroy
*/
-tdm_capture *tdm_output_create_capture(tdm_output *output, tdm_error *error);
+tdm_capture *
+tdm_output_create_capture(tdm_output *output, tdm_error *error);
/**
* @brief Get the capabilities of a layer object.
* @param[out] capabilities The capabilities of a layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities);
+tdm_error
+tdm_layer_get_capabilities(tdm_layer *layer,
+ tdm_layer_capability *capabilities);
/**
* @brief Get the available format array of a layer object.
* @param[out] count The count of formats
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, int *count);
+tdm_error
+tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
+ int *count);
/**
* @brief Get the available property array of a layer object.
* @param[out] count The count of properties
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, int *count);
+tdm_error
+tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
+ int *count);
/**
* @brief Get the zpos of a layer object.
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_layer_set_video_pos, tdm_layer_capability
*/
-tdm_error tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos);
+tdm_error
+tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos);
/**
* @brief Set the property which has a given id.
* @param[in] value The value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
+tdm_error
+tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
/**
* @brief Get the property which has a given id.
* @param[out] value The value
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
+tdm_error
+tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
/**
* @brief Set the geometry information to a layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_output_commit
*/
-tdm_error tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
+tdm_error
+tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
/**
* @brief Get the geometry information to a layer object
* @param[out] info The geometry information
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
+tdm_error
+tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
/**
* @brief Set a TDM buffer to a layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_output_commit
*/
-tdm_error tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
+tdm_error
+tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
/**
* @brief Unset a TDM buffer from a layer object
* @param[in] layer A layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_unset_buffer(tdm_layer *layer);
+tdm_error
+tdm_layer_unset_buffer(tdm_layer *layer);
/**
* @brief Set a TBM surface_queue to a layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_output_commit
*/
-tdm_error tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
+tdm_error
+tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue);
/**
* @brief Unset a TBM surface_queue from a layer object
* @param[in] layer A layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_unset_buffer_queue(tdm_layer *layer);
+tdm_error
+tdm_layer_unset_buffer_queue(tdm_layer *layer);
/**
* @brief Check wheter a layer object is available for a frontend user to use.
* @param[out] usable 1 if usable, 0 if not usable
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
+tdm_error
+tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable);
/**
* @brief Set the relative zpos to a VIDEO layer object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_layer_get_zpos, tdm_layer_capability
*/
-tdm_error tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
+tdm_error
+tdm_layer_set_video_pos(tdm_layer *layer, int zpos);
/**
* @brief Create a capture object of a layer object
* @return A capture object
* @see tdm_capture_destroy
*/
-tdm_capture *tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
+tdm_capture *
+tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
/**
* @brief Destroy a pp object
* @param[in] pp A pp object
* @see tdm_display_create_pp
*/
-void tdm_pp_destroy(tdm_pp *pp);
+void
+tdm_pp_destroy(tdm_pp *pp);
/**
* @brief Set the geometry information to a pp object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_pp_commit
*/
-tdm_error tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
+tdm_error
+tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
/**
* @brief Attach a source buffer and a destination buffer to a pp object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_pp_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
*/
-tdm_error tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
+tdm_error
+tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
/**
* @brief Commit changes for a pp object
* @param[in] pp A pp object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_pp_commit(tdm_pp *pp);
+tdm_error
+tdm_pp_commit(tdm_pp *pp);
/**
* @brief Destroy a capture object
* @param[in] capture A capture object
* @see tdm_output_create_capture, tdm_layer_create_capture
*/
-void tdm_capture_destroy(tdm_capture *capture);
+void
+tdm_capture_destroy(tdm_capture *capture);
/**
* @brief Set the geometry information to a capture object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_capture_commit
*/
-tdm_error tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
+tdm_error
+tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info);
/**
* @brief Attach a TDM buffer to a capture object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_capture_commit, tdm_buffer_add_release_handler, tdm_buffer_release_handler
*/
-tdm_error tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
+tdm_error
+tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer);
/**
* @brief Commit changes for a capture object
* @param[in] capture A capture object
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
*/
-tdm_error tdm_capture_commit(tdm_capture *capture);
+tdm_error
+tdm_capture_commit(tdm_capture *capture);
/**
* @brief The release handler of a TDM buffer
* @param[in] user_data user data
* @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
*/
-typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer, void *user_data);
+typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
+ void *user_data);
/**
* @brief Add a release handler to a TDM buffer
* @return #TDM_ERROR_NONE if success. Otherwise, error value.
* @see tdm_buffer_remove_release_handler
*/
-tdm_error tdm_buffer_add_release_handler(tbm_surface_h buffer, tdm_buffer_release_handler func, void *user_data);
+tdm_error
+tdm_buffer_add_release_handler(tbm_surface_h buffer,
+ tdm_buffer_release_handler func, void *user_data);
/**
* @brief Remove a release handler from a TDM buffer
* @param[in] user_data user data
* @see tdm_buffer_add_release_handler
*/
-void tdm_buffer_remove_release_handler(tbm_surface_h buffer, tdm_buffer_release_handler func, void *user_data);
+void
+tdm_buffer_remove_release_handler(tbm_surface_h buffer,
+ tdm_buffer_release_handler func, void *user_data);
#ifdef __cplusplus
}
* @brief The display capabilities structure of a backend module
* @see The display_get_capabilitiy() function of #tdm_func_display
*/
-typedef struct _tdm_caps_display
-{
- int max_layer_count; /**< The maximum layer count. -1 means "not defined" */
+typedef struct _tdm_caps_display {
+ int max_layer_count; /**< The maximum layer count. -1 means "not defined" */
} tdm_caps_display;
/**
* @brief The capabilities structure of a output object
* @see The output_get_capability() function of #tdm_func_display
*/
-typedef struct _tdm_caps_output
-{
- char maker[TDM_NAME_LEN]; /**< The output maker */
- char model[TDM_NAME_LEN]; /**< The output model */
- char name[TDM_NAME_LEN]; /**< The output name */
-
- tdm_output_conn_status status; /**< The connection status */
- tdm_output_type type; /**< The connection type */
- unsigned int type_id; /**< The connection type id */
-
- unsigned int mode_count; /**< The count of available modes */
- tdm_output_mode *modes; /**< The @b newly-allocated array of modes. will be freed in frontend. */
-
- unsigned int prop_count; /**< The count of available properties */
- tdm_prop *props; /**< The @b newly-allocated array of properties. will be freed in frontend. */
-
- unsigned int mmWidth; /**< The physical width (milimeter) */
- unsigned int mmHeight; /**< The physical height (milimeter) */
- unsigned int subpixel; /**< The subpixel */
-
- int min_w; /**< The minimun width. -1 means "not defined" */
- int min_h; /**< The minimun height. -1 means "not defined" */
- int max_w; /**< The maximum width. -1 means "not defined" */
- int max_h; /**< The maximum height. -1 means "not defined" */
- int preferred_align; /**< The prefered align. -1 means "not defined" */
+typedef struct _tdm_caps_output {
+ char maker[TDM_NAME_LEN]; /**< The output maker */
+ char model[TDM_NAME_LEN]; /**< The output model */
+ char name[TDM_NAME_LEN]; /**< The output name */
+
+ tdm_output_conn_status status; /**< The connection status */
+ tdm_output_type type; /**< The connection type */
+ unsigned int type_id; /**< The connection type id */
+
+ unsigned int mode_count; /**< The count of available modes */
+ tdm_output_mode
+ *modes; /**< The @b newly-allocated array of modes. will be freed in frontend. */
+
+ unsigned int prop_count; /**< The count of available properties */
+ tdm_prop *props; /**< The @b newly-allocated array of properties. will be freed in frontend. */
+
+ unsigned int mmWidth; /**< The physical width (milimeter) */
+ unsigned int mmHeight; /**< The physical height (milimeter) */
+ unsigned int subpixel; /**< The subpixel */
+
+ int min_w; /**< The minimun width. -1 means "not defined" */
+ int min_h; /**< The minimun height. -1 means "not defined" */
+ int max_w; /**< The maximum width. -1 means "not defined" */
+ int max_h; /**< The maximum height. -1 means "not defined" */
+ int preferred_align; /**< The prefered align. -1 means "not defined" */
} tdm_caps_output;
/**
* @brief The capabilities structure of a layer object
* @see The layer_get_capability() function of #tdm_func_display
*/
-typedef struct _tdm_caps_layer
-{
- tdm_layer_capability capabilities; /**< The capabilities of layer */
-
- /**
- * The z-order
- * GRAPHIC layers are non-changeable. The zpos of GRAPHIC layers starts
- * from 0. If there are 4 GRAPHIC layers, The zpos SHOULD be 0, 1, 2, 3.\n
- * But the zpos of VIDEO layer is changeable by layer_set_video_pos() function
- * of #tdm_func_display. And The zpos of VIDEO layers is less than GRAPHIC
- * layers or more than GRAPHIC layers.
- * ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
- * The zpos of VIDEO layers is @b relative. It doesn't need to start
- * from -1 or 4. Let's suppose that there are two VIDEO layers.
- * One has -2 zpos. Another has -4 zpos. Then -2 Video layer is higher
- * than -4 VIDEO layer.
- */
- int zpos;
-
- unsigned int format_count; /**< The count of available formats */
- tbm_format *formats; /**< The @b newly-allocated array of formats. will be freed in frontend. */
-
- unsigned int prop_count; /**< The count of available properties */
- tdm_prop *props; /**< The @b newly-allocated array of properties. will be freed in frontend. */
+typedef struct _tdm_caps_layer {
+ tdm_layer_capability capabilities; /**< The capabilities of layer */
+
+ /**
+ * The z-order
+ * GRAPHIC layers are non-changeable. The zpos of GRAPHIC layers starts
+ * from 0. If there are 4 GRAPHIC layers, The zpos SHOULD be 0, 1, 2, 3.\n
+ * But the zpos of VIDEO layer is changeable by layer_set_video_pos() function
+ * of #tdm_func_display. And The zpos of VIDEO layers is less than GRAPHIC
+ * layers or more than GRAPHIC layers.
+ * ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
+ * The zpos of VIDEO layers is @b relative. It doesn't need to start
+ * from -1 or 4. Let's suppose that there are two VIDEO layers.
+ * One has -2 zpos. Another has -4 zpos. Then -2 Video layer is higher
+ * than -4 VIDEO layer.
+ */
+ int zpos;
+
+ unsigned int format_count; /**< The count of available formats */
+ tbm_format
+ *formats; /**< The @b newly-allocated array of formats. will be freed in frontend. */
+
+ unsigned int prop_count; /**< The count of available properties */
+ tdm_prop *props; /**< The @b newly-allocated array of properties. will be freed in frontend. */
} tdm_caps_layer;
/**
* @brief The capabilities structure of a pp object
* @see The display_get_pp_capability() function of #tdm_func_display
*/
-typedef struct _tdm_caps_pp
-{
- tdm_pp_capability capabilities; /**< The capabilities of pp */
-
- unsigned int format_count; /**< The count of available formats */
- tbm_format *formats; /**< The @b newly-allocated array. will be freed in frontend. */
-
- int min_w; /**< The minimun width. -1 means "not defined" */
- int min_h; /**< The minimun height. -1 means "not defined" */
- int max_w; /**< The maximum width. -1 means "not defined" */
- int max_h; /**< The maximum height. -1 means "not defined" */
- int preferred_align; /**< The prefered align. -1 means "not defined" */
+typedef struct _tdm_caps_pp {
+ tdm_pp_capability capabilities; /**< The capabilities of pp */
+
+ unsigned int format_count; /**< The count of available formats */
+ tbm_format
+ *formats; /**< The @b newly-allocated array. will be freed in frontend. */
+
+ int min_w; /**< The minimun width. -1 means "not defined" */
+ int min_h; /**< The minimun height. -1 means "not defined" */
+ int max_w; /**< The maximum width. -1 means "not defined" */
+ int max_h; /**< The maximum height. -1 means "not defined" */
+ int preferred_align; /**< The prefered align. -1 means "not defined" */
} tdm_caps_pp;
/**
* @brief The capabilities structure of a capture object
* @see The display_get_capture_capability() function of #tdm_func_display
*/
-typedef struct _tdm_caps_capture
-{
- tdm_capture_capability capabilities; /**< The capabilities of capture */
-
- unsigned int format_count; /**< The count of available formats */
- tbm_format *formats; /**< The @b newly-allocated array of formats. will be freed in frontend. */
-
- int min_w; /**< The minimun width. -1 means "not defined" */
- int min_h; /**< The minimun height. -1 means "not defined" */
- int max_w; /**< The maximum width. -1 means "not defined" */
- int max_h; /**< The maximum height. -1 means "not defined" */
- int preferred_align; /**< The prefered align. -1 means "not defined" */
+typedef struct _tdm_caps_capture {
+ tdm_capture_capability capabilities; /**< The capabilities of capture */
+
+ unsigned int format_count; /**< The count of available formats */
+ tbm_format
+ *formats; /**< The @b newly-allocated array of formats. will be freed in frontend. */
+
+ int min_w; /**< The minimun width. -1 means "not defined" */
+ int min_h; /**< The minimun height. -1 means "not defined" */
+ int max_w; /**< The maximum width. -1 means "not defined" */
+ int max_h; /**< The maximum height. -1 means "not defined" */
+ int preferred_align; /**< The prefered align. -1 means "not defined" */
} tdm_caps_capture;
/**
* @brief The display functions for a backend module.
*/
-typedef struct _tdm_func_display
-{
- /**
- * @brief Get the display capabilities of a backend module
- * @param[in] bdata The backend module data
- * @param[out] caps The display capabilities of a backend module
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD implement this function. TDM calls this function
- * not only at the initial time, but also at the update time when new output
- * is connected.\n
- * If a hardware has the restriction of the number of max usable layer count,
- * a backend module can set the max count to max_layer_count of #tdm_caps_display
- * structure. Otherwise, set -1.
- */
- tdm_error (*display_get_capabilitiy)(tdm_backend_data *bdata, tdm_caps_display *caps);
-
- /**
- * @brief Get the pp capabilities of a backend module
- * @param[in] bdata The backend module data
- * @param[out] caps The pp capabilities of a backend module
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see tdm_backend_register_func_pp
- * @remark
- * TDM calls this function not only at the initial time, but also at the update
- * time when new output is connected.\n
- * A backend module doesn't need to implement this function if a hardware
- * doesn't have the memory-to-memory converting device. Otherwise, a backend module
- * @b SHOULD fill the #tdm_caps_pp data. #tdm_caps_pp contains the hardware
- * restriction information which a converting device can handle. ie, format, size, etc.
- */
- tdm_error (*display_get_pp_capability)(tdm_backend_data *bdata, tdm_caps_pp *caps);
-
- /**
- * @brief Get the capture capabilities of a backend module
- * @param[in] bdata The backend module data
- * @param[out] caps The capture capabilities of a backend module
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see tdm_backend_register_func_capture
- * @remark
- * TDM calls this function not only at the initial time, but also at the update
- * time when new output is connected.\n
- * A backend module doesn't need to implement this function if a hardware
- * doesn't have the capture device. Otherwise, a backend module @b SHOULD fill the
- * #tdm_caps_capture data. #tdm_caps_capture contains the hardware restriction
- * information which a capture device can handle. ie, format, size, etc.
- */
- tdm_error (*display_get_capture_capability)(tdm_backend_data *bdata, tdm_caps_capture *caps);
-
- /**
- * @brief Get a output array of a backend module
- * @param[in] bdata The backend module data
- * @param[out] count The count of outputs
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return A output array which is @b newly-allocated
- * @see tdm_backend_register_func_capture
- * @remark
- * A backend module @b SHOULD implement this function. TDM calls this function
- * not only at the initial time, but also at the update time when new output
- * is connected.\n
- * A backend module @b SHOULD return the @b newly-allocated array which contains
- * "tdm_output*" data. It will be freed in frontend.
- * @par Example
- * @code
- tdm_output**
- drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error)
- {
- tdm_drm_data *drm_data = bdata;
- tdm_drm_output_data *output_data = NULL;
- tdm_output **outputs;
- int i;
-
- (*count) = 0;
- LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link)
- (*count)++;
-
- if ((*count) == 0)
- {
- if (error) *error = TDM_ERROR_NONE;
- return NULL;
- }
-
- // will be freed in frontend
- outputs = calloc(*count, sizeof(tdm_drm_output_data*));
- if (!outputs)
- {
- (*count) = 0;
- if (error) *error = TDM_ERROR_OUT_OF_MEMORY;
- return NULL;
- }
-
- i = 0;
- LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link)
- outputs[i++] = output_data;
-
- if (error) *error = TDM_ERROR_NONE;
-
- return outputs;
- }
- * @endcode
- */
- tdm_output **(*display_get_outputs)(tdm_backend_data *bdata, int *count, tdm_error *error);
-
- /**
- * @brief Get the file descriptor of a backend module
- * @param[in] bdata The backend module data
- * @param[out] fd The fd of a backend module
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see display_handle_events() function of #tdm_func_display
- * @remark
- * A backend module can return epoll's fd which is watching the backend device one more fds.
- */
- tdm_error (*display_get_fd)(tdm_backend_data *bdata, int *fd);
-
- /**
- * @brief Get the file descriptor for the memory-management framework of a backend module
- * @param[in] bdata The backend module data
- * @param[out] fd The fd of a backend module
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see display_handle_events() function of #tdm_func_display
- * This buffer fd will be passed to tbm_bufmgr_init.
- */
- tdm_error (*display_get_buffer_fd)(tdm_backend_data *bdata, int *fd);
-
- /**
- * @brief Handle the events which happens on the fd of a backend module
- * @param[in] bdata The backend module data
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*display_handle_events)(tdm_backend_data *bdata);
-
- /**
- * @brief Create a pp object of a backend module
- * @param[in] bdata The backend module data
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return A pp object
- * @see pp_destroy() function of #tdm_func_pp
- * @remark
- * A backend module doesn't need to implement this function if a hardware
- * doesn't have the memory-to-memory converting device.
- */
- tdm_pp* (*display_create_pp)(tdm_backend_data *bdata, tdm_error *error);
-
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
- void (*reserved7)(void);
- void (*reserved8)(void);
+typedef struct _tdm_func_display {
+ /**
+ * @brief Get the display capabilities of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] caps The display capabilities of a backend module
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD implement this function. TDM calls this function
+ * not only at the initial time, but also at the update time when new output
+ * is connected.\n
+ * If a hardware has the restriction of the number of max usable layer count,
+ * a backend module can set the max count to max_layer_count of #tdm_caps_display
+ * structure. Otherwise, set -1.
+ */
+ tdm_error (*display_get_capabilitiy)(tdm_backend_data *bdata,
+ tdm_caps_display *caps);
+
+ /**
+ * @brief Get the pp capabilities of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] caps The pp capabilities of a backend module
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see tdm_backend_register_func_pp
+ * @remark
+ * TDM calls this function not only at the initial time, but also at the update
+ * time when new output is connected.\n
+ * A backend module doesn't need to implement this function if a hardware
+ * doesn't have the memory-to-memory converting device. Otherwise, a backend module
+ * @b SHOULD fill the #tdm_caps_pp data. #tdm_caps_pp contains the hardware
+ * restriction information which a converting device can handle. ie, format, size, etc.
+ */
+ tdm_error (*display_get_pp_capability)(tdm_backend_data *bdata,
+ tdm_caps_pp *caps);
+
+ /**
+ * @brief Get the capture capabilities of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] caps The capture capabilities of a backend module
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see tdm_backend_register_func_capture
+ * @remark
+ * TDM calls this function not only at the initial time, but also at the update
+ * time when new output is connected.\n
+ * A backend module doesn't need to implement this function if a hardware
+ * doesn't have the capture device. Otherwise, a backend module @b SHOULD fill the
+ * #tdm_caps_capture data. #tdm_caps_capture contains the hardware restriction
+ * information which a capture device can handle. ie, format, size, etc.
+ */
+ tdm_error (*display_get_capture_capability)(tdm_backend_data *bdata,
+ tdm_caps_capture *caps);
+
+ /**
+ * @brief Get a output array of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] count The count of outputs
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A output array which is @b newly-allocated
+ * @see tdm_backend_register_func_capture
+ * @remark
+ * A backend module @b SHOULD implement this function. TDM calls this function
+ * not only at the initial time, but also at the update time when new output
+ * is connected.\n
+ * A backend module @b SHOULD return the @b newly-allocated array which contains
+ * "tdm_output*" data. It will be freed in frontend.
+ * @par Example
+ * @code
+ tdm_output**
+ drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error)
+ {
+ tdm_drm_data *drm_data = bdata;
+ tdm_drm_output_data *output_data = NULL;
+ tdm_output **outputs;
+ int i;
+
+ (*count) = 0;
+ LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link)
+ (*count)++;
+
+ if ((*count) == 0)
+ {
+ if (error) *error = TDM_ERROR_NONE;
+ return NULL;
+ }
+
+ // will be freed in frontend
+ outputs = calloc(*count, sizeof(tdm_drm_output_data*));
+ if (!outputs)
+ {
+ (*count) = 0;
+ if (error) *error = TDM_ERROR_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ i = 0;
+ LIST_FOR_EACH_ENTRY(output_data, &drm_data->output_list, link)
+ outputs[i++] = output_data;
+
+ if (error) *error = TDM_ERROR_NONE;
+
+ return outputs;
+ }
+ * @endcode
+ */
+ tdm_output **(*display_get_outputs)(tdm_backend_data *bdata, int *count,
+ tdm_error *error);
+
+ /**
+ * @brief Get the file descriptor of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] fd The fd of a backend module
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see display_handle_events() function of #tdm_func_display
+ * @remark
+ * A backend module can return epoll's fd which is watching the backend device one more fds.
+ */
+ tdm_error (*display_get_fd)(tdm_backend_data *bdata, int *fd);
+
+ /**
+ * @brief Get the file descriptor for the memory-management framework of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] fd The fd of a backend module
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see display_handle_events() function of #tdm_func_display
+ * This buffer fd will be passed to tbm_bufmgr_init.
+ */
+ tdm_error (*display_get_buffer_fd)(tdm_backend_data *bdata, int *fd);
+
+ /**
+ * @brief Handle the events which happens on the fd of a backend module
+ * @param[in] bdata The backend module data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*display_handle_events)(tdm_backend_data *bdata);
+
+ /**
+ * @brief Create a pp object of a backend module
+ * @param[in] bdata The backend module data
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A pp object
+ * @see pp_destroy() function of #tdm_func_pp
+ * @remark
+ * A backend module doesn't need to implement this function if a hardware
+ * doesn't have the memory-to-memory converting device.
+ */
+ tdm_pp *(*display_create_pp)(tdm_backend_data *bdata, tdm_error *error);
+
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ void (*reserved8)(void);
} tdm_func_display;
/**
* @brief The output functions for a backend module.
*/
-typedef struct _tdm_func_output
-{
- /**
- * @brief Get the capabilities of a output object
- * @param[in] output A output object
- * @param[out] caps The capabilities of a output object
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD implement this function. TDM calls this function
- * not only at the initial time, but also at the update time when new output
- * is connected.\n
- * #tdm_caps_output contains connection status, modes, avaiable properties,
- * size restriction information, etc.
- */
- tdm_error (*output_get_capability)(tdm_output *output, tdm_caps_output *caps);
-
- /**
- * @brief Get a layer array of a output object
- * @param[in] output A output object
- * @param[out] count The count of layers
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return A layer array which is @b newly-allocated
- * @remark
- * A backend module @b SHOULD implement this function. TDM calls this function
- * not only at the initial time, but also at the update time when new output
- * is connected.\n
- * A backend module @b SHOULD return the @b newly-allocated array which contains
- * "tdm_layer*" data. It will be freed in frontend.
- */
- tdm_layer **(*output_get_layers)(tdm_output *output, int *count, tdm_error *error);
-
- /**
- * @brief Set the property which has a given id
- * @param[in] output A output object
- * @param[in] id The property id
- * @param[in] value The value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_set_property)(tdm_output *output, unsigned int id, tdm_value value);
-
- /**
- * @brief Get the property which has a given id
- * @param[in] output A output object
- * @param[in] id The property id
- * @param[out] value The value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_get_property)(tdm_output *output, unsigned int id, tdm_value *value);
-
- /**
- * @brief Wait for VBLANK
- * @param[in] output A output object
- * @param[in] interval vblank interval
- * @param[in] sync 0: asynchronous, 1:synchronous
- * @param[in] user_data The user data
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see output_set_vblank_handler, tdm_output_vblank_handler
- * @remark
- * A backend module @b SHOULD call a user vblank handler after interval vblanks.
- */
- tdm_error (*output_wait_vblank)(tdm_output *output, int interval, int sync, void *user_data);
-
- /**
- * @brief Set a user vblank handler
- * @param[in] output A output object
- * @param[in] func A user vblank handler
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_set_vblank_handler)(tdm_output *output, tdm_output_vblank_handler func);
-
- /**
- * @brief Commit changes for a output object
- * @param[in] output A output object
- * @param[in] sync 0: asynchronous, 1:synchronous
- * @param[in] user_data The user data
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see output_set_commit_handler, tdm_output_commit_handler
- * @remark
- * A backend module @b SHOULD call a user commit handler after all change of
- * a output object are applied.
- */
- tdm_error (*output_commit)(tdm_output *output, int sync, void *user_data);
-
- /**
- * @brief Set a user commit handler
- * @param[in] output A output object
- * @param[in] func A user commit handler
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_set_commit_handler)(tdm_output *output, tdm_output_commit_handler func);
-
- /**
- * @brief Set DPMS of a output object
- * @param[in] output A output object
- * @param[in] dpms_value DPMS value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_set_dpms)(tdm_output *output, tdm_output_dpms dpms_value);
-
- /**
- * @brief Get DPMS of a output object
- * @param[in] output A output object
- * @param[out] dpms_value DPMS value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_get_dpms)(tdm_output *output, tdm_output_dpms *dpms_value);
-
- /**
- * @brief Set one of available modes of a output object
- * @param[in] output A output object
- * @param[in] mode A output mode
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_set_mode)(tdm_output *output, const tdm_output_mode *mode);
-
- /**
- * @brief Get the mode of a output object
- * @param[in] output A output object
- * @param[out] mode A output mode
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*output_get_mode)(tdm_output *output, const tdm_output_mode **mode);
-
- /**
- * @brief Create a capture object of a output object
- * @param[in] output A output object
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return A capture object
- * @see capture_destroy() function of #tdm_func_capture
- * @remark
- * A backend module doesn't need to implement this function if a hardware
- * doesn't have the capture device.
- */
- tdm_capture *(*output_create_capture)(tdm_output *output, tdm_error *error);
-
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
- void (*reserved7)(void);
- void (*reserved8)(void);
+typedef struct _tdm_func_output {
+ /**
+ * @brief Get the capabilities of a output object
+ * @param[in] output A output object
+ * @param[out] caps The capabilities of a output object
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD implement this function. TDM calls this function
+ * not only at the initial time, but also at the update time when new output
+ * is connected.\n
+ * #tdm_caps_output contains connection status, modes, avaiable properties,
+ * size restriction information, etc.
+ */
+ tdm_error (*output_get_capability)(tdm_output *output, tdm_caps_output *caps);
+
+ /**
+ * @brief Get a layer array of a output object
+ * @param[in] output A output object
+ * @param[out] count The count of layers
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A layer array which is @b newly-allocated
+ * @remark
+ * A backend module @b SHOULD implement this function. TDM calls this function
+ * not only at the initial time, but also at the update time when new output
+ * is connected.\n
+ * A backend module @b SHOULD return the @b newly-allocated array which contains
+ * "tdm_layer*" data. It will be freed in frontend.
+ */
+ tdm_layer **(*output_get_layers)(tdm_output *output, int *count,
+ tdm_error *error);
+
+ /**
+ * @brief Set the property which has a given id
+ * @param[in] output A output object
+ * @param[in] id The property id
+ * @param[in] value The value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_set_property)(tdm_output *output, unsigned int id,
+ tdm_value value);
+
+ /**
+ * @brief Get the property which has a given id
+ * @param[in] output A output object
+ * @param[in] id The property id
+ * @param[out] value The value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_get_property)(tdm_output *output, unsigned int id,
+ tdm_value *value);
+
+ /**
+ * @brief Wait for VBLANK
+ * @param[in] output A output object
+ * @param[in] interval vblank interval
+ * @param[in] sync 0: asynchronous, 1:synchronous
+ * @param[in] user_data The user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see output_set_vblank_handler, tdm_output_vblank_handler
+ * @remark
+ * A backend module @b SHOULD call a user vblank handler after interval vblanks.
+ */
+ tdm_error (*output_wait_vblank)(tdm_output *output, int interval, int sync,
+ void *user_data);
+
+ /**
+ * @brief Set a user vblank handler
+ * @param[in] output A output object
+ * @param[in] func A user vblank handler
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_set_vblank_handler)(tdm_output *output,
+ tdm_output_vblank_handler func);
+
+ /**
+ * @brief Commit changes for a output object
+ * @param[in] output A output object
+ * @param[in] sync 0: asynchronous, 1:synchronous
+ * @param[in] user_data The user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see output_set_commit_handler, tdm_output_commit_handler
+ * @remark
+ * A backend module @b SHOULD call a user commit handler after all change of
+ * a output object are applied.
+ */
+ tdm_error (*output_commit)(tdm_output *output, int sync, void *user_data);
+
+ /**
+ * @brief Set a user commit handler
+ * @param[in] output A output object
+ * @param[in] func A user commit handler
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_set_commit_handler)(tdm_output *output,
+ tdm_output_commit_handler func);
+
+ /**
+ * @brief Set DPMS of a output object
+ * @param[in] output A output object
+ * @param[in] dpms_value DPMS value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_set_dpms)(tdm_output *output, tdm_output_dpms dpms_value);
+
+ /**
+ * @brief Get DPMS of a output object
+ * @param[in] output A output object
+ * @param[out] dpms_value DPMS value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_get_dpms)(tdm_output *output, tdm_output_dpms *dpms_value);
+
+ /**
+ * @brief Set one of available modes of a output object
+ * @param[in] output A output object
+ * @param[in] mode A output mode
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_set_mode)(tdm_output *output, const tdm_output_mode *mode);
+
+ /**
+ * @brief Get the mode of a output object
+ * @param[in] output A output object
+ * @param[out] mode A output mode
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*output_get_mode)(tdm_output *output, const tdm_output_mode **mode);
+
+ /**
+ * @brief Create a capture object of a output object
+ * @param[in] output A output object
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A capture object
+ * @see capture_destroy() function of #tdm_func_capture
+ * @remark
+ * A backend module doesn't need to implement this function if a hardware
+ * doesn't have the capture device.
+ */
+ tdm_capture *(*output_create_capture)(tdm_output *output, tdm_error *error);
+
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ void (*reserved8)(void);
} tdm_func_output;
/**
* @brief The layer functions for a backend module.
*/
-typedef struct _tdm_func_layer
-{
- /**
- * @brief Get the capabilities of a layer object
- * @param[in] layer A layer object
- * @param[out] caps The capabilities of a layer object
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD implement this function. TDM calls this function
- * not only at the initial time, but also at the update time when new output
- * is connected.\n
- * #tdm_caps_layer contains avaiable formats/properties, zpos information, etc.
- */
- tdm_error (*layer_get_capability)(tdm_layer *layer, tdm_caps_layer *caps);
-
- /**
- * @brief Set the property which has a given id.
- * @param[in] layer A layer object
- * @param[in] id The property id
- * @param[in] value The value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*layer_set_property)(tdm_layer *layer, unsigned int id, tdm_value value);
-
- /**
- * @brief Get the property which has a given id.
- * @param[in] layer A layer object
- * @param[in] id The property id
- * @param[out] value The value
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*layer_get_property)(tdm_layer *layer, unsigned int id, tdm_value *value);
-
- /**
- * @brief Set the geometry information to a layer object
- * @param[in] layer A layer object
- * @param[in] info The geometry information
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see output_commit() function of #tdm_func_display
- * @remark
- * A backend module would apply the geometry information when the output object
- * of a layer object is committed.
- */
- tdm_error (*layer_set_info)(tdm_layer *layer, tdm_info_layer *info);
-
- /**
- * @brief Get the geometry information to a layer object
- * @param[in] layer A layer object
- * @param[out] info The geometry information
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*layer_get_info)(tdm_layer *layer, tdm_info_layer *info);
-
- /**
- * @brief Set a TDM buffer to a layer object
- * @param[in] layer A layer object
- * @param[in] buffer A TDM buffer
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see output_commit() function of #tdm_func_display
- * @remark
- * A backend module would apply a TDM buffer when the output object
- * of a layer object is committed.
- */
- tdm_error (*layer_set_buffer)(tdm_layer *layer, tbm_surface_h buffer);
-
- /**
- * @brief Unset a TDM buffer from a layer object
- * @param[in] layer A layer object
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD hide the current showing buffer from screen.
- * If needed, cleanup a layer object resource.
- */
- tdm_error (*layer_unset_buffer)(tdm_layer *layer);
-
- /**
- * @brief Set the zpos for a VIDEO layer object
- * @param[in] layer A layer object
- * @param[in] zpos z-order
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see tdm_caps_layer, tdm_layer_capability
- * @remark
- * A backend module doesn't need to implement this function if a backend
- * module doesn't have VIDEO layers.\n
- * This function is for VIDEO layers.
- * GRAPHIC layers are non-changeable. The zpos of GRAPHIC layers starts
- * from 0. If there are 4 GRAPHIC layers, The zpos SHOULD be 0, 1, 2, 3.\n
- * But the zpos of VIDEO layer is changeable. And The zpos of VIDEO layers
- * is less than GRAPHIC layers or more than GRAPHIC layers.
- * ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
- * The zpos of VIDEO layers is @b relative. It doesn't need to start
- * from -1 or 4. Let's suppose that there are two VIDEO layers.
- * One has -2 zpos. Another has -4 zpos. Then -2 Video layer is higher
- * than -4 VIDEO layer.
- */
- tdm_error (*layer_set_video_pos)(tdm_layer *layer, int zpos);
-
- /**
- * @brief Create a capture object of a layer object
- * @param[in] output A output object
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return A capture object
- * @see capture_destroy() function of #tdm_func_capture
- * @remark
- * A backend module doesn't need to implement this function if a hardware
- * doesn't have the capture device.
- */
- tdm_capture *(*layer_create_capture)(tdm_layer *layer, tdm_error *error);
-
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
- void (*reserved7)(void);
- void (*reserved8)(void);
+typedef struct _tdm_func_layer {
+ /**
+ * @brief Get the capabilities of a layer object
+ * @param[in] layer A layer object
+ * @param[out] caps The capabilities of a layer object
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD implement this function. TDM calls this function
+ * not only at the initial time, but also at the update time when new output
+ * is connected.\n
+ * #tdm_caps_layer contains avaiable formats/properties, zpos information, etc.
+ */
+ tdm_error (*layer_get_capability)(tdm_layer *layer, tdm_caps_layer *caps);
+
+ /**
+ * @brief Set the property which has a given id.
+ * @param[in] layer A layer object
+ * @param[in] id The property id
+ * @param[in] value The value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*layer_set_property)(tdm_layer *layer, unsigned int id,
+ tdm_value value);
+
+ /**
+ * @brief Get the property which has a given id.
+ * @param[in] layer A layer object
+ * @param[in] id The property id
+ * @param[out] value The value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*layer_get_property)(tdm_layer *layer, unsigned int id,
+ tdm_value *value);
+
+ /**
+ * @brief Set the geometry information to a layer object
+ * @param[in] layer A layer object
+ * @param[in] info The geometry information
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see output_commit() function of #tdm_func_display
+ * @remark
+ * A backend module would apply the geometry information when the output object
+ * of a layer object is committed.
+ */
+ tdm_error (*layer_set_info)(tdm_layer *layer, tdm_info_layer *info);
+
+ /**
+ * @brief Get the geometry information to a layer object
+ * @param[in] layer A layer object
+ * @param[out] info The geometry information
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*layer_get_info)(tdm_layer *layer, tdm_info_layer *info);
+
+ /**
+ * @brief Set a TDM buffer to a layer object
+ * @param[in] layer A layer object
+ * @param[in] buffer A TDM buffer
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see output_commit() function of #tdm_func_display
+ * @remark
+ * A backend module would apply a TDM buffer when the output object
+ * of a layer object is committed.
+ */
+ tdm_error (*layer_set_buffer)(tdm_layer *layer, tbm_surface_h buffer);
+
+ /**
+ * @brief Unset a TDM buffer from a layer object
+ * @param[in] layer A layer object
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD hide the current showing buffer from screen.
+ * If needed, cleanup a layer object resource.
+ */
+ tdm_error (*layer_unset_buffer)(tdm_layer *layer);
+
+ /**
+ * @brief Set the zpos for a VIDEO layer object
+ * @param[in] layer A layer object
+ * @param[in] zpos z-order
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see tdm_caps_layer, tdm_layer_capability
+ * @remark
+ * A backend module doesn't need to implement this function if a backend
+ * module doesn't have VIDEO layers.\n
+ * This function is for VIDEO layers.
+ * GRAPHIC layers are non-changeable. The zpos of GRAPHIC layers starts
+ * from 0. If there are 4 GRAPHIC layers, The zpos SHOULD be 0, 1, 2, 3.\n
+ * But the zpos of VIDEO layer is changeable. And The zpos of VIDEO layers
+ * is less than GRAPHIC layers or more than GRAPHIC layers.
+ * ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
+ * The zpos of VIDEO layers is @b relative. It doesn't need to start
+ * from -1 or 4. Let's suppose that there are two VIDEO layers.
+ * One has -2 zpos. Another has -4 zpos. Then -2 Video layer is higher
+ * than -4 VIDEO layer.
+ */
+ tdm_error (*layer_set_video_pos)(tdm_layer *layer, int zpos);
+
+ /**
+ * @brief Create a capture object of a layer object
+ * @param[in] output A output object
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return A capture object
+ * @see capture_destroy() function of #tdm_func_capture
+ * @remark
+ * A backend module doesn't need to implement this function if a hardware
+ * doesn't have the capture device.
+ */
+ tdm_capture *(*layer_create_capture)(tdm_layer *layer, tdm_error *error);
+
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ void (*reserved8)(void);
} tdm_func_layer;
/**
* @brief The done handler of a pp object
*/
-typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst, void *user_data);
+typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src,
+ tbm_surface_h dst, void *user_data);
/**
* @brief The pp functions for a backend module.
*/
-typedef struct _tdm_func_pp
-{
- /**
- * @brief Destroy a pp object
- * @param[in] pp A pp object
- * @see display_create_pp() function of #tdm_func_display
- */
- void (*pp_destroy)(tdm_pp *pp);
-
- /**
- * @brief Set the geometry information to a pp object
- * @param[in] pp A pp object
- * @param[in] info The geometry information
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see pp_commit() function of #tdm_func_pp
- * @remark
- * A backend module would apply the geometry information when committed.
- */
- tdm_error (*pp_set_info)(tdm_pp *pp, tdm_info_pp *info);
-
- /**
- * @brief Attach a source buffer and a destination buffer to a pp object
- * @param[in] pp A pp object
- * @param[in] src A source buffer
- * @param[in] dst A destination buffer
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see pp_set_info() function of #tdm_func_pp
- * @see pp_commit() function of #tdm_func_pp
- * @see pp_set_done_handler, tdm_pp_done_handler
- * @remark
- * A backend module converts the image of a source buffer to a destination
- * buffer when committed. The size/crop/transform information is set via
- * #pp_set_info() of #tdm_func_pp. When done, a backend module @b SHOULD
- * return the source/destination buffer via tdm_pp_done_handler.
- */
- tdm_error (*pp_attach)(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
-
- /**
- * @brief Commit changes for a pp object
- * @param[in] pp A pp object
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*pp_commit)(tdm_pp *pp);
-
- /**
- * @brief Set a user done handler to a pp object
- * @param[in] pp A pp object
- * @param[in] func A user done handler
- * @param[in] user_data user data
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD call #tdm_pp_done_handler when converintg a image is done.
- */
- tdm_error (*pp_set_done_handler)(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
-
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
- void (*reserved7)(void);
- void (*reserved8)(void);
+typedef struct _tdm_func_pp {
+ /**
+ * @brief Destroy a pp object
+ * @param[in] pp A pp object
+ * @see display_create_pp() function of #tdm_func_display
+ */
+ void (*pp_destroy)(tdm_pp *pp);
+
+ /**
+ * @brief Set the geometry information to a pp object
+ * @param[in] pp A pp object
+ * @param[in] info The geometry information
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see pp_commit() function of #tdm_func_pp
+ * @remark
+ * A backend module would apply the geometry information when committed.
+ */
+ tdm_error (*pp_set_info)(tdm_pp *pp, tdm_info_pp *info);
+
+ /**
+ * @brief Attach a source buffer and a destination buffer to a pp object
+ * @param[in] pp A pp object
+ * @param[in] src A source buffer
+ * @param[in] dst A destination buffer
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see pp_set_info() function of #tdm_func_pp
+ * @see pp_commit() function of #tdm_func_pp
+ * @see pp_set_done_handler, tdm_pp_done_handler
+ * @remark
+ * A backend module converts the image of a source buffer to a destination
+ * buffer when committed. The size/crop/transform information is set via
+ * #pp_set_info() of #tdm_func_pp. When done, a backend module @b SHOULD
+ * return the source/destination buffer via tdm_pp_done_handler.
+ */
+ tdm_error (*pp_attach)(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
+
+ /**
+ * @brief Commit changes for a pp object
+ * @param[in] pp A pp object
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*pp_commit)(tdm_pp *pp);
+
+ /**
+ * @brief Set a user done handler to a pp object
+ * @param[in] pp A pp object
+ * @param[in] func A user done handler
+ * @param[in] user_data user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD call #tdm_pp_done_handler when converintg a image is done.
+ */
+ tdm_error (*pp_set_done_handler)(tdm_pp *pp, tdm_pp_done_handler func,
+ void *user_data);
+
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ void (*reserved8)(void);
} tdm_func_pp;
/**
* @brief The done handler of a capture object
*/
-typedef void (*tdm_capture_done_handler)(tdm_capture *capture, tbm_surface_h buffer, void *user_data);
+typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
+ tbm_surface_h buffer, void *user_data);
/**
* @brief The capture functions for a backend module.
*/
-typedef struct _tdm_func_capture
-{
- /**
- * @brief Destroy a capture object
- * @param[in] capture A capture object
- * @see output_create_capture() function of #tdm_func_display
- * @see layer_create_capture() function of #tdm_func_display
- */
- void (*capture_destroy)(tdm_capture *capture);
-
- /**
- * @brief Set the geometry information to a capture object
- * @param[in] capture A capture object
- * @param[in] info The geometry information
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see capture_commit() function of #tdm_func_capture
- * @remark
- * A backend module would apply the geometry information when committed.
- */
- tdm_error (*capture_set_info)(tdm_capture *capture, tdm_info_capture *info);
-
- /**
- * @brief Attach a TDM buffer to a capture object
- * @details When capture_commit() function is called, a backend module dumps
- * a output or a layer to a TDM buffer.
- * @param[in] capture A capture object
- * @param[in] buffer A TDM buffer
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @see capture_set_info() function of #tdm_func_capture
- * @see capture_commit() function of #tdm_func_capture
- * @see capture_set_done_handler, tdm_capture_done_handler
- * @remark
- * A backend module dumps a output or a layer to to a TDM buffer when
- * committed. The size/crop/transform information is set via #capture_set_info()
- * of #tdm_func_capture. When done, a backend module @b SHOULD return the TDM
- * buffer via tdm_capture_done_handler.
- */
- tdm_error (*capture_attach)(tdm_capture *capture, tbm_surface_h buffer);
-
- /**
- * @brief Commit changes for a capture object
- * @param[in] capture A capture object
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- */
- tdm_error (*capture_commit)(tdm_capture *capture);
-
- /**
- * @brief Set a user done handler to a capture object
- * @param[in] capture A capture object
- * @param[in] func A user done handler
- * @param[in] user_data user data
- * @return #TDM_ERROR_NONE if success. Otherwise, error value.
- * @remark
- * A backend module @b SHOULD call #tdm_capture_done_handler when capture operation is done.
- */
- tdm_error (*capture_set_done_handler)(tdm_capture *capture, tdm_capture_done_handler func, void *user_data);
-
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
- void (*reserved7)(void);
- void (*reserved8)(void);
+typedef struct _tdm_func_capture {
+ /**
+ * @brief Destroy a capture object
+ * @param[in] capture A capture object
+ * @see output_create_capture() function of #tdm_func_display
+ * @see layer_create_capture() function of #tdm_func_display
+ */
+ void (*capture_destroy)(tdm_capture *capture);
+
+ /**
+ * @brief Set the geometry information to a capture object
+ * @param[in] capture A capture object
+ * @param[in] info The geometry information
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see capture_commit() function of #tdm_func_capture
+ * @remark
+ * A backend module would apply the geometry information when committed.
+ */
+ tdm_error (*capture_set_info)(tdm_capture *capture, tdm_info_capture *info);
+
+ /**
+ * @brief Attach a TDM buffer to a capture object
+ * @details When capture_commit() function is called, a backend module dumps
+ * a output or a layer to a TDM buffer.
+ * @param[in] capture A capture object
+ * @param[in] buffer A TDM buffer
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see capture_set_info() function of #tdm_func_capture
+ * @see capture_commit() function of #tdm_func_capture
+ * @see capture_set_done_handler, tdm_capture_done_handler
+ * @remark
+ * A backend module dumps a output or a layer to to a TDM buffer when
+ * committed. The size/crop/transform information is set via #capture_set_info()
+ * of #tdm_func_capture. When done, a backend module @b SHOULD return the TDM
+ * buffer via tdm_capture_done_handler.
+ */
+ tdm_error (*capture_attach)(tdm_capture *capture, tbm_surface_h buffer);
+
+ /**
+ * @brief Commit changes for a capture object
+ * @param[in] capture A capture object
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tdm_error (*capture_commit)(tdm_capture *capture);
+
+ /**
+ * @brief Set a user done handler to a capture object
+ * @param[in] capture A capture object
+ * @param[in] func A user done handler
+ * @param[in] user_data user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @remark
+ * A backend module @b SHOULD call #tdm_capture_done_handler when capture operation is done.
+ */
+ tdm_error (*capture_set_done_handler)(tdm_capture *capture,
+ tdm_capture_done_handler func, void *user_data);
+
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+ void (*reserved7)(void);
+ void (*reserved8)(void);
} tdm_func_capture;
/*
* @b "tdm_backend_module_data". TDM will read this symbol, @b "tdm_backend_module_data",
* at the initial time and call init() function of #tdm_backend_module.
*/
-typedef struct _tdm_backend_module
-{
- const char *name; /**< The module name of a backend module */
- const char *vendor; /**< The vendor name of a backend module */
- unsigned long abi_version; /**< The ABI version of a backend module */
-
- /**
- * @brief The init function of a backend module
- * @param[in] dpy A display object
- * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
- * @return The backend module data
- * @see tdm_backend_data
- */
- tdm_backend_data* (*init)(tdm_display *dpy, tdm_error *error);
-
- /**
- * @brief The deinit function of a backend module
- * @param[in] bdata The backend module data
- */
- void (*deinit)(tdm_backend_data *bdata);
+typedef struct _tdm_backend_module {
+ const char *name; /**< The module name of a backend module */
+ const char *vendor; /**< The vendor name of a backend module */
+ unsigned long abi_version; /**< The ABI version of a backend module */
+
+ /**
+ * @brief The init function of a backend module
+ * @param[in] dpy A display object
+ * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @return The backend module data
+ * @see tdm_backend_data
+ */
+ tdm_backend_data *(*init)(tdm_display *dpy, tdm_error *error);
+
+ /**
+ * @brief The deinit function of a backend module
+ * @param[in] bdata The backend module data
+ */
+ void (*deinit)(tdm_backend_data *bdata);
} tdm_backend_module;
/**
* @remarks
* A backend module @b SHOULD set the backend display functions at least.
*/
-tdm_error tdm_backend_register_func_display(tdm_display *dpy, tdm_func_display *func_display);
+tdm_error
+tdm_backend_register_func_display(tdm_display *dpy,
+ tdm_func_display *func_display);
/**
* @brief Register the backend output functions to a display
* @remarks
* A backend module @b SHOULD set the backend output functions at least.
*/
-tdm_error tdm_backend_register_func_output(tdm_display *dpy, tdm_func_output *func_output);
+tdm_error
+tdm_backend_register_func_output(tdm_display *dpy,
+ tdm_func_output *func_output);
/**
* @brief Register the backend layer functions to a display
* @remarks
* A backend module @b SHOULD set the backend layer functions at least.
*/
-tdm_error tdm_backend_register_func_layer(tdm_display *dpy, tdm_func_layer *func_layer);
+tdm_error
+tdm_backend_register_func_layer(tdm_display *dpy, tdm_func_layer *func_layer);
/**
* @brief Register the backend pp functions to a display
* A backend module doesn'tcan skip to register the backend pp functions
* if a hardware doesn't have the memory-to-memory converting device.
*/
-tdm_error tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp);
+tdm_error
+tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp);
/**
* @brief Register the backend capture functions to a display
* A backend module can skip to register the backend capture functions
* if a hardware doesn't have the capture device.
*/
-tdm_error tdm_backend_register_func_capture(tdm_display *dpy, tdm_func_capture *func_capture);
+tdm_error
+tdm_backend_register_func_capture(tdm_display *dpy,
+ tdm_func_capture *func_capture);
/**
* @brief Increase the ref_count of a TDM buffer
* - For example, this function @b SHOULD be called in case that a backend module uses the TDM
* buffer of a layer for capturing a output or a layer to avoid tearing issue.
*/
-tbm_surface_h tdm_buffer_ref_backend(tbm_surface_h buffer);
+tbm_surface_h
+tdm_buffer_ref_backend(tbm_surface_h buffer);
/**
* @brief Decrease the ref_count of a TDM buffer
* @param[in] buffer A TDM buffer
* @see tdm_buffer_ref_backend
*/
-void tdm_buffer_unref_backend(tbm_surface_h buffer);
+void
+tdm_buffer_unref_backend(tbm_surface_h buffer);
/**
* @brief The destroy handler of a TDM buffer
* @param[in] user_data user data
* @see tdm_buffer_add_destroy_handler, tdm_buffer_remove_destroy_handler
*/
-typedef void (*tdm_buffer_destroy_handler)(tbm_surface_h buffer, void *user_data);
+typedef void (*tdm_buffer_destroy_handler)(tbm_surface_h buffer,
+ void *user_data);
/**
* @brief Add a destroy handler to a TDM buffer
* is a #tbm_surface_h object. When the TDM buffer is destroyed, this handler will
* be called.
*/
-tdm_error tdm_buffer_add_destroy_handler(tbm_surface_h buffer, tdm_buffer_destroy_handler func, void *user_data);
+tdm_error
+tdm_buffer_add_destroy_handler(tbm_surface_h buffer,
+ tdm_buffer_destroy_handler func, void *user_data);
/**
* @brief Remove a destroy handler from a TDM buffer
* @param[in] user_data user data
* @see tdm_buffer_add_destroy_handler
*/
-void tdm_buffer_remove_destroy_handler(tbm_surface_h buffer, tdm_buffer_destroy_handler func, void *user_data);
+void
+tdm_buffer_remove_destroy_handler(tbm_surface_h buffer,
+ tdm_buffer_destroy_handler func, void *user_data);
#ifdef __cplusplus
* @param[in] buffer A TDM buffer
* @param[in] file The path of file.
*/
-void tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file);
+void
+tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file);
#ifdef __cplusplus
}
#include <stddef.h>
-struct list_head
-{
- struct list_head *prev;
- struct list_head *next;
+struct list_head {
+ struct list_head *prev;
+ struct list_head *next;
};
static inline void list_inithead(struct list_head *item)
{
- item->prev = item;
- item->next = item;
+ item->prev = item;
+ item->next = item;
}
static inline void list_add(struct list_head *item, struct list_head *list)
{
- item->prev = list;
- item->next = list->next;
- list->next->prev = item;
- list->next = item;
+ item->prev = list;
+ item->next = list->next;
+ list->next->prev = item;
+ list->next = item;
}
static inline void list_addtail(struct list_head *item, struct list_head *list)
{
- item->next = list;
- item->prev = list->prev;
- list->prev->next = item;
- list->prev = item;
+ item->next = list;
+ item->prev = list->prev;
+ list->prev->next = item;
+ list->prev = item;
}
static inline void list_replace(struct list_head *from, struct list_head *to)
{
- to->prev = from->prev;
- to->next = from->next;
- from->next->prev = to;
- from->prev->next = to;
+ to->prev = from->prev;
+ to->next = from->next;
+ from->next->prev = to;
+ from->prev->next = to;
}
static inline void list_del(struct list_head *item)
{
- item->prev->next = item->next;
- item->next->prev = item->prev;
+ item->prev->next = item->next;
+ item->next->prev = item->prev;
}
static inline void list_delinit(struct list_head *item)
{
- item->prev->next = item->next;
- item->next->prev = item->prev;
- item->next = item;
- item->prev = item;
+ item->prev->next = item->next;
+ item->next->prev = item->prev;
+ item->next = item;
+ item->prev = item;
}
#define LIST_INITHEAD(__item) list_inithead(__item)
*/
typedef enum
{
- TDM_ERROR_NONE = 0, /**< none */
- TDM_ERROR_BAD_REQUEST = -1, /**< bad request */
- TDM_ERROR_OPERATION_FAILED = -2, /**< operaion failed */
- TDM_ERROR_INVALID_PARAMETER = -3, /**< wrong input parameter */
- TDM_ERROR_PERMISSION_DENIED = -4, /**< access denied */
- TDM_ERROR_BUSY = -5, /**< hardware resource busy */
- TDM_ERROR_OUT_OF_MEMORY = -6, /**< no free memory */
- TDM_ERROR_BAD_MODULE = -7, /**< bad backend module */
- TDM_ERROR_NOT_IMPLEMENTED = -8, /**< not implemented */
- TDM_ERROR_NO_CAPABILITY = -9, /**< no capability */
+ TDM_ERROR_NONE = 0, /**< none */
+ TDM_ERROR_BAD_REQUEST = -1, /**< bad request */
+ TDM_ERROR_OPERATION_FAILED = -2, /**< operaion failed */
+ TDM_ERROR_INVALID_PARAMETER = -3, /**< wrong input parameter */
+ TDM_ERROR_PERMISSION_DENIED = -4, /**< access denied */
+ TDM_ERROR_BUSY = -5, /**< hardware resource busy */
+ TDM_ERROR_OUT_OF_MEMORY = -6, /**< no free memory */
+ TDM_ERROR_BAD_MODULE = -7, /**< bad backend module */
+ TDM_ERROR_NOT_IMPLEMENTED = -8, /**< not implemented */
+ TDM_ERROR_NO_CAPABILITY = -9, /**< no capability */
} tdm_error;
/**
* @brief The transform enumeration(rotate, flip)
*/
-typedef enum
-{
- TDM_TRANSFORM_NORMAL = 0, /**< no transform */
- TDM_TRANSFORM_90 = 1, /**< rotate 90 */
- TDM_TRANSFORM_180 = 2, /**< rotate 180 */
- TDM_TRANSFORM_270 = 3, /**< rotate 270 */
- TDM_TRANSFORM_FLIPPED = 4, /**< no rotate and horizontal flip */
- TDM_TRANSFORM_FLIPPED_90 = 5, /**< rotate 90 and horizontal flip */
- TDM_TRANSFORM_FLIPPED_180 = 6, /**< rotate 180 and horizontal flip */
- TDM_TRANSFORM_FLIPPED_270 = 7, /**< rotate 270 and horizontal flip */
+typedef enum {
+ TDM_TRANSFORM_NORMAL = 0, /**< no transform */
+ TDM_TRANSFORM_90 = 1, /**< rotate 90 */
+ TDM_TRANSFORM_180 = 2, /**< rotate 180 */
+ TDM_TRANSFORM_270 = 3, /**< rotate 270 */
+ TDM_TRANSFORM_FLIPPED = 4, /**< no rotate and horizontal flip */
+ TDM_TRANSFORM_FLIPPED_90 = 5, /**< rotate 90 and horizontal flip */
+ TDM_TRANSFORM_FLIPPED_180 = 6, /**< rotate 180 and horizontal flip */
+ TDM_TRANSFORM_FLIPPED_270 = 7, /**< rotate 270 and horizontal flip */
} tdm_transform;
/**
* @brief The output connection status enumeration
*/
-typedef enum
-{
- TDM_OUTPUT_CONN_STATUS_DISCONNECTED, /**< output disconnected */
- TDM_OUTPUT_CONN_STATUS_CONNECTED, /**< output connected */
- TDM_OUTPUT_CONN_STATUS_MODE_SETTED, /**< output connected and setted a mode */
+typedef enum {
+ TDM_OUTPUT_CONN_STATUS_DISCONNECTED, /**< output disconnected */
+ TDM_OUTPUT_CONN_STATUS_CONNECTED, /**< output connected */
+ TDM_OUTPUT_CONN_STATUS_MODE_SETTED, /**< output connected and setted a mode */
} tdm_output_conn_status;
/**
* @brief The output connection status enumeration
* @details bit compatible with the libdrm definitions.
*/
-typedef enum
-{
- TDM_OUTPUT_TYPE_Unknown, /**< unknown */
- TDM_OUTPUT_TYPE_VGA, /**< VGA connection */
- TDM_OUTPUT_TYPE_DVII, /**< DVII connection */
- TDM_OUTPUT_TYPE_DVID, /**< DVID connection */
- TDM_OUTPUT_TYPE_DVIA, /**< DVIA connection */
- TDM_OUTPUT_TYPE_Composite, /**< Composite connection */
- TDM_OUTPUT_TYPE_SVIDEO, /**< SVIDEO connection */
- TDM_OUTPUT_TYPE_LVDS, /**< LVDS connection */
- TDM_OUTPUT_TYPE_Component, /**< Component connection */
- TDM_OUTPUT_TYPE_9PinDIN, /**< 9PinDIN connection */
- TDM_OUTPUT_TYPE_DisplayPort, /**< DisplayPort connection */
- TDM_OUTPUT_TYPE_HDMIA, /**< HDMIA connection */
- TDM_OUTPUT_TYPE_HDMIB, /**< HDMIB connection */
- TDM_OUTPUT_TYPE_TV, /**< TV connection */
- TDM_OUTPUT_TYPE_eDP, /**< eDP connection */
- TDM_OUTPUT_TYPE_VIRTUAL, /**< Virtual connection for WiFi Display */
- TDM_OUTPUT_TYPE_DSI, /**< DSI connection */
+typedef enum {
+ TDM_OUTPUT_TYPE_Unknown, /**< unknown */
+ TDM_OUTPUT_TYPE_VGA, /**< VGA connection */
+ TDM_OUTPUT_TYPE_DVII, /**< DVII connection */
+ TDM_OUTPUT_TYPE_DVID, /**< DVID connection */
+ TDM_OUTPUT_TYPE_DVIA, /**< DVIA connection */
+ TDM_OUTPUT_TYPE_Composite, /**< Composite connection */
+ TDM_OUTPUT_TYPE_SVIDEO, /**< SVIDEO connection */
+ TDM_OUTPUT_TYPE_LVDS, /**< LVDS connection */
+ TDM_OUTPUT_TYPE_Component, /**< Component connection */
+ TDM_OUTPUT_TYPE_9PinDIN, /**< 9PinDIN connection */
+ TDM_OUTPUT_TYPE_DisplayPort, /**< DisplayPort connection */
+ TDM_OUTPUT_TYPE_HDMIA, /**< HDMIA connection */
+ TDM_OUTPUT_TYPE_HDMIB, /**< HDMIB connection */
+ TDM_OUTPUT_TYPE_TV, /**< TV connection */
+ TDM_OUTPUT_TYPE_eDP, /**< eDP connection */
+ TDM_OUTPUT_TYPE_VIRTUAL, /**< Virtual connection for WiFi Display */
+ TDM_OUTPUT_TYPE_DSI, /**< DSI connection */
} tdm_output_type;
/**
* @brief The DPMS enumeration
* @details bit compatible with the libdrm definitions.
*/
-typedef enum
-{
- TDM_OUTPUT_DPMS_ON, /**< On */
- TDM_OUTPUT_DPMS_STANDBY, /**< StandBy */
- TDM_OUTPUT_DPMS_SUSPEND, /**< Suspend */
- TDM_OUTPUT_DPMS_OFF, /**< Off */
+typedef enum {
+ TDM_OUTPUT_DPMS_ON, /**< On */
+ TDM_OUTPUT_DPMS_STANDBY, /**< StandBy */
+ TDM_OUTPUT_DPMS_SUSPEND, /**< Suspend */
+ TDM_OUTPUT_DPMS_OFF, /**< Off */
} tdm_output_dpms;
/**
* a backend module offer VIDEO layers. And a display server will pass a video
* buffer to a VIDEO layer without converting.
*/
-typedef enum
-{
- TDM_LAYER_CAPABILITY_CURSOR = (1<<0), /**< cursor */
- TDM_LAYER_CAPABILITY_PRIMARY = (1<<1), /**< primary */
- TDM_LAYER_CAPABILITY_OVERLAY = (1<<2), /**< overlay */
- TDM_LAYER_CAPABILITY_GRAPHIC = (1<<4), /**< graphic */
- TDM_LAYER_CAPABILITY_VIDEO = (1<<5), /**< video */
- TDM_LAYER_CAPABILITY_SCALE = (1<<8), /**< if a layer has scale capability */
- TDM_LAYER_CAPABILITY_TRANSFORM = (1<<9), /**< if a layer has transform capability */
- TDM_LAYER_CAPABILITY_SCANOUT = (1<<10), /**< if a layer allows a scanout buffer only */
+typedef enum {
+ TDM_LAYER_CAPABILITY_CURSOR = (1 << 0), /**< cursor */
+ TDM_LAYER_CAPABILITY_PRIMARY = (1 << 1), /**< primary */
+ TDM_LAYER_CAPABILITY_OVERLAY = (1 << 2), /**< overlay */
+ TDM_LAYER_CAPABILITY_GRAPHIC = (1 << 4), /**< graphic */
+ TDM_LAYER_CAPABILITY_VIDEO = (1 << 5), /**< video */
+ TDM_LAYER_CAPABILITY_SCALE = (1 << 8), /**< if a layer has scale capability */
+ TDM_LAYER_CAPABILITY_TRANSFORM = (1 << 9), /**< if a layer has transform capability */
+ TDM_LAYER_CAPABILITY_SCANOUT = (1 << 10), /**< if a layer allows a scanout buffer only */
} tdm_layer_capability;
/**
* @brief The pp capability enumeration
*/
-typedef enum
-{
- TDM_PP_CAPABILITY_SYNC = (1<<0), /**< The pp device supports synchronous operation */
- TDM_PP_CAPABILITY_ASYNC = (1<<1), /**< The pp device supports asynchronous operation */
- TDM_PP_CAPABILITY_SCALE = (1<<4), /**< The pp device supports scale operation */
- TDM_PP_CAPABILITY_TRANSFORM = (1<<5), /**< The pp device supports transform operation */
+typedef enum {
+ TDM_PP_CAPABILITY_SYNC = (1 << 0), /**< The pp device supports synchronous operation */
+ TDM_PP_CAPABILITY_ASYNC = (1 << 1), /**< The pp device supports asynchronous operation */
+ TDM_PP_CAPABILITY_SCALE = (1 << 4), /**< The pp device supports scale operation */
+ TDM_PP_CAPABILITY_TRANSFORM = (1 << 5), /**< The pp device supports transform operation */
} tdm_pp_capability;
/**
* @brief The capture capability enumeration
*/
-typedef enum
-{
- TDM_CAPTURE_CAPABILITY_OUTPUT = (1<<0), /**< The capture device supports to dump a output */
- TDM_CAPTURE_CAPABILITY_LAYER = (1<<1), /**< The capture device supports to dump a layer */
- TDM_CAPTURE_CAPABILITY_SCALE = (1<<4), /**< The capture device supports scale operation */
- TDM_CAPTURE_CAPABILITY_TRANSFORM = (1<<5), /**< The capture device supports transform operation */
+typedef enum {
+ TDM_CAPTURE_CAPABILITY_OUTPUT = (1 << 0), /**< The capture device supports to dump a output */
+ TDM_CAPTURE_CAPABILITY_LAYER = (1 << 1), /**< The capture device supports to dump a layer */
+ TDM_CAPTURE_CAPABILITY_SCALE = (1 << 4), /**< The capture device supports scale operation */
+ TDM_CAPTURE_CAPABILITY_TRANSFORM = (1 << 5), /**< The capture device supports transform operation */
} tdm_capture_capability;
/**
* @brief The output mode type enumeration
* @details bit compatible with the libdrm definitions.
*/
-typedef enum
-{
- TDM_OUTPUT_MODE_TYPE_BUILTIN = (1<<0),
- TDM_OUTPUT_MODE_TYPE_CLOCK_C = ((1<<1) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
- TDM_OUTPUT_MODE_TYPE_CRTC_C = ((1<<2) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
- TDM_OUTPUT_MODE_TYPE_PREFERRED = (1<<3),
- TDM_OUTPUT_MODE_TYPE_DEFAULT = (1<<4),
- TDM_OUTPUT_MODE_TYPE_USERDEF = (1<<5),
- TDM_OUTPUT_MODE_TYPE_DRIVER = (1<<6),
+typedef enum {
+ TDM_OUTPUT_MODE_TYPE_BUILTIN = (1 << 0),
+ TDM_OUTPUT_MODE_TYPE_CLOCK_C = ((1 << 1) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
+ TDM_OUTPUT_MODE_TYPE_CRTC_C = ((1 << 2) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
+ TDM_OUTPUT_MODE_TYPE_PREFERRED = (1 << 3),
+ TDM_OUTPUT_MODE_TYPE_DEFAULT = (1 << 4),
+ TDM_OUTPUT_MODE_TYPE_USERDEF = (1 << 5),
+ TDM_OUTPUT_MODE_TYPE_DRIVER = (1 << 6),
} tdm_output_mode_type;
/**
* @brief The output mode flag enumeration
* @details bit compatible with the libdrm definitions.
*/
-typedef enum
-{
- TDM_OUTPUT_MODE_FLAG_PHSYNC = (1<<0),
- TDM_OUTPUT_MODE_FLAG_NHSYNC = (1<<1),
- TDM_OUTPUT_MODE_FLAG_PVSYNC = (1<<2),
- TDM_OUTPUT_MODE_FLAG_NVSYNC = (1<<3),
- TDM_OUTPUT_MODE_FLAG_INTERLACE = (1<<4),
- TDM_OUTPUT_MODE_FLAG_DBLSCAN = (1<<5),
- TDM_OUTPUT_MODE_FLAG_CSYNC = (1<<6),
- TDM_OUTPUT_MODE_FLAG_PCSYNC = (1<<7),
- TDM_OUTPUT_MODE_FLAG_NCSYNC = (1<<8),
- TDM_OUTPUT_MODE_FLAG_HSKEW = (1<<9), /* hskew provided */
- TDM_OUTPUT_MODE_FLAG_BCAST = (1<<10),
- TDM_OUTPUT_MODE_FLAG_PIXMUX = (1<<11),
- TDM_OUTPUT_MODE_FLAG_DBLCLK = (1<<12),
- TDM_OUTPUT_MODE_FLAG_CLKDIV2 = (1<<13),
+typedef enum {
+ TDM_OUTPUT_MODE_FLAG_PHSYNC = (1 << 0),
+ TDM_OUTPUT_MODE_FLAG_NHSYNC = (1 << 1),
+ TDM_OUTPUT_MODE_FLAG_PVSYNC = (1 << 2),
+ TDM_OUTPUT_MODE_FLAG_NVSYNC = (1 << 3),
+ TDM_OUTPUT_MODE_FLAG_INTERLACE = (1 << 4),
+ TDM_OUTPUT_MODE_FLAG_DBLSCAN = (1 << 5),
+ TDM_OUTPUT_MODE_FLAG_CSYNC = (1 << 6),
+ TDM_OUTPUT_MODE_FLAG_PCSYNC = (1 << 7),
+ TDM_OUTPUT_MODE_FLAG_NCSYNC = (1 << 8),
+ TDM_OUTPUT_MODE_FLAG_HSKEW = (1 << 9), /* hskew provided */
+ TDM_OUTPUT_MODE_FLAG_BCAST = (1 << 10),
+ TDM_OUTPUT_MODE_FLAG_PIXMUX = (1 << 11),
+ TDM_OUTPUT_MODE_FLAG_DBLCLK = (1 << 12),
+ TDM_OUTPUT_MODE_FLAG_CLKDIV2 = (1 << 13),
} tdm_output_mode_flag;
/**
* @brief The output mode structure
*/
-typedef struct _tdm_output_mode
-{
- unsigned int clock;
- unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
- unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
- unsigned int vrefresh;
- unsigned int flags;
- unsigned int type;
- char name[TDM_NAME_LEN];
+typedef struct _tdm_output_mode {
+ unsigned int clock;
+ unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew;
+ unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan;
+ unsigned int vrefresh;
+ unsigned int flags;
+ unsigned int type;
+ char name[TDM_NAME_LEN];
} tdm_output_mode;
/**
* @brief The property structure
*/
-typedef struct _tdm_prop
-{
- unsigned int id;
- char name[TDM_NAME_LEN];
+typedef struct _tdm_prop {
+ unsigned int id;
+ char name[TDM_NAME_LEN];
} tdm_prop;
/**
* @brief The size structure
*/
typedef struct _tdm_size {
- unsigned int h; /**< width */
- unsigned int v; /**< height */
+ unsigned int h; /**< width */
+ unsigned int v; /**< height */
} tdm_size;
/**
* @brief The pos structure
*/
-typedef struct _tdm_pos
-{
- unsigned int x;
- unsigned int y;
- unsigned int w;
- unsigned int h;
+typedef struct _tdm_pos {
+ unsigned int x;
+ unsigned int y;
+ unsigned int w;
+ unsigned int h;
} tdm_pos;
/**
* @brief The value union
*/
-typedef union
-{
- void *ptr;
- int32_t s32;
- uint32_t u32;
- int64_t s64;
- uint64_t u64;
+typedef union {
+ void *ptr;
+ int32_t s32;
+ uint32_t u32;
+ int64_t s64;
+ uint64_t u64;
} tdm_value;
/**
* @brief The info config structure
*/
-typedef struct _tdm_info_config
-{
- tdm_size size;
- tdm_pos pos;
- tbm_format format;
+typedef struct _tdm_info_config {
+ tdm_size size;
+ tdm_pos pos;
+ tbm_format format;
} tdm_info_config;
/**
* @brief The layer info structre
*/
-typedef struct _tdm_info_layer
-{
- tdm_info_config src_config;
- tdm_pos dst_pos;
- tdm_transform transform;
+typedef struct _tdm_info_layer {
+ tdm_info_config src_config;
+ tdm_pos dst_pos;
+ tdm_transform transform;
} tdm_info_layer;
/**
* @brief The pp info structre
*/
-typedef struct _tdm_info_pp
-{
- tdm_info_config src_config;
- tdm_info_config dst_config;
- tdm_transform transform;
- int sync;
- int flags;
+typedef struct _tdm_info_pp {
+ tdm_info_config src_config;
+ tdm_info_config dst_config;
+ tdm_transform transform;
+ int sync;
+ int flags;
} tdm_info_pp;
/**
* @brief The capture info structre
*/
-typedef struct _tdm_info_capture
-{
- tdm_info_config dst_config;
- tdm_transform transform;
- int oneshot;
- int frequency;
- int flags;
+typedef struct _tdm_info_capture {
+ tdm_info_config dst_config;
+ tdm_transform transform;
+ int oneshot;
+ int frequency;
+ int flags;
} tdm_info_capture;
/**
* @see output_set_vblank_handler() function of #tdm_func_display
*/
typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence,
- unsigned int tv_sec, unsigned int tv_usec, void *user_data);
+ unsigned int tv_sec, unsigned int tv_usec,
+ void *user_data);
/**
* @brief The commit handler
* @see output_set_commit_handler() function of #tdm_func_display
*/
typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence,
- unsigned int tv_sec, unsigned int tv_usec, void *user_data);
+ unsigned int tv_sec, unsigned int tv_usec,
+ void *user_data);
#ifdef __cplusplus
#include "tdm_backend.h"
#include "tdm_private.h"
-static tdm_private_layer*
-_tdm_display_find_private_layer(tdm_private_output *private_output, tdm_layer *layer_backend)
+static tdm_private_layer *
+_tdm_display_find_private_layer(tdm_private_output *private_output,
+ tdm_layer *layer_backend)
{
- tdm_private_layer *private_layer = NULL;
+ tdm_private_layer *private_layer = NULL;
- LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
- {
- if (private_layer->layer_backend == layer_backend)
- return private_layer;
- }
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
+ if (private_layer->layer_backend == layer_backend)
+ return private_layer;
+ }
- return NULL;
+ return NULL;
}
-static tdm_private_output*
-_tdm_display_find_private_output(tdm_private_display *private_display, tdm_output *output_backend)
+static tdm_private_output *
+_tdm_display_find_private_output(tdm_private_display *private_display,
+ tdm_output *output_backend)
{
- tdm_private_output *private_output = NULL;
+ tdm_private_output *private_output = NULL;
- LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link)
- {
- if (private_output->output_backend == output_backend)
- return private_output;
- }
+ LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) {
+ if (private_output->output_backend == output_backend)
+ return private_output;
+ }
- return NULL;
+ return NULL;
}
static void
_tdm_display_destroy_caps_pp(tdm_caps_pp *caps_pp)
{
- free(caps_pp->formats);
- memset(caps_pp, 0, sizeof(tdm_caps_pp));
+ free(caps_pp->formats);
+ memset(caps_pp, 0, sizeof(tdm_caps_pp));
}
static void
_tdm_display_destroy_caps_capture(tdm_caps_capture *caps_capture)
{
- free(caps_capture->formats);
- memset(caps_capture, 0, sizeof(tdm_caps_capture));
+ free(caps_capture->formats);
+ memset(caps_capture, 0, sizeof(tdm_caps_capture));
}
static void
_tdm_display_destroy_caps_layer(tdm_caps_layer *caps_layer)
{
- free(caps_layer->formats);
- free(caps_layer->props);
- memset(caps_layer, 0, sizeof(tdm_caps_layer));
+ free(caps_layer->formats);
+ free(caps_layer->props);
+ memset(caps_layer, 0, sizeof(tdm_caps_layer));
}
static void
_tdm_display_destroy_caps_output(tdm_caps_output *caps_output)
{
- free(caps_output->modes);
- free(caps_output->props);
- memset(caps_output, 0, sizeof(tdm_caps_output));
+ free(caps_output->modes);
+ free(caps_output->props);
+ memset(caps_output, 0, sizeof(tdm_caps_output));
}
static void
_tdm_display_destroy_private_layer(tdm_private_layer *private_layer)
{
- tdm_private_capture *c = NULL, *cc = NULL;
+ tdm_private_capture *c = NULL, *cc = NULL;
- LIST_DEL(&private_layer->link);
+ LIST_DEL(&private_layer->link);
- LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_layer->capture_list, link)
- tdm_capture_destroy_internal(c);
+ LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_layer->capture_list, link)
+ tdm_capture_destroy_internal(c);
- _tdm_display_destroy_caps_layer(&private_layer->caps);
+ _tdm_display_destroy_caps_layer(&private_layer->caps);
- free(private_layer);
+ free(private_layer);
}
static void
_tdm_display_destroy_private_output(tdm_private_output *private_output)
{
- tdm_private_layer *l = NULL, *ll = NULL;
- tdm_private_capture *c = NULL, *cc = NULL;
- tdm_private_vblank_handler *v = NULL, *vv = NULL;
- tdm_private_commit_handler *m = NULL, *mm = NULL;
+ tdm_private_layer *l = NULL, *ll = NULL;
+ tdm_private_capture *c = NULL, *cc = NULL;
+ tdm_private_vblank_handler *v = NULL, *vv = NULL;
+ tdm_private_commit_handler *m = NULL, *mm = NULL;
- LIST_DEL(&private_output->link);
+ LIST_DEL(&private_output->link);
- free(private_output->layers_ptr);
+ free(private_output->layers_ptr);
- LIST_FOR_EACH_ENTRY_SAFE(v, vv, &private_output->vblank_handler_list, link)
- {
- LIST_DEL(&v->link);
- free(v);
- }
+ LIST_FOR_EACH_ENTRY_SAFE(v, vv, &private_output->vblank_handler_list, link) {
+ LIST_DEL(&v->link);
+ free(v);
+ }
- LIST_FOR_EACH_ENTRY_SAFE(m, mm, &private_output->commit_handler_list, link)
- {
- LIST_DEL(&m->link);
- free(m);
- }
+ LIST_FOR_EACH_ENTRY_SAFE(m, mm, &private_output->commit_handler_list, link) {
+ LIST_DEL(&m->link);
+ free(m);
+ }
- LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_output->capture_list, link)
- tdm_capture_destroy_internal(c);
+ LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_output->capture_list, link)
+ tdm_capture_destroy_internal(c);
- LIST_FOR_EACH_ENTRY_SAFE(l, ll, &private_output->layer_list, link)
- _tdm_display_destroy_private_layer(l);
+ LIST_FOR_EACH_ENTRY_SAFE(l, ll, &private_output->layer_list, link)
+ _tdm_display_destroy_private_layer(l);
- _tdm_display_destroy_caps_output(&private_output->caps);
+ _tdm_display_destroy_caps_output(&private_output->caps);
- free(private_output);
+ free(private_output);
}
static void
_tdm_display_destroy_private_display(tdm_private_display *private_display)
{
- tdm_private_output *o = NULL, *oo = NULL;
- tdm_private_pp *p = NULL, *pp = NULL;
+ tdm_private_output *o = NULL, *oo = NULL;
+ tdm_private_pp *p = NULL, *pp = NULL;
- free(private_display->outputs_ptr);
+ free(private_display->outputs_ptr);
- LIST_FOR_EACH_ENTRY_SAFE(p, pp, &private_display->pp_list, link)
- tdm_pp_destroy_internal(p);
+ LIST_FOR_EACH_ENTRY_SAFE(p, pp, &private_display->pp_list, link)
+ tdm_pp_destroy_internal(p);
- LIST_FOR_EACH_ENTRY_SAFE(o, oo, &private_display->output_list, link)
- _tdm_display_destroy_private_output(o);
+ LIST_FOR_EACH_ENTRY_SAFE(o, oo, &private_display->output_list, link)
+ _tdm_display_destroy_private_output(o);
- _tdm_display_destroy_caps_pp(&private_display->caps_pp);
- _tdm_display_destroy_caps_capture(&private_display->caps_capture);
+ _tdm_display_destroy_caps_pp(&private_display->caps_pp);
+ _tdm_display_destroy_caps_capture(&private_display->caps_capture);
- private_display->capabilities = 0;
- private_display->caps_display.max_layer_count = -1;
+ private_display->capabilities = 0;
+ private_display->caps_display.max_layer_count = -1;
}
static tdm_error
-_tdm_display_update_caps_pp(tdm_private_display *private_display, tdm_caps_pp *caps)
+_tdm_display_update_caps_pp(tdm_private_display *private_display,
+ tdm_caps_pp *caps)
{
- tdm_func_display *func_display = &private_display->func_display;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
- tdm_error ret;
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
- return TDM_ERROR_NONE;
-
- if (!func_display->display_get_pp_capability)
- {
- TDM_ERR("no display_get_pp_capability()");
- return TDM_ERROR_BAD_MODULE;
- }
-
- ret = func_display->display_get_pp_capability(private_display->bdata, caps);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("display_get_pp_capability() failed");
- return TDM_ERROR_BAD_MODULE;
- }
-
- TDM_DBG("pp capabilities: %x", caps->capabilities);
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("pp formats: %s", buf);
- TDM_DBG("pp min : %dx%d", caps->min_w, caps->min_h);
- TDM_DBG("pp max : %dx%d", caps->max_w, caps->max_h);
- TDM_DBG("pp align: %d", caps->preferred_align);
-
- return TDM_ERROR_NONE;
+ tdm_func_display *func_display = &private_display->func_display;
+ char buf[1024];
+ int bufsize = sizeof(buf);
+ char *str_buf = buf;
+ int *len_buf = &bufsize;
+ int i;
+ tdm_error ret;
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
+ return TDM_ERROR_NONE;
+
+ if (!func_display->display_get_pp_capability) {
+ TDM_ERR("no display_get_pp_capability()");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ ret = func_display->display_get_pp_capability(private_display->bdata, caps);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("display_get_pp_capability() failed");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ TDM_DBG("pp capabilities: %x", caps->capabilities);
+ buf[0] = '\0';
+ for (i = 0; i < caps->format_count; i++)
+ TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
+ TDM_DBG("pp formats: %s", buf);
+ TDM_DBG("pp min : %dx%d", caps->min_w, caps->min_h);
+ TDM_DBG("pp max : %dx%d", caps->max_w, caps->max_h);
+ TDM_DBG("pp align: %d", caps->preferred_align);
+
+ return TDM_ERROR_NONE;
}
static tdm_error
-_tdm_display_update_caps_capture(tdm_private_display *private_display, tdm_caps_capture *caps)
+_tdm_display_update_caps_capture(tdm_private_display *private_display,
+ tdm_caps_capture *caps)
{
- tdm_func_display *func_display = &private_display->func_display;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
- tdm_error ret;
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
- return TDM_ERROR_NONE;
-
- if (!func_display->display_get_capture_capability)
- {
- TDM_ERR("no display_get_capture_capability()");
- return TDM_ERROR_BAD_MODULE;
- }
-
- ret = func_display->display_get_capture_capability(private_display->bdata, caps);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("display_get_capture_capability() failed");
- return TDM_ERROR_BAD_MODULE;
- }
-
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("capture formats: %s", buf);
-
- return TDM_ERROR_NONE;
+ tdm_func_display *func_display = &private_display->func_display;
+ char buf[1024];
+ int bufsize = sizeof(buf);
+ char *str_buf = buf;
+ int *len_buf = &bufsize;
+ int i;
+ tdm_error ret;
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
+ return TDM_ERROR_NONE;
+
+ if (!func_display->display_get_capture_capability) {
+ TDM_ERR("no display_get_capture_capability()");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ ret = func_display->display_get_capture_capability(private_display->bdata,
+ caps);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("display_get_capture_capability() failed");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ buf[0] = '\0';
+ for (i = 0; i < caps->format_count; i++)
+ TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
+ TDM_DBG("capture formats: %s", buf);
+
+ return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_caps_layer(tdm_private_display *private_display,
tdm_layer *layer_backend, tdm_caps_layer *caps)
{
- tdm_func_layer *func_layer = &private_display->func_layer;
- char buf[1024];
- int bufsize = sizeof(buf);
- char *str_buf = buf;
- int *len_buf = &bufsize;
- int i;
- tdm_error ret;
-
- if (!func_layer->layer_get_capability)
- {
- TDM_ERR("no layer_get_capability()");
- return TDM_ERROR_BAD_MODULE;
- }
-
- ret = func_layer->layer_get_capability(layer_backend, caps);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("layer_get_capability() failed");
- return TDM_ERROR_BAD_MODULE;
- }
-
- TDM_DBG("layer capabilities: %x", caps->capabilities);
- TDM_DBG("layer zpos : %d", caps->zpos);
- buf[0] = '\0';
- for (i = 0; i < caps->format_count; i++)
- TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
- TDM_DBG("layer formats: %s", buf);
- for (i = 0; i < caps->prop_count; i++)
- TDM_DBG("layer props: %d, %s", caps->props[i].id, caps->props[i].name);
-
- return TDM_ERROR_NONE;
+ tdm_func_layer *func_layer = &private_display->func_layer;
+ char buf[1024];
+ int bufsize = sizeof(buf);
+ char *str_buf = buf;
+ int *len_buf = &bufsize;
+ int i;
+ tdm_error ret;
+
+ if (!func_layer->layer_get_capability) {
+ TDM_ERR("no layer_get_capability()");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ ret = func_layer->layer_get_capability(layer_backend, caps);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("layer_get_capability() failed");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ TDM_DBG("layer capabilities: %x", caps->capabilities);
+ TDM_DBG("layer zpos : %d", caps->zpos);
+ buf[0] = '\0';
+ for (i = 0; i < caps->format_count; i++)
+ TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i]));
+ TDM_DBG("layer formats: %s", buf);
+ for (i = 0; i < caps->prop_count; i++)
+ TDM_DBG("layer props: %d, %s", caps->props[i].id, caps->props[i].name);
+
+ return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_update_caps_output(tdm_private_display *private_display,
tdm_output *output_backend, tdm_caps_output *caps)
{
- tdm_func_output *func_output = &private_display->func_output;
- int i;
- tdm_error ret;
-
- if (!func_output->output_get_capability)
- {
- TDM_ERR("no output_get_capability()");
- return TDM_ERROR_BAD_MODULE;
- }
-
- ret = func_output->output_get_capability(output_backend, caps);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("output_get_capability() failed");
- return TDM_ERROR_BAD_MODULE;
- }
-
- TDM_DBG("output maker: %s", caps->maker);
- TDM_DBG("output model: %s", caps->model);
- TDM_DBG("output name: %s", caps->name);
- TDM_DBG("output status: %d", caps->status);
- TDM_DBG("output type : %d", caps->type);
- for (i = 0; i < caps->prop_count; i++)
- TDM_DBG("output props: %d, %s", caps->props[i].id, caps->props[i].name);
- for (i = 0; i < caps->mode_count; i++)
- {
- TDM_DBG("output modes: name(%s), clock(%d) vrefresh(%d), flags(%x), type(%d)",
- caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh,
- caps->modes[i].flags, caps->modes[i].type);
- TDM_DBG("\t\t %d, %d, %d, %d, %d",
- caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end,
- caps->modes[i].htotal, caps->modes[i].hskew);
- TDM_DBG("\t\t %d, %d, %d, %d, %d",
- caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end,
- caps->modes[i].vtotal, caps->modes[i].vscan);
- }
- TDM_DBG("output min : %dx%d", caps->min_w, caps->min_h);
- TDM_DBG("output max : %dx%d", caps->max_w, caps->max_h);
- TDM_DBG("output align: %d", caps->preferred_align);
-
- return TDM_ERROR_NONE;
+ tdm_func_output *func_output = &private_display->func_output;
+ int i;
+ tdm_error ret;
+
+ if (!func_output->output_get_capability) {
+ TDM_ERR("no output_get_capability()");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ ret = func_output->output_get_capability(output_backend, caps);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("output_get_capability() failed");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ TDM_DBG("output maker: %s", caps->maker);
+ TDM_DBG("output model: %s", caps->model);
+ TDM_DBG("output name: %s", caps->name);
+ TDM_DBG("output status: %d", caps->status);
+ TDM_DBG("output type : %d", caps->type);
+ for (i = 0; i < caps->prop_count; i++)
+ TDM_DBG("output props: %d, %s", caps->props[i].id, caps->props[i].name);
+ for (i = 0; i < caps->mode_count; i++) {
+ TDM_DBG("output modes: name(%s), clock(%d) vrefresh(%d), flags(%x), type(%d)",
+ caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh,
+ caps->modes[i].flags, caps->modes[i].type);
+ TDM_DBG("\t\t %d, %d, %d, %d, %d",
+ caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end,
+ caps->modes[i].htotal, caps->modes[i].hskew);
+ TDM_DBG("\t\t %d, %d, %d, %d, %d",
+ caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end,
+ caps->modes[i].vtotal, caps->modes[i].vscan);
+ }
+ TDM_DBG("output min : %dx%d", caps->min_w, caps->min_h);
+ TDM_DBG("output max : %dx%d", caps->max_w, caps->max_h);
+ TDM_DBG("output align: %d", caps->preferred_align);
+
+ return TDM_ERROR_NONE;
}
static tdm_error
tdm_private_output *private_output,
tdm_layer *layer_backend)
{
- tdm_private_layer *private_layer;
- tdm_error ret;
+ tdm_private_layer *private_layer;
+ tdm_error ret;
- private_layer = _tdm_display_find_private_layer(private_output, layer_backend);
- if (!private_layer)
- {
- private_layer = calloc(1, sizeof(tdm_private_layer));
- TDM_RETURN_VAL_IF_FAIL(private_layer != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ private_layer = _tdm_display_find_private_layer(private_output, layer_backend);
+ if (!private_layer) {
+ private_layer = calloc(1, sizeof(tdm_private_layer));
+ TDM_RETURN_VAL_IF_FAIL(private_layer != NULL, TDM_ERROR_OUT_OF_MEMORY);
- LIST_ADD(&private_layer->link, &private_output->layer_list);
- private_layer->private_display = private_display;
- private_layer->private_output = private_output;
- private_layer->layer_backend = layer_backend;
+ LIST_ADD(&private_layer->link, &private_output->layer_list);
+ private_layer->private_display = private_display;
+ private_layer->private_output = private_output;
+ private_layer->layer_backend = layer_backend;
- LIST_INITHEAD(&private_layer->capture_list);
+ LIST_INITHEAD(&private_layer->capture_list);
- private_layer->usable = 1;
- }
- else
- _tdm_display_destroy_caps_layer(&private_layer->caps);
+ private_layer->usable = 1;
+ } else
+ _tdm_display_destroy_caps_layer(&private_layer->caps);
- ret = _tdm_display_update_caps_layer(private_display, layer_backend, &private_layer->caps);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
+ ret = _tdm_display_update_caps_layer(private_display, layer_backend,
+ &private_layer->caps);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
failed_update:
- _tdm_display_destroy_private_layer(private_layer);
- return ret;
+ _tdm_display_destroy_private_layer(private_layer);
+ return ret;
}
static tdm_error
_tdm_display_update_output(tdm_private_display *private_display,
tdm_output *output_backend, int pipe)
{
- tdm_func_output *func_output = &private_display->func_output;
- tdm_private_output *private_output = NULL;
- tdm_layer **layers = NULL;
- int layer_count = 0, i;
- tdm_error ret;
-
- private_output = _tdm_display_find_private_output(private_display, output_backend);
- if (!private_output)
- {
- private_output = calloc(1, sizeof(tdm_private_output));
- TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_OUT_OF_MEMORY);
-
- LIST_ADD(&private_output->link, &private_display->output_list);
- private_output->private_display = private_display;
- private_output->output_backend = output_backend;
- private_output->pipe = pipe;
-
- LIST_INITHEAD(&private_output->layer_list);
- LIST_INITHEAD(&private_output->capture_list);
- LIST_INITHEAD(&private_output->vblank_handler_list);
- LIST_INITHEAD(&private_output->commit_handler_list);
- }
- else
- _tdm_display_destroy_caps_output(&private_output->caps);
-
- ret = _tdm_display_update_caps_output(private_display, output_backend, &private_output->caps);
- if (ret != TDM_ERROR_NONE)
- return ret;
-
- layers = func_output->output_get_layers(output_backend, &layer_count, &ret);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
-
- for (i = 0; i < layer_count; i++)
- {
- ret = _tdm_display_update_layer(private_display, private_output, layers[i]);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
- }
-
- free(layers);
-
- return TDM_ERROR_NONE;
+ tdm_func_output *func_output = &private_display->func_output;
+ tdm_private_output *private_output = NULL;
+ tdm_layer **layers = NULL;
+ int layer_count = 0, i;
+ tdm_error ret;
+
+ private_output = _tdm_display_find_private_output(private_display,
+ output_backend);
+ if (!private_output) {
+ private_output = calloc(1, sizeof(tdm_private_output));
+ TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_OUT_OF_MEMORY);
+
+ LIST_ADD(&private_output->link, &private_display->output_list);
+ private_output->private_display = private_display;
+ private_output->output_backend = output_backend;
+ private_output->pipe = pipe;
+
+ LIST_INITHEAD(&private_output->layer_list);
+ LIST_INITHEAD(&private_output->capture_list);
+ LIST_INITHEAD(&private_output->vblank_handler_list);
+ LIST_INITHEAD(&private_output->commit_handler_list);
+ } else
+ _tdm_display_destroy_caps_output(&private_output->caps);
+
+ ret = _tdm_display_update_caps_output(private_display, output_backend,
+ &private_output->caps);
+ if (ret != TDM_ERROR_NONE)
+ return ret;
+
+ layers = func_output->output_get_layers(output_backend, &layer_count, &ret);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+
+ for (i = 0; i < layer_count; i++) {
+ ret = _tdm_display_update_layer(private_display, private_output, layers[i]);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+ }
+
+ free(layers);
+
+ return TDM_ERROR_NONE;
failed_update:
- _tdm_display_destroy_private_output(private_output);
- free(layers);
- return ret;
+ _tdm_display_destroy_private_output(private_output);
+ free(layers);
+ return ret;
}
static tdm_error
-_tdm_display_update_internal(tdm_private_display *private_display, int only_display)
+_tdm_display_update_internal(tdm_private_display *private_display,
+ int only_display)
{
- tdm_func_display *func_display = &private_display->func_display;
- tdm_output **outputs = NULL;
- int output_count = 0, i;
- tdm_error ret;
+ tdm_func_display *func_display = &private_display->func_display;
+ tdm_output **outputs = NULL;
+ int output_count = 0, i;
+ tdm_error ret;
- LIST_INITHEAD(&private_display->output_list);
- LIST_INITHEAD(&private_display->pp_list);
+ LIST_INITHEAD(&private_display->output_list);
+ LIST_INITHEAD(&private_display->pp_list);
- if (!only_display)
- {
- ret = _tdm_display_update_caps_pp(private_display, &private_display->caps_pp);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
+ if (!only_display) {
+ ret = _tdm_display_update_caps_pp(private_display, &private_display->caps_pp);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
- ret = _tdm_display_update_caps_capture(private_display, &private_display->caps_capture);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
- }
+ ret = _tdm_display_update_caps_capture(private_display,
+ &private_display->caps_capture);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+ }
- outputs = func_display->display_get_outputs(private_display->bdata, &output_count, &ret);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
+ outputs = func_display->display_get_outputs(private_display->bdata,
+ &output_count, &ret);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
- for (i = 0; i < output_count; i++)
- {
- ret = _tdm_display_update_output(private_display, outputs[i], i);
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
- }
+ for (i = 0; i < output_count; i++) {
+ ret = _tdm_display_update_output(private_display, outputs[i], i);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+ }
- free(outputs);
+ free(outputs);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
failed_update:
- _tdm_display_destroy_private_display(private_display);
- free(outputs);
- return ret;
+ _tdm_display_destroy_private_display(private_display);
+ free(outputs);
+ return ret;
}
static tdm_error
_tdm_display_init_bufmgr(tdm_private_display *private_display)
{
- tdm_func_display *func_display = &private_display->func_display;
- int buffer_fd = -1;
- tdm_error ret;
-
- if (func_display->display_get_buffer_fd)
- {
- ret = func_display->display_get_buffer_fd(private_display->bdata, &buffer_fd);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("failed to get buffer fd");
- return ret;
- }
- }
-
- private_display->bufmgr = tbm_bufmgr_init(buffer_fd);
- if (!private_display->bufmgr)
- {
- TDM_ERR("failed to init TBM bufmgr: fd(%d)", buffer_fd);
- return TDM_ERROR_OUT_OF_MEMORY;
- }
-
- TDM_INFO("init TBM bufmgr: fd(%d)", buffer_fd);
-
- return TDM_ERROR_NONE;
+ tdm_func_display *func_display = &private_display->func_display;
+ int buffer_fd = -1;
+ tdm_error ret;
+
+ if (func_display->display_get_buffer_fd) {
+ ret = func_display->display_get_buffer_fd(private_display->bdata, &buffer_fd);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("failed to get buffer fd");
+ return ret;
+ }
+ }
+
+ private_display->bufmgr = tbm_bufmgr_init(buffer_fd);
+ if (!private_display->bufmgr) {
+ TDM_ERR("failed to init TBM bufmgr: fd(%d)", buffer_fd);
+ return TDM_ERROR_OUT_OF_MEMORY;
+ }
+
+ TDM_INFO("init TBM bufmgr: fd(%d)", buffer_fd);
+
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
tdm_display_update(tdm_display *dpy)
{
- tdm_private_display *private_display;
- tdm_error ret;
+ tdm_private_display *private_display;
+ tdm_error ret;
- TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER);
- private_display = dpy;
- pthread_mutex_lock(&private_display->lock);
+ private_display = dpy;
+ pthread_mutex_lock(&private_display->lock);
- ret = _tdm_display_update_internal(private_display, 1);
+ ret = _tdm_display_update_internal(private_display, 1);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
#define SUFFIX_MODULE ".so"
static tdm_error
_tdm_display_check_module(tdm_backend_module *module)
{
- const char *name;
- const char *vendor;
- int major, minor;
- int abimaj, abimin;
-
- abimaj = TDM_BACKEND_GET_ABI_MAJOR(TDM_BACKEND_ABI_VERSION);
- abimin = TDM_BACKEND_GET_ABI_MINOR(TDM_BACKEND_ABI_VERSION);
-
- TDM_INFO("TDM module ABI version : %d.%d", abimaj, abimin);
-
- name = module->name ? module->name : "unknown";
- vendor = module->vendor ? module->vendor : "unknown";
- major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version);
- minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version);
-
- TDM_INFO("TDM module name: %s", name);
- TDM_INFO("'%s' vendor: %s", name, vendor);
- TDM_INFO("'%s' version: %d.%d", name, major, minor);
-
- if (major != abimaj)
- {
- TDM_ERR("'%s' major version mismatch, %d != %d", name, major, abimaj);
- return TDM_ERROR_BAD_MODULE;
- }
-
- if (minor > abimin)
- {
- TDM_ERR("'%s' minor version(%d) is newer than %d", name, minor, abimin);
- return TDM_ERROR_BAD_MODULE;
- }
-
- if (!module->init)
- {
- TDM_ERR("'%s' doesn't have init function", name);
- return TDM_ERROR_BAD_MODULE;
- }
-
- if (!module->deinit)
- {
- TDM_ERR("'%s' doesn't have deinit function", name);
- return TDM_ERROR_BAD_MODULE;
- }
-
- return TDM_ERROR_NONE;
+ const char *name;
+ const char *vendor;
+ int major, minor;
+ int abimaj, abimin;
+
+ abimaj = TDM_BACKEND_GET_ABI_MAJOR(TDM_BACKEND_ABI_VERSION);
+ abimin = TDM_BACKEND_GET_ABI_MINOR(TDM_BACKEND_ABI_VERSION);
+
+ TDM_INFO("TDM module ABI version : %d.%d", abimaj, abimin);
+
+ name = module->name ? module->name : "unknown";
+ vendor = module->vendor ? module->vendor : "unknown";
+ major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version);
+ minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version);
+
+ TDM_INFO("TDM module name: %s", name);
+ TDM_INFO("'%s' vendor: %s", name, vendor);
+ TDM_INFO("'%s' version: %d.%d", name, major, minor);
+
+ if (major != abimaj) {
+ TDM_ERR("'%s' major version mismatch, %d != %d", name, major, abimaj);
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ if (minor > abimin) {
+ TDM_ERR("'%s' minor version(%d) is newer than %d", name, minor, abimin);
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ if (!module->init) {
+ TDM_ERR("'%s' doesn't have init function", name);
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ if (!module->deinit) {
+ TDM_ERR("'%s' doesn't have deinit function", name);
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ return TDM_ERROR_NONE;
}
static tdm_error
_tdm_display_check_backend_functions(tdm_private_display *private_display)
{
- tdm_func_display *func_display = &private_display->func_display;
- tdm_func_output *func_output = &private_display->func_output;
- tdm_func_layer *func_layer = &private_display->func_layer;
- tdm_error ret;
-
- /* below functions should be implemented in backend side */
-
- TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capabilitiy, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_outputs, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_output->output_get_capability, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_output->output_get_layers, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_layer->layer_get_capability, TDM_ERROR_BAD_MODULE);
-
- ret = func_display->display_get_capabilitiy(private_display->bdata,
- &private_display->caps_display);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("display_get_capabilitiy() failed");
- return TDM_ERROR_BAD_MODULE;
- }
-
- if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)
- {
- tdm_func_pp *func_pp = &private_display->func_pp;
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_display->display_create_pp, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_pp->pp_destroy, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_pp->pp_commit, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_pp->pp_set_done_handler, TDM_ERROR_BAD_MODULE);
- }
-
- if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)
- {
- tdm_func_capture *func_capture = &private_display->func_capture;
- TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_layer->layer_create_capture, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_capture->capture_destroy, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_capture->capture_commit, TDM_ERROR_BAD_MODULE);
- TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler, TDM_ERROR_BAD_MODULE);
- }
-
- return TDM_ERROR_NONE;
+ tdm_func_display *func_display = &private_display->func_display;
+ tdm_func_output *func_output = &private_display->func_output;
+ tdm_func_layer *func_layer = &private_display->func_layer;
+ tdm_error ret;
+
+ /* below functions should be implemented in backend side */
+
+ TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capabilitiy,
+ TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_outputs, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_output->output_get_capability,
+ TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_output->output_get_layers, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_layer->layer_get_capability, TDM_ERROR_BAD_MODULE);
+
+ ret = func_display->display_get_capabilitiy(private_display->bdata,
+ &private_display->caps_display);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("display_get_capabilitiy() failed");
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP) {
+ tdm_func_pp *func_pp = &private_display->func_pp;
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_pp_capability,
+ TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_create_pp, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_pp->pp_destroy, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_pp->pp_commit, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_pp->pp_set_done_handler, TDM_ERROR_BAD_MODULE);
+ }
+
+ if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) {
+ tdm_func_capture *func_capture = &private_display->func_capture;
+ TDM_RETURN_VAL_IF_FAIL(func_display->display_get_capture_capability,
+ TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_output->output_create_capture,
+ TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_layer->layer_create_capture, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_capture->capture_destroy, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_capture->capture_commit, TDM_ERROR_BAD_MODULE);
+ TDM_RETURN_VAL_IF_FAIL(func_capture->capture_set_done_handler,
+ TDM_ERROR_BAD_MODULE);
+ }
+
+ return TDM_ERROR_NONE;
}
static tdm_error
-_tdm_display_load_module_with_file(tdm_private_display *private_display, const char *file)
+_tdm_display_load_module_with_file(tdm_private_display *private_display,
+ const char *file)
{
- char path[PATH_MAX] = {0,};
- tdm_backend_module *module_data;
- void *module;
- tdm_error ret;
-
- snprintf(path, sizeof(path), TDM_MODULE_PATH "/%s", file);
-
- TDM_TRACE_BEGIN(Load_Backend);
-
- module = dlopen(path, RTLD_LAZY);
- if (!module)
- {
- TDM_ERR("failed to load module: %s(%s)", dlerror(), file);
- TDM_TRACE_END();
- return TDM_ERROR_BAD_MODULE;
- }
-
- module_data = dlsym(module, "tdm_backend_module_data");
- if (!module_data)
- {
- TDM_ERR("'%s' doesn't have data object", file);
- ret = TDM_ERROR_BAD_MODULE;
- TDM_TRACE_END();
- goto failed_load;
- }
-
- private_display->module_data = module_data;
- private_display->module = module;
-
- /* check if version, init() and deinit() are valid or not */
- ret = _tdm_display_check_module(module_data);
- if (ret != TDM_ERROR_NONE)
- goto failed_load;
-
- TDM_TRACE_END();
-
- /* We don't care if backend_data is NULL or not. It's up to backend. */
- TDM_TRACE_BEGIN(Init_Backend);
- private_display->bdata = module_data->init((tdm_display*)private_display, &ret);
- TDM_TRACE_END();
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("'%s' init failed", file);
- goto failed_load;
- }
-
- ret = _tdm_display_check_backend_functions(private_display);
- if (ret != TDM_ERROR_NONE)
- {
- module_data->deinit(private_display->bdata);
- private_display->bdata = NULL;
- goto failed_load;
- }
-
- TDM_INFO("Success to load module(%s)", file);
-
- return TDM_ERROR_NONE;
+ char path[PATH_MAX] = {0,};
+ tdm_backend_module *module_data;
+ void *module;
+ tdm_error ret;
+
+ snprintf(path, sizeof(path), TDM_MODULE_PATH "/%s", file);
+
+ TDM_TRACE_BEGIN(Load_Backend);
+
+ module = dlopen(path, RTLD_LAZY);
+ if (!module) {
+ TDM_ERR("failed to load module: %s(%s)", dlerror(), file);
+ TDM_TRACE_END();
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ module_data = dlsym(module, "tdm_backend_module_data");
+ if (!module_data) {
+ TDM_ERR("'%s' doesn't have data object", file);
+ ret = TDM_ERROR_BAD_MODULE;
+ TDM_TRACE_END();
+ goto failed_load;
+ }
+
+ private_display->module_data = module_data;
+ private_display->module = module;
+
+ /* check if version, init() and deinit() are valid or not */
+ ret = _tdm_display_check_module(module_data);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_load;
+
+ TDM_TRACE_END();
+
+ /* We don't care if backend_data is NULL or not. It's up to backend. */
+ TDM_TRACE_BEGIN(Init_Backend);
+ private_display->bdata = module_data->init((tdm_display *)private_display,
+ &ret);
+ TDM_TRACE_END();
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("'%s' init failed", file);
+ goto failed_load;
+ }
+
+ ret = _tdm_display_check_backend_functions(private_display);
+ if (ret != TDM_ERROR_NONE) {
+ module_data->deinit(private_display->bdata);
+ private_display->bdata = NULL;
+ goto failed_load;
+ }
+
+ TDM_INFO("Success to load module(%s)", file);
+
+ return TDM_ERROR_NONE;
failed_load:
- dlclose(module);
- private_display->module_data = NULL;
- private_display->module = NULL;
- return ret;
+ dlclose(module);
+ private_display->module_data = NULL;
+ private_display->module = NULL;
+ return ret;
}
static tdm_error
_tdm_display_load_module(tdm_private_display *private_display)
{
- const char *module_name;
- struct dirent **namelist;
- int n;
- tdm_error ret = 0;
-
- module_name = getenv("TDM_MODULE");
- if (!module_name)
- module_name = DEFAULT_MODULE;
-
- /* load bufmgr priv from default lib */
- ret = _tdm_display_load_module_with_file(private_display, module_name);
- if (ret == TDM_ERROR_NONE)
- return TDM_ERROR_NONE;
-
- /* load bufmgr priv from configured path */
- n = scandir(TDM_MODULE_PATH, &namelist, 0, alphasort);
- if (n < 0)
- {
- TDM_ERR("no module in '%s'\n", TDM_MODULE_PATH);
- return TDM_ERROR_BAD_MODULE;
- }
-
- ret = TDM_ERROR_BAD_MODULE;
- while (n--)
- {
- if (ret < 0 && strstr(namelist[n]->d_name, SUFFIX_MODULE))
- ret = _tdm_display_load_module_with_file(private_display, namelist[n]->d_name);
-
- free(namelist[n]);
- }
- free(namelist);
-
- return ret;
+ const char *module_name;
+ struct dirent **namelist;
+ int n;
+ tdm_error ret = 0;
+
+ module_name = getenv("TDM_MODULE");
+ if (!module_name)
+ module_name = DEFAULT_MODULE;
+
+ /* load bufmgr priv from default lib */
+ ret = _tdm_display_load_module_with_file(private_display, module_name);
+ if (ret == TDM_ERROR_NONE)
+ return TDM_ERROR_NONE;
+
+ /* load bufmgr priv from configured path */
+ n = scandir(TDM_MODULE_PATH, &namelist, 0, alphasort);
+ if (n < 0) {
+ TDM_ERR("no module in '%s'\n", TDM_MODULE_PATH);
+ return TDM_ERROR_BAD_MODULE;
+ }
+
+ ret = TDM_ERROR_BAD_MODULE;
+ while (n--) {
+ if (ret < 0 && strstr(namelist[n]->d_name, SUFFIX_MODULE))
+ ret = _tdm_display_load_module_with_file(private_display, namelist[n]->d_name);
+
+ free(namelist[n]);
+ }
+ free(namelist);
+
+ return ret;
}
static void
_tdm_display_unload_module(tdm_private_display *private_display)
{
- if (private_display->module_data)
- private_display->module_data->deinit(private_display->bdata);
- if (private_display->module)
- dlclose(private_display->module);
-
- private_display->bdata = NULL;
- private_display->module_data = NULL;
- private_display->module = NULL;
+ if (private_display->module_data)
+ private_display->module_data->deinit(private_display->bdata);
+ if (private_display->module)
+ dlclose(private_display->module);
+
+ private_display->bdata = NULL;
+ private_display->module_data = NULL;
+ private_display->module = NULL;
}
-EXTERN tdm_display*
+EXTERN tdm_display *
tdm_display_init(tdm_error *error)
{
- tdm_private_display *private_display = NULL;
- const char *debug;
- tdm_error ret;
-
- pthread_mutex_lock(&gLock);
-
- if (g_private_display)
- {
- g_private_display->init_count++;
- pthread_mutex_unlock(&gLock);
- if (error)
- *error = TDM_ERROR_NONE;
- return g_private_display;
- }
-
- debug = getenv("TDM_DEBUG");
- if (debug && (strstr(debug, "1")))
- tdm_debug = 1;
-
- private_display = calloc(1, sizeof(tdm_private_display));
- if (!private_display)
- {
- ret = TDM_ERROR_OUT_OF_MEMORY;
- TDM_ERR("'private_display != NULL' failed");
- goto failed_alloc;
- }
-
- if (pthread_mutex_init(&private_display->lock, NULL))
- {
- ret = TDM_ERROR_OPERATION_FAILED;
- TDM_ERR("mutex init failed: %m");
- goto failed_mutex_init;
- }
-
- ret = _tdm_display_load_module(private_display);
- if (ret != TDM_ERROR_NONE)
- goto failed_load;
-
- TDM_TRACE_BEGIN(Update_Display);
- ret = _tdm_display_update_internal(private_display, 0);
- TDM_TRACE_END();
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
-
- TDM_TRACE_BEGIN(Bufmgr_Init);
- ret = _tdm_display_init_bufmgr(private_display);
- TDM_TRACE_END();
- if (ret != TDM_ERROR_NONE)
- goto failed_update;
-
- private_display->init_count = 1;
-
- g_private_display = private_display;
-
- if (error)
- *error = TDM_ERROR_NONE;
-
- pthread_mutex_unlock(&gLock);
-
- return (tdm_display*)private_display;
+ tdm_private_display *private_display = NULL;
+ const char *debug;
+ tdm_error ret;
+
+ pthread_mutex_lock(&gLock);
+
+ if (g_private_display) {
+ g_private_display->init_count++;
+ pthread_mutex_unlock(&gLock);
+ if (error)
+ *error = TDM_ERROR_NONE;
+ return g_private_display;
+ }
+
+ debug = getenv("TDM_DEBUG");
+ if (debug && (strstr(debug, "1")))
+ tdm_debug = 1;
+
+ private_display = calloc(1, sizeof(tdm_private_display));
+ if (!private_display) {
+ ret = TDM_ERROR_OUT_OF_MEMORY;
+ TDM_ERR("'private_display != NULL' failed");
+ goto failed_alloc;
+ }
+
+ if (pthread_mutex_init(&private_display->lock, NULL)) {
+ ret = TDM_ERROR_OPERATION_FAILED;
+ TDM_ERR("mutex init failed: %m");
+ goto failed_mutex_init;
+ }
+
+ ret = _tdm_display_load_module(private_display);
+ if (ret != TDM_ERROR_NONE)
+ goto failed_load;
+
+ TDM_TRACE_BEGIN(Update_Display);
+ ret = _tdm_display_update_internal(private_display, 0);
+ TDM_TRACE_END();
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+
+ TDM_TRACE_BEGIN(Bufmgr_Init);
+ ret = _tdm_display_init_bufmgr(private_display);
+ TDM_TRACE_END();
+ if (ret != TDM_ERROR_NONE)
+ goto failed_update;
+
+ private_display->init_count = 1;
+
+ g_private_display = private_display;
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ pthread_mutex_unlock(&gLock);
+
+ return (tdm_display *)private_display;
failed_update:
- _tdm_display_unload_module(private_display);
+ _tdm_display_unload_module(private_display);
failed_load:
- pthread_mutex_destroy(&private_display->lock);
+ pthread_mutex_destroy(&private_display->lock);
failed_mutex_init:
- free(private_display);
+ free(private_display);
failed_alloc:
- tdm_debug = 0;
- if (error)
- *error = ret;
- pthread_mutex_unlock(&gLock);
- return NULL;
+ tdm_debug = 0;
+ if (error)
+ *error = ret;
+ pthread_mutex_unlock(&gLock);
+ return NULL;
}
EXTERN void
tdm_display_deinit(tdm_display *dpy)
{
- tdm_private_display *private_display = dpy;
+ tdm_private_display *private_display = dpy;
- if (!private_display)
- return;
+ if (!private_display)
+ return;
- pthread_mutex_lock(&gLock);
+ pthread_mutex_lock(&gLock);
- private_display->init_count--;
- if (private_display->init_count > 0)
- {
- pthread_mutex_unlock(&gLock);
- return;
- }
+ private_display->init_count--;
+ if (private_display->init_count > 0) {
+ pthread_mutex_unlock(&gLock);
+ return;
+ }
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (private_display->bufmgr)
- tbm_bufmgr_deinit(private_display->bufmgr);
+ if (private_display->bufmgr)
+ tbm_bufmgr_deinit(private_display->bufmgr);
- _tdm_display_destroy_private_display(private_display);
- _tdm_display_unload_module(private_display);
+ _tdm_display_destroy_private_display(private_display);
+ _tdm_display_unload_module(private_display);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- pthread_mutex_destroy(&private_display->lock);
- free(private_display);
- g_private_display = NULL;
- tdm_debug = 0;
+ pthread_mutex_destroy(&private_display->lock);
+ free(private_display);
+ g_private_display = NULL;
+ tdm_debug = 0;
- pthread_mutex_unlock(&gLock);
+ pthread_mutex_unlock(&gLock);
}
static int
_check_abi_version(tdm_backend_module *module, int abimaj, int abimin)
{
- int major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version);
- int minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version);
+ int major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version);
+ int minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version);
- if (major < abimaj) goto failed;
- if (major > abimaj) return 1;
- if (minor < abimin) goto failed;
- return 1;
+ if (major < abimaj) goto failed;
+ if (major > abimaj) return 1;
+ if (minor < abimin) goto failed;
+ return 1;
failed:
- TDM_ERR("The ABI version(%d.%d) of '%s' is less than %d.%d",
- major, minor, module->name ? module->name : "unknown",
- abimaj, abimin);
- return 0;
+ TDM_ERR("The ABI version(%d.%d) of '%s' is less than %d.%d",
+ major, minor, module->name ? module->name : "unknown",
+ abimaj, abimin);
+ return 0;
}
EXTERN tdm_error
-tdm_backend_register_func_display(tdm_display *dpy, tdm_func_display *func_display)
+tdm_backend_register_func_display(tdm_display *dpy,
+ tdm_func_display *func_display)
{
- tdm_backend_module *module;
+ tdm_backend_module *module;
- BACKEND_FUNC_ENTRY();
+ BACKEND_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(func_display != NULL, TDM_ERROR_INVALID_PARAMETER);
- /* the ABI version of backend module should be more than 1.1 */
- module = private_display->module_data;
- if (_check_abi_version(module, 1, 1) < 0)
- return TDM_ERROR_BAD_MODULE;
+ /* the ABI version of backend module should be more than 1.1 */
+ module = private_display->module_data;
+ if (_check_abi_version(module, 1, 1) < 0)
+ return TDM_ERROR_BAD_MODULE;
- pthread_mutex_lock(&private_display->lock);
- private_display->func_display = *func_display;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ private_display->func_display = *func_display;
+ pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
tdm_backend_register_func_output(tdm_display *dpy, tdm_func_output *func_output)
{
- tdm_backend_module *module;
+ tdm_backend_module *module;
- BACKEND_FUNC_ENTRY();
+ BACKEND_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(func_output != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(func_output != NULL, TDM_ERROR_INVALID_PARAMETER);
- /* the ABI version of backend module should be more than 1.1 */
- module = private_display->module_data;
- if (_check_abi_version(module, 1, 1) < 0)
- return TDM_ERROR_BAD_MODULE;
+ /* the ABI version of backend module should be more than 1.1 */
+ module = private_display->module_data;
+ if (_check_abi_version(module, 1, 1) < 0)
+ return TDM_ERROR_BAD_MODULE;
- pthread_mutex_lock(&private_display->lock);
- private_display->func_output = *func_output;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ private_display->func_output = *func_output;
+ pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
tdm_backend_register_func_layer(tdm_display *dpy, tdm_func_layer *func_layer)
{
- tdm_backend_module *module;
+ tdm_backend_module *module;
- BACKEND_FUNC_ENTRY();
+ BACKEND_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(func_layer != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(func_layer != NULL, TDM_ERROR_INVALID_PARAMETER);
- /* the ABI version of backend module should be more than 1.1 */
- module = private_display->module_data;
- if (_check_abi_version(module, 1, 1) < 0)
- return TDM_ERROR_BAD_MODULE;
+ /* the ABI version of backend module should be more than 1.1 */
+ module = private_display->module_data;
+ if (_check_abi_version(module, 1, 1) < 0)
+ return TDM_ERROR_BAD_MODULE;
- pthread_mutex_lock(&private_display->lock);
- private_display->func_layer = *func_layer;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ private_display->func_layer = *func_layer;
+ pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp)
{
- BACKEND_FUNC_ENTRY();
+ BACKEND_FUNC_ENTRY();
- if (!func_pp)
- return TDM_ERROR_NONE;
+ if (!func_pp)
+ return TDM_ERROR_NONE;
- pthread_mutex_lock(&private_display->lock);
- private_display->capabilities |= TDM_DISPLAY_CAPABILITY_PP;
- private_display->func_pp = *func_pp;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ private_display->capabilities |= TDM_DISPLAY_CAPABILITY_PP;
+ private_display->func_pp = *func_pp;
+ pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
-tdm_backend_register_func_capture(tdm_display *dpy, tdm_func_capture *func_capture)
+tdm_backend_register_func_capture(tdm_display *dpy,
+ tdm_func_capture *func_capture)
{
- BACKEND_FUNC_ENTRY();
+ BACKEND_FUNC_ENTRY();
- if (!func_capture)
- return TDM_ERROR_NONE;
+ if (!func_capture)
+ return TDM_ERROR_NONE;
- pthread_mutex_lock(&private_display->lock);
- private_display->capabilities |= TDM_DISPLAY_CAPABILITY_CAPTURE;
- private_display->func_capture = *func_capture;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ private_display->capabilities |= TDM_DISPLAY_CAPABILITY_CAPTURE;
+ private_display->func_capture = *func_capture;
+ pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
static int tdm_buffer_key;
#define TDM_BUFFER_KEY ((unsigned long)&tdm_buffer_key)
-typedef struct _tdm_buffer_func_info
-{
- tdm_buffer_release_handler release_func;
- tdm_buffer_destroy_handler destroy_func;
- void *user_data;
+typedef struct _tdm_buffer_func_info {
+ tdm_buffer_release_handler release_func;
+ tdm_buffer_destroy_handler destroy_func;
+ void *user_data;
- struct list_head link;
+ struct list_head link;
} tdm_buffer_func_info;
-typedef struct _tdm_buffer_info
-{
- tbm_surface_h buffer;
+typedef struct _tdm_buffer_info {
+ tbm_surface_h buffer;
- /* ref_count for backend */
- int backend_ref_count;
+ /* ref_count for backend */
+ int backend_ref_count;
- struct list_head release_funcs;
- struct list_head destroy_funcs;
+ struct list_head release_funcs;
+ struct list_head destroy_funcs;
} tdm_buffer_info;
static void
_tdm_buffer_destroy_info(void *user_data)
{
- tdm_buffer_info *buf_info = (tdm_buffer_info*)user_data;
- tdm_buffer_func_info *func_info = NULL, *next = NULL;
+ tdm_buffer_info *buf_info = (tdm_buffer_info *)user_data;
+ tdm_buffer_func_info *func_info = NULL, *next = NULL;
- if (buf_info->backend_ref_count > 0)
- TDM_NEVER_GET_HERE();
+ if (buf_info->backend_ref_count > 0)
+ TDM_NEVER_GET_HERE();
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link)
- {
- LIST_DEL(&func_info->link);
- free(func_info);
- }
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link) {
+ LIST_DEL(&func_info->link);
+ free(func_info);
+ }
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link)
- func_info->destroy_func(buf_info->buffer, func_info->user_data);
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link)
+ func_info->destroy_func(buf_info->buffer, func_info->user_data);
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link)
- {
- LIST_DEL(&func_info->link);
- free(func_info);
- }
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link) {
+ LIST_DEL(&func_info->link);
+ free(func_info);
+ }
- free(buf_info);
+ free(buf_info);
}
-static tdm_buffer_info*
+static tdm_buffer_info *
_tdm_buffer_get_info(tbm_surface_h buffer)
{
- tdm_buffer_info *buf_info = NULL;
- tbm_bo bo;
+ tdm_buffer_info *buf_info = NULL;
+ tbm_bo bo;
- bo = tbm_surface_internal_get_bo(buffer, 0);
- TDM_RETURN_VAL_IF_FAIL(bo != NULL, NULL);
+ bo = tbm_surface_internal_get_bo(buffer, 0);
+ TDM_RETURN_VAL_IF_FAIL(bo != NULL, NULL);
- tbm_bo_get_user_data(bo, TDM_BUFFER_KEY, (void**)&buf_info);
+ tbm_bo_get_user_data(bo, TDM_BUFFER_KEY, (void **)&buf_info);
- if (!buf_info)
- {
- buf_info = calloc(1, sizeof(tdm_buffer_info));
- TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, NULL);
+ if (!buf_info) {
+ buf_info = calloc(1, sizeof(tdm_buffer_info));
+ TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, NULL);
- buf_info->buffer = buffer;
+ buf_info->buffer = buffer;
- LIST_INITHEAD(&buf_info->release_funcs);
- LIST_INITHEAD(&buf_info->destroy_funcs);
+ LIST_INITHEAD(&buf_info->release_funcs);
+ LIST_INITHEAD(&buf_info->destroy_funcs);
- tbm_bo_add_user_data(bo, TDM_BUFFER_KEY, _tdm_buffer_destroy_info);
- tbm_bo_set_user_data(bo, TDM_BUFFER_KEY, buf_info);
- }
+ tbm_bo_add_user_data(bo, TDM_BUFFER_KEY, _tdm_buffer_destroy_info);
+ tbm_bo_set_user_data(bo, TDM_BUFFER_KEY, buf_info);
+ }
- return buf_info;
+ return buf_info;
}
EXTERN tdm_error
tdm_buffer_add_release_handler(tbm_surface_h buffer,
tdm_buffer_release_handler func, void *user_data)
{
- tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info;
+ tdm_buffer_info *buf_info;
+ tdm_buffer_func_info *func_info;
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
- func_info = calloc(1, sizeof(tdm_buffer_func_info));
- TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ func_info = calloc(1, sizeof(tdm_buffer_func_info));
+ TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
- func_info->release_func = func;
- func_info->user_data = user_data;
+ func_info->release_func = func;
+ func_info->user_data = user_data;
- LIST_ADD(&func_info->link, &buf_info->release_funcs);
+ LIST_ADD(&func_info->link, &buf_info->release_funcs);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN void
-tdm_buffer_remove_release_handler(tbm_surface_h buffer, tdm_buffer_release_handler func, void *user_data)
+tdm_buffer_remove_release_handler(tbm_surface_h buffer,
+ tdm_buffer_release_handler func, void *user_data)
{
- tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info = NULL, *next = NULL;
+ tdm_buffer_info *buf_info;
+ tdm_buffer_func_info *func_info = NULL, *next = NULL;
- TDM_RETURN_IF_FAIL(buffer != NULL);
- TDM_RETURN_IF_FAIL(func != NULL);
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+ TDM_RETURN_IF_FAIL(func != NULL);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_IF_FAIL(buf_info != NULL);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_IF_FAIL(buf_info != NULL);
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link)
- {
- if (func_info->release_func != func || func_info->user_data != user_data)
- continue;
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link) {
+ if (func_info->release_func != func || func_info->user_data != user_data)
+ continue;
- LIST_DEL(&func_info->link);
- free(func_info);
+ LIST_DEL(&func_info->link);
+ free(func_info);
- return;
- }
+ return;
+ }
}
EXTERN tbm_surface_h
tdm_buffer_ref_backend(tbm_surface_h buffer)
{
- tdm_buffer_info *buf_info;
+ tdm_buffer_info *buf_info;
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, NULL);
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, NULL);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, NULL);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, NULL);
- buf_info->backend_ref_count++;
+ buf_info->backend_ref_count++;
- return buffer;
+ return buffer;
}
EXTERN void
tdm_buffer_unref_backend(tbm_surface_h buffer)
{
- tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info = NULL, *next = NULL;
+ tdm_buffer_info *buf_info;
+ tdm_buffer_func_info *func_info = NULL, *next = NULL;
- TDM_RETURN_IF_FAIL(buffer != NULL);
+ TDM_RETURN_IF_FAIL(buffer != NULL);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_IF_FAIL(buf_info != NULL);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_IF_FAIL(buf_info != NULL);
- buf_info->backend_ref_count--;
+ buf_info->backend_ref_count--;
- if (buf_info->backend_ref_count > 0)
- return;
+ if (buf_info->backend_ref_count > 0)
+ return;
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link)
- {
- tbm_surface_internal_ref(buffer);
- func_info->release_func(buffer, func_info->user_data);
- tbm_surface_internal_unref(buffer);
- }
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link) {
+ tbm_surface_internal_ref(buffer);
+ func_info->release_func(buffer, func_info->user_data);
+ tbm_surface_internal_unref(buffer);
+ }
}
EXTERN tdm_error
-tdm_buffer_add_destroy_handler(tbm_surface_h buffer, tdm_buffer_destroy_handler func, void *user_data)
+tdm_buffer_add_destroy_handler(tbm_surface_h buffer,
+ tdm_buffer_destroy_handler func, void *user_data)
{
- tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info;
+ tdm_buffer_info *buf_info;
+ tdm_buffer_func_info *func_info;
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_VAL_IF_FAIL(buf_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
- func_info = calloc(1, sizeof(tdm_buffer_func_info));
- TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
+ func_info = calloc(1, sizeof(tdm_buffer_func_info));
+ TDM_RETURN_VAL_IF_FAIL(func_info != NULL, TDM_ERROR_OUT_OF_MEMORY);
- func_info->destroy_func = func;
- func_info->user_data = user_data;
+ func_info->destroy_func = func;
+ func_info->user_data = user_data;
- LIST_ADD(&func_info->link, &buf_info->destroy_funcs);
+ LIST_ADD(&func_info->link, &buf_info->destroy_funcs);
- return TDM_ERROR_NONE;
+ return TDM_ERROR_NONE;
}
EXTERN void
-tdm_buffer_remove_destroy_handler(tbm_surface_h buffer, tdm_buffer_destroy_handler func, void *user_data)
+tdm_buffer_remove_destroy_handler(tbm_surface_h buffer,
+ tdm_buffer_destroy_handler func, void *user_data)
{
- tdm_buffer_info *buf_info;
- tdm_buffer_func_info *func_info = NULL, *next = NULL;
+ tdm_buffer_info *buf_info;
+ tdm_buffer_func_info *func_info = NULL, *next = NULL;
- TDM_RETURN_IF_FAIL(buffer != NULL);
- TDM_RETURN_IF_FAIL(func != NULL);
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+ TDM_RETURN_IF_FAIL(func != NULL);
- buf_info = _tdm_buffer_get_info(buffer);
- TDM_RETURN_IF_FAIL(buf_info != NULL);
+ buf_info = _tdm_buffer_get_info(buffer);
+ TDM_RETURN_IF_FAIL(buf_info != NULL);
- LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link)
- {
- if (func_info->destroy_func != func || func_info->user_data != user_data)
- continue;
+ LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->destroy_funcs, link) {
+ if (func_info->destroy_func != func || func_info->user_data != user_data)
+ continue;
- LIST_DEL(&func_info->link);
- free(func_info);
+ LIST_DEL(&func_info->link);
+ free(func_info);
- return;
- }
+ return;
+ }
}
func_capture = &private_display->func_capture
static void
-_tdm_caputre_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer, void *user_data)
+_tdm_caputre_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer,
+ void *user_data)
{
- tdm_private_capture *private_capture = user_data;
- tdm_private_display *private_display = private_capture->private_display;
- int lock_after_cb_done = 0;
- int ret;
-
- ret = pthread_mutex_trylock(&private_display->lock);
- if (ret == 0)
- pthread_mutex_unlock(&private_display->lock);
- else if (ret == EBUSY)
- {
- pthread_mutex_unlock(&private_display->lock);
- lock_after_cb_done = 1;
- }
-
- tdm_buffer_unref_backend(buffer);
-
- if (lock_after_cb_done)
- pthread_mutex_lock(&private_display->lock);
+ tdm_private_capture *private_capture = user_data;
+ tdm_private_display *private_display = private_capture->private_display;
+ int lock_after_cb_done = 0;
+ int ret;
+
+ ret = pthread_mutex_trylock(&private_display->lock);
+ if (ret == 0)
+ pthread_mutex_unlock(&private_display->lock);
+ else if (ret == EBUSY) {
+ pthread_mutex_unlock(&private_display->lock);
+ lock_after_cb_done = 1;
+ }
+
+ tdm_buffer_unref_backend(buffer);
+
+ if (lock_after_cb_done)
+ pthread_mutex_lock(&private_display->lock);
}
-INTERN tdm_private_capture*
-tdm_capture_create_output_internal(tdm_private_output *private_output, tdm_error *error)
+INTERN tdm_private_capture *
+tdm_capture_create_output_internal(tdm_private_output *private_output,
+ tdm_error *error)
{
- tdm_private_display *private_display = private_output->private_display;
- tdm_func_output *func_output = &private_display->func_output;
- tdm_func_capture *func_capture = &private_display->func_capture;
- tdm_private_capture *private_capture = NULL;
- tdm_capture *capture_backend = NULL;
- tdm_error ret = TDM_ERROR_NONE;
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
- {
- TDM_ERR("no capture capability");
- if (error)
- *error = TDM_ERROR_NO_CAPABILITY;
- return NULL;
- }
-
- capture_backend = func_output->output_create_capture(private_output->output_backend, &ret);
- if (ret != TDM_ERROR_NONE)
- {
- if (error)
- *error = ret;
- return NULL;
- }
-
- private_capture = calloc(1, sizeof(tdm_private_capture));
- if (!private_capture)
- {
- TDM_ERR("failed: alloc memory");
- func_capture->capture_destroy(capture_backend);
- if (error)
- *error = TDM_ERROR_OUT_OF_MEMORY;
- return NULL;
- }
-
- ret = func_capture->capture_set_done_handler(capture_backend, _tdm_caputre_cb_done, private_capture);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("set capture_done_handler failed");
- func_capture->capture_destroy(capture_backend);
- if (error)
- *error = ret;
- return NULL;
- }
-
- LIST_ADD(&private_capture->link, &private_output->capture_list);
- private_capture->target = TDM_CAPTURE_TARGET_OUTPUT;
- private_capture->private_display = private_display;
- private_capture->private_output = private_output;
- private_capture->private_layer = NULL;
- private_capture->capture_backend = capture_backend;
-
- if (error)
- *error = TDM_ERROR_NONE;
-
- return private_capture;
+ tdm_private_display *private_display = private_output->private_display;
+ tdm_func_output *func_output = &private_display->func_output;
+ tdm_func_capture *func_capture = &private_display->func_capture;
+ tdm_private_capture *private_capture = NULL;
+ tdm_capture *capture_backend = NULL;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) {
+ TDM_ERR("no capture capability");
+ if (error)
+ *error = TDM_ERROR_NO_CAPABILITY;
+ return NULL;
+ }
+
+ capture_backend = func_output->output_create_capture(
+ private_output->output_backend, &ret);
+ if (ret != TDM_ERROR_NONE) {
+ if (error)
+ *error = ret;
+ return NULL;
+ }
+
+ private_capture = calloc(1, sizeof(tdm_private_capture));
+ if (!private_capture) {
+ TDM_ERR("failed: alloc memory");
+ func_capture->capture_destroy(capture_backend);
+ if (error)
+ *error = TDM_ERROR_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ ret = func_capture->capture_set_done_handler(capture_backend,
+ _tdm_caputre_cb_done, private_capture);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("set capture_done_handler failed");
+ func_capture->capture_destroy(capture_backend);
+ if (error)
+ *error = ret;
+ return NULL;
+ }
+
+ LIST_ADD(&private_capture->link, &private_output->capture_list);
+ private_capture->target = TDM_CAPTURE_TARGET_OUTPUT;
+ private_capture->private_display = private_display;
+ private_capture->private_output = private_output;
+ private_capture->private_layer = NULL;
+ private_capture->capture_backend = capture_backend;
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return private_capture;
}
-INTERN tdm_private_capture*
-tdm_capture_create_layer_internal(tdm_private_layer *private_layer, tdm_error *error)
+INTERN tdm_private_capture *
+tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
+ tdm_error *error)
{
- tdm_private_output *private_output = private_layer->private_output;
- tdm_private_display *private_display = private_output->private_display;
- tdm_func_layer *func_layer = &private_display->func_layer;
- tdm_func_capture *func_capture = &private_display->func_capture;
- tdm_private_capture *private_capture = NULL;
- tdm_capture *capture_backend = NULL;
- tdm_error ret = TDM_ERROR_NONE;
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
- {
- TDM_ERR("no capture capability");
- if (error)
- *error = TDM_ERROR_NO_CAPABILITY;
- return NULL;
- }
-
- capture_backend = func_layer->layer_create_capture(private_layer->layer_backend, &ret);
- if (ret != TDM_ERROR_NONE)
- return NULL;
-
- private_capture = calloc(1, sizeof(tdm_private_capture));
- if (!private_capture)
- {
- TDM_ERR("failed: alloc memory");
- func_capture->capture_destroy(capture_backend);
- if (error)
- *error = TDM_ERROR_OUT_OF_MEMORY;
- return NULL;
- }
-
- LIST_ADD(&private_capture->link, &private_output->capture_list);
- private_capture->target = TDM_CAPTURE_TARGET_LAYER;
- private_capture->private_display = private_display;
- private_capture->private_output = private_output;
- private_capture->private_layer = private_layer;
- private_capture->capture_backend = capture_backend;
-
- if (error)
- *error = TDM_ERROR_NONE;
-
- return private_capture;
+ tdm_private_output *private_output = private_layer->private_output;
+ tdm_private_display *private_display = private_output->private_display;
+ tdm_func_layer *func_layer = &private_display->func_layer;
+ tdm_func_capture *func_capture = &private_display->func_capture;
+ tdm_private_capture *private_capture = NULL;
+ tdm_capture *capture_backend = NULL;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) {
+ TDM_ERR("no capture capability");
+ if (error)
+ *error = TDM_ERROR_NO_CAPABILITY;
+ return NULL;
+ }
+
+ capture_backend = func_layer->layer_create_capture(private_layer->layer_backend,
+ &ret);
+ if (ret != TDM_ERROR_NONE)
+ return NULL;
+
+ private_capture = calloc(1, sizeof(tdm_private_capture));
+ if (!private_capture) {
+ TDM_ERR("failed: alloc memory");
+ func_capture->capture_destroy(capture_backend);
+ if (error)
+ *error = TDM_ERROR_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ LIST_ADD(&private_capture->link, &private_output->capture_list);
+ private_capture->target = TDM_CAPTURE_TARGET_LAYER;
+ private_capture->private_display = private_display;
+ private_capture->private_output = private_output;
+ private_capture->private_layer = private_layer;
+ private_capture->capture_backend = capture_backend;
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return private_capture;
}
INTERN void
tdm_capture_destroy_internal(tdm_private_capture *private_capture)
{
- tdm_func_capture *func_capture;
+ tdm_func_capture *func_capture;
- if (!private_capture)
- return;
+ if (!private_capture)
+ return;
- LIST_DEL(&private_capture->link);
+ LIST_DEL(&private_capture->link);
- func_capture = &private_capture->private_display->func_capture;
- func_capture->capture_destroy(private_capture->capture_backend);
+ func_capture = &private_capture->private_display->func_capture;
+ func_capture->capture_destroy(private_capture->capture_backend);
- free(private_capture);
+ free(private_capture);
}
EXTERN void
tdm_capture_destroy(tdm_capture *capture)
{
- tdm_private_capture *private_capture = capture;
- tdm_private_display *private_display;
+ tdm_private_capture *private_capture = capture;
+ tdm_private_display *private_display;
- if (!private_capture)
- return;
+ if (!private_capture)
+ return;
- private_display = private_capture->private_display;
+ private_display = private_capture->private_display;
- pthread_mutex_lock(&private_display->lock);
- tdm_capture_destroy_internal(private_capture);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ tdm_capture_destroy_internal(private_capture);
+ pthread_mutex_unlock(&private_display->lock);
}
EXTERN tdm_error
tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info)
{
- CAPTURE_FUNC_ENTRY();
+ CAPTURE_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_capture->capture_set_info)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_capture->capture_set_info) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_capture->capture_set_info(private_capture->capture_backend, info);
+ ret = func_capture->capture_set_info(private_capture->capture_backend, info);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer)
{
- CAPTURE_FUNC_ENTRY();
+ CAPTURE_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_capture->capture_attach)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_capture->capture_attach) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- tdm_buffer_ref_backend(buffer);
- ret = func_capture->capture_attach(private_capture->capture_backend, buffer);
+ tdm_buffer_ref_backend(buffer);
+ ret = func_capture->capture_attach(private_capture->capture_backend, buffer);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_capture_commit(tdm_capture *capture)
{
- CAPTURE_FUNC_ENTRY();
+ CAPTURE_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_capture->capture_commit)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_capture->capture_commit) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_capture->capture_commit(private_capture->capture_backend);
+ ret = func_capture->capture_commit(private_capture->capture_backend);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
private_display = private_output->private_display
EXTERN tdm_error
-tdm_display_get_capabilities(tdm_display *dpy, tdm_display_capability *capabilities)
+tdm_display_get_capabilities(tdm_display *dpy,
+ tdm_display_capability *capabilities)
{
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *capabilities = private_display->capabilities;
+ *capabilities = private_display->capabilities;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_display_get_pp_capabilities(tdm_display *dpy, tdm_pp_capability *capabilities)
+tdm_display_get_pp_capabilities(tdm_display *dpy,
+ tdm_pp_capability *capabilities)
{
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
- {
- TDM_ERR("no pp capability");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NO_CAPABILITY;
- }
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) {
+ TDM_ERR("no pp capability");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NO_CAPABILITY;
+ }
- *capabilities = private_display->caps_pp.capabilities;
+ *capabilities = private_display->caps_pp.capabilities;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_display_get_pp_available_formats(tdm_display *dpy, const tbm_format **formats, int *count)
+tdm_display_get_pp_available_formats(tdm_display *dpy,
+ const tbm_format **formats, int *count)
{
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
- {
- TDM_ERR("no pp capability");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NO_CAPABILITY;
- }
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) {
+ TDM_ERR("no pp capability");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NO_CAPABILITY;
+ }
- *formats = (const tbm_format*)private_display->caps_pp.formats;
- *count = private_display->caps_pp.format_count;
+ *formats = (const tbm_format *)private_display->caps_pp.formats;
+ *count = private_display->caps_pp.format_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
int *max_w, int *max_h, int *preferred_align)
{
- DISPLAY_FUNC_ENTRY();
-
- pthread_mutex_lock(&private_display->lock);
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
- {
- TDM_ERR("no pp capability");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NO_CAPABILITY;
- }
-
- if (min_w)
- *min_w = private_display->caps_pp.min_w;
- if (min_h)
- *min_h = private_display->caps_pp.min_h;
- if (max_w)
- *max_w = private_display->caps_pp.max_w;
- if (max_h)
- *max_h = private_display->caps_pp.max_h;
- if (preferred_align)
- *preferred_align = private_display->caps_pp.preferred_align;
-
- pthread_mutex_unlock(&private_display->lock);
-
- return ret;
+ DISPLAY_FUNC_ENTRY();
+
+ pthread_mutex_lock(&private_display->lock);
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) {
+ TDM_ERR("no pp capability");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NO_CAPABILITY;
+ }
+
+ if (min_w)
+ *min_w = private_display->caps_pp.min_w;
+ if (min_h)
+ *min_h = private_display->caps_pp.min_h;
+ if (max_w)
+ *max_w = private_display->caps_pp.max_w;
+ if (max_h)
+ *max_h = private_display->caps_pp.max_h;
+ if (preferred_align)
+ *preferred_align = private_display->caps_pp.preferred_align;
+
+ pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
}
EXTERN tdm_error
-tdm_display_get_capture_capabilities(tdm_display *dpy, tdm_capture_capability *capabilities)
+tdm_display_get_capture_capabilities(tdm_display *dpy,
+ tdm_capture_capability *capabilities)
{
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
- {
- TDM_ERR("no capture capability");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NO_CAPABILITY;
- }
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) {
+ TDM_ERR("no capture capability");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NO_CAPABILITY;
+ }
- *capabilities = private_display->caps_capture.capabilities;
+ *capabilities = private_display->caps_capture.capabilities;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_display_get_catpure_available_formats(tdm_display *dpy, const tbm_format **formats, int *count)
+tdm_display_get_catpure_available_formats(tdm_display *dpy,
+ const tbm_format **formats, int *count)
{
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE))
- {
- TDM_ERR("no capture capability");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NO_CAPABILITY;
- }
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) {
+ TDM_ERR("no capture capability");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NO_CAPABILITY;
+ }
- *formats = (const tbm_format*)private_display->caps_capture.formats;
- *count = private_display->caps_capture.format_count;
+ *formats = (const tbm_format *)private_display->caps_capture.formats;
+ *count = private_display->caps_capture.format_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_display_get_output_count(tdm_display *dpy, int *count)
{
- tdm_private_output *private_output = NULL;
+ tdm_private_output *private_output = NULL;
- DISPLAY_FUNC_ENTRY();
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *count = 0;
- LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link)
- (*count)++;
+ *count = 0;
+ LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link)
+ (*count)++;
- if (*count == 0)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (*count == 0) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
-EXTERN tdm_output*
+EXTERN tdm_output *
tdm_display_get_output(tdm_display *dpy, int index, tdm_error *error)
{
- tdm_private_output *private_output = NULL;
- int i = 0;
+ tdm_private_output *private_output = NULL;
+ int i = 0;
- DISPLAY_FUNC_ENTRY_ERROR();
+ DISPLAY_FUNC_ENTRY_ERROR();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (error)
- *error = TDM_ERROR_NONE;
+ if (error)
+ *error = TDM_ERROR_NONE;
- i = 0;
- LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link)
- {
- if (i == index)
- {
- pthread_mutex_unlock(&private_display->lock);
- return private_output;
- }
- i++;
- }
+ i = 0;
+ LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) {
+ if (i == index) {
+ pthread_mutex_unlock(&private_display->lock);
+ return private_output;
+ }
+ i++;
+ }
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return NULL;
+ return NULL;
}
EXTERN tdm_error
tdm_display_get_fd(tdm_display *dpy, int *fd)
{
- tdm_func_display *func_display;
- DISPLAY_FUNC_ENTRY();
+ tdm_func_display *func_display;
+ DISPLAY_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(fd != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(fd != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_display = &private_display->func_display;
+ func_display = &private_display->func_display;
- if (!func_display->display_get_fd)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_display->display_get_fd) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_display->display_get_fd(private_display->bdata, fd);
+ ret = func_display->display_get_fd(private_display->bdata, fd);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_display_handle_events(tdm_display *dpy)
{
- tdm_func_display *func_display;
- DISPLAY_FUNC_ENTRY();
+ tdm_func_display *func_display;
+ DISPLAY_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_display = &private_display->func_display;
+ func_display = &private_display->func_display;
- if (!func_display->display_handle_events)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_display->display_handle_events) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_display->display_handle_events(private_display->bdata);
+ ret = func_display->display_handle_events(private_display->bdata);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
-EXTERN tdm_pp*
+EXTERN tdm_pp *
tdm_display_create_pp(tdm_display *dpy, tdm_error *error)
{
- tdm_pp *pp;
+ tdm_pp *pp;
- DISPLAY_FUNC_ENTRY_ERROR();
+ DISPLAY_FUNC_ENTRY_ERROR();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- pp = (tdm_pp*)tdm_pp_create_internal(private_display, error);
+ pp = (tdm_pp *)tdm_pp_create_internal(private_display, error);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return pp;
+ return pp;
}
EXTERN tdm_error
-tdm_output_get_model_info(tdm_output *output, const char **maker, const char **model, const char **name)
+tdm_output_get_model_info(tdm_output *output, const char **maker,
+ const char **model, const char **name)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (maker)
- *maker = private_output->caps.maker;
- if (model)
- *model = private_output->caps.model;
- if (name)
- *name = private_output->caps.name;
+ if (maker)
+ *maker = private_output->caps.maker;
+ if (model)
+ *model = private_output->caps.model;
+ if (name)
+ *name = private_output->caps.name;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(status != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(status != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *status = private_output->caps.status;
+ *status = private_output->caps.status;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_output_type(tdm_output *output, tdm_output_type *type)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(type != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(type != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *type = private_output->caps.type;
+ *type = private_output->caps.type;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_layer_count(tdm_output *output, int *count)
{
- tdm_private_layer *private_layer = NULL;
+ tdm_private_layer *private_layer = NULL;
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *count = 0;
- LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
- (*count)++;
- if (*count == 0)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ *count = 0;
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
+ (*count)++;
+ if (*count == 0) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
-EXTERN tdm_layer*
+EXTERN tdm_layer *
tdm_output_get_layer(tdm_output *output, int index, tdm_error *error)
{
- tdm_private_layer *private_layer = NULL;
- int i = 0;
+ tdm_private_layer *private_layer = NULL;
+ int i = 0;
- OUTPUT_FUNC_ENTRY_ERROR();
+ OUTPUT_FUNC_ENTRY_ERROR();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (error)
- *error = TDM_ERROR_NONE;
+ if (error)
+ *error = TDM_ERROR_NONE;
- LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
- {
- if (i == index)
- {
- pthread_mutex_unlock(&private_display->lock);
- return private_layer;
- }
- i++;
- }
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
+ if (i == index) {
+ pthread_mutex_unlock(&private_display->lock);
+ return private_layer;
+ }
+ i++;
+ }
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return NULL;
+ return NULL;
}
EXTERN tdm_error
-tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props, int *count)
+tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
+ int *count)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *props = (const tdm_prop*)private_output->caps.props;
- *count = private_output->caps.prop_count;
+ *props = (const tdm_prop *)private_output->caps.props;
+ *count = private_output->caps.prop_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_output_get_available_modes(tdm_output *output, const tdm_output_mode **modes, int *count)
+tdm_output_get_available_modes(tdm_output *output,
+ const tdm_output_mode **modes, int *count)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(modes != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(modes != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *modes = (const tdm_output_mode*)private_output->caps.modes;
- *count = private_output->caps.mode_count;
+ *modes = (const tdm_output_mode *)private_output->caps.modes;
+ *count = private_output->caps.mode_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
int *max_w, int *max_h, int *preferred_align)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (min_w)
- *min_w = private_output->caps.min_w;
- if (min_h)
- *min_h = private_output->caps.min_h;
- if (max_w)
- *max_w = private_output->caps.max_w;
- if (max_h)
- *max_h = private_output->caps.max_h;
- if (preferred_align)
- *preferred_align = private_output->caps.preferred_align;
+ if (min_w)
+ *min_w = private_output->caps.min_w;
+ if (min_h)
+ *min_h = private_output->caps.min_h;
+ if (max_w)
+ *max_w = private_output->caps.max_w;
+ if (max_h)
+ *max_h = private_output->caps.max_h;
+ if (preferred_align)
+ *preferred_align = private_output->caps.preferred_align;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth, unsigned int *mmHeight)
+tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
+ unsigned int *mmHeight)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (mmWidth)
- *mmWidth = private_output->caps.mmWidth;
- if (mmHeight)
- *mmHeight = private_output->caps.mmHeight;
+ if (mmWidth)
+ *mmWidth = private_output->caps.mmWidth;
+ if (mmHeight)
+ *mmHeight = private_output->caps.mmHeight;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_subpixel(tdm_output *output, unsigned int *subpixel)
{
- OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(subpixel != NULL, TDM_ERROR_INVALID_PARAMETER);
+ OUTPUT_FUNC_ENTRY();
+ TDM_RETURN_VAL_IF_FAIL(subpixel != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *subpixel = private_output->caps.subpixel;
+ *subpixel = private_output->caps.subpixel;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_pipe(tdm_output *output, unsigned int *pipe)
{
- OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(pipe != NULL, TDM_ERROR_INVALID_PARAMETER);
+ OUTPUT_FUNC_ENTRY();
+ TDM_RETURN_VAL_IF_FAIL(pipe != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *pipe = private_output->pipe;
+ *pipe = private_output->pipe;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_set_property)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_set_property) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_set_property(private_output->output_backend, id, value);
+ ret = func_output->output_set_property(private_output->output_backend, id,
+ value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(value != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(value != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_get_property)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_get_property) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_get_property(private_output->output_backend, id, value);
+ ret = func_output->output_get_property(private_output->output_backend, id,
+ value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
static void
_tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence,
unsigned int tv_sec, unsigned int tv_usec, void *user_data)
{
- tdm_private_vblank_handler *vblank_handler = user_data;
- tdm_private_display *private_display;
+ tdm_private_vblank_handler *vblank_handler = user_data;
+ tdm_private_display *private_display;
- TDM_RETURN_IF_FAIL(vblank_handler);
+ TDM_RETURN_IF_FAIL(vblank_handler);
- private_display = vblank_handler->private_output->private_display;
+ private_display = vblank_handler->private_output->private_display;
- if (vblank_handler->func)
- {
- pthread_mutex_unlock(&private_display->lock);
- vblank_handler->func(vblank_handler->private_output, sequence,
- tv_sec, tv_usec, vblank_handler->user_data);
- pthread_mutex_lock(&private_display->lock);
- }
+ if (vblank_handler->func) {
+ pthread_mutex_unlock(&private_display->lock);
+ vblank_handler->func(vblank_handler->private_output, sequence,
+ tv_sec, tv_usec, vblank_handler->user_data);
+ pthread_mutex_lock(&private_display->lock);
+ }
- LIST_DEL(&vblank_handler->link);
- free(vblank_handler);
+ LIST_DEL(&vblank_handler->link);
+ free(vblank_handler);
}
static void
_tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence,
unsigned int tv_sec, unsigned int tv_usec, void *user_data)
{
- tdm_private_commit_handler *commit_handler = user_data;
- tdm_private_display *private_display;
- tdm_private_output *private_output;
- tdm_private_layer *private_layer = NULL;
-
- TDM_RETURN_IF_FAIL(commit_handler);
-
- private_output = commit_handler->private_output;
- private_display = private_output->private_display;
-
- LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link)
- {
- if (!private_layer->waiting_buffer)
- continue;
-
- if (private_layer->showing_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->showing_buffer);
- pthread_mutex_lock(&private_display->lock);
-
- if (private_layer->buffer_queue)
- {
- pthread_mutex_unlock(&private_display->lock);
- tbm_surface_queue_release(private_layer->buffer_queue,
- private_layer->showing_buffer);
- pthread_mutex_lock(&private_display->lock);
- }
- }
-
- private_layer->showing_buffer = private_layer->waiting_buffer;
- private_layer->waiting_buffer = NULL;
- }
-
- if (commit_handler->func)
- {
- pthread_mutex_unlock(&private_display->lock);
- commit_handler->func(private_output, sequence,
- tv_sec, tv_usec, commit_handler->user_data);
- pthread_mutex_lock(&private_display->lock);
- }
-
- LIST_DEL(&commit_handler->link);
- free(commit_handler);
+ tdm_private_commit_handler *commit_handler = user_data;
+ tdm_private_display *private_display;
+ tdm_private_output *private_output;
+ tdm_private_layer *private_layer = NULL;
+
+ TDM_RETURN_IF_FAIL(commit_handler);
+
+ private_output = commit_handler->private_output;
+ private_display = private_output->private_display;
+
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
+ if (!private_layer->waiting_buffer)
+ continue;
+
+ if (private_layer->showing_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+
+ if (private_layer->buffer_queue) {
+ pthread_mutex_unlock(&private_display->lock);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ }
+ }
+
+ private_layer->showing_buffer = private_layer->waiting_buffer;
+ private_layer->waiting_buffer = NULL;
+ }
+
+ if (commit_handler->func) {
+ pthread_mutex_unlock(&private_display->lock);
+ commit_handler->func(private_output, sequence,
+ tv_sec, tv_usec, commit_handler->user_data);
+ pthread_mutex_lock(&private_display->lock);
+ }
+
+ LIST_DEL(&commit_handler->link);
+ free(commit_handler);
}
EXTERN tdm_error
tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
tdm_output_vblank_handler func, void *user_data)
{
- tdm_func_output *func_output;
- tdm_private_vblank_handler *vblank_handler;
- OUTPUT_FUNC_ENTRY();
-
- pthread_mutex_lock(&private_display->lock);
-
- func_output = &private_display->func_output;
-
- if (!func_output->output_wait_vblank)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
-
- vblank_handler = calloc(1, sizeof(tdm_private_vblank_handler));
- if (!vblank_handler)
- {
- TDM_ERR("failed: alloc memory");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_OUT_OF_MEMORY;
- }
-
- LIST_ADD(&vblank_handler->link, &private_output->vblank_handler_list);
- vblank_handler->private_output = private_output;
- vblank_handler->func = func;
- vblank_handler->user_data = user_data;
-
- ret = func_output->output_wait_vblank(private_output->output_backend, interval,
- sync, vblank_handler);
- if (ret != TDM_ERROR_NONE)
- {
- pthread_mutex_unlock(&private_display->lock);
- return ret;
- }
-
- if (!private_output->regist_vblank_cb)
- {
- private_output->regist_vblank_cb = 1;
- ret = func_output->output_set_vblank_handler(private_output->output_backend,
- _tdm_output_cb_vblank);
- }
-
- pthread_mutex_unlock(&private_display->lock);
-
- return ret;
+ tdm_func_output *func_output;
+ tdm_private_vblank_handler *vblank_handler;
+ OUTPUT_FUNC_ENTRY();
+
+ pthread_mutex_lock(&private_display->lock);
+
+ func_output = &private_display->func_output;
+
+ if (!func_output->output_wait_vblank) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ vblank_handler = calloc(1, sizeof(tdm_private_vblank_handler));
+ if (!vblank_handler) {
+ TDM_ERR("failed: alloc memory");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_OUT_OF_MEMORY;
+ }
+
+ LIST_ADD(&vblank_handler->link, &private_output->vblank_handler_list);
+ vblank_handler->private_output = private_output;
+ vblank_handler->func = func;
+ vblank_handler->user_data = user_data;
+
+ ret = func_output->output_wait_vblank(private_output->output_backend, interval,
+ sync, vblank_handler);
+ if (ret != TDM_ERROR_NONE) {
+ pthread_mutex_unlock(&private_display->lock);
+ return ret;
+ }
+
+ if (!private_output->regist_vblank_cb) {
+ private_output->regist_vblank_cb = 1;
+ ret = func_output->output_set_vblank_handler(private_output->output_backend,
+ _tdm_output_cb_vblank);
+ }
+
+ pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
}
static tdm_error
-_tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data)
+_tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
+ void *user_data)
{
- tdm_func_output *func_output;
- tdm_private_commit_handler *commit_handler;
- OUTPUT_FUNC_ENTRY();
-
- func_output = &private_display->func_output;
-
- if (!func_output->output_commit)
- {
- return TDM_ERROR_NONE;
- }
-
- commit_handler = calloc(1, sizeof(tdm_private_commit_handler));
- if (!commit_handler)
- {
- TDM_ERR("failed: alloc memory");
- return TDM_ERROR_OUT_OF_MEMORY;
- }
-
- LIST_ADD(&commit_handler->link, &private_output->commit_handler_list);
- commit_handler->private_output = private_output;
- commit_handler->func = func;
- commit_handler->user_data = user_data;
-
- ret = func_output->output_commit(private_output->output_backend, sync, commit_handler);
- if (ret != TDM_ERROR_NONE)
- {
- return ret;
- }
-
- if (!private_output->regist_commit_cb)
- {
- private_output->regist_commit_cb = 1;
- ret = func_output->output_set_commit_handler(private_output->output_backend,
- _tdm_output_cb_commit);
- }
-
- return ret;
+ tdm_func_output *func_output;
+ tdm_private_commit_handler *commit_handler;
+ OUTPUT_FUNC_ENTRY();
+
+ func_output = &private_display->func_output;
+
+ if (!func_output->output_commit) {
+ return TDM_ERROR_NONE;
+ }
+
+ commit_handler = calloc(1, sizeof(tdm_private_commit_handler));
+ if (!commit_handler) {
+ TDM_ERR("failed: alloc memory");
+ return TDM_ERROR_OUT_OF_MEMORY;
+ }
+
+ LIST_ADD(&commit_handler->link, &private_output->commit_handler_list);
+ commit_handler->private_output = private_output;
+ commit_handler->func = func;
+ commit_handler->user_data = user_data;
+
+ ret = func_output->output_commit(private_output->output_backend, sync,
+ commit_handler);
+ if (ret != TDM_ERROR_NONE) {
+ return ret;
+ }
+
+ if (!private_output->regist_commit_cb) {
+ private_output->regist_commit_cb = 1;
+ ret = func_output->output_set_commit_handler(private_output->output_backend,
+ _tdm_output_cb_commit);
+ }
+
+ return ret;
}
EXTERN tdm_error
-tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data)
+tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
+ void *user_data)
{
- OUTPUT_FUNC_ENTRY();
+ OUTPUT_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- ret = _tdm_output_commit(output, sync, func, user_data);
+ ret = _tdm_output_commit(output, sync, func, user_data);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(mode != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(mode != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_set_mode)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_set_mode) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_set_mode(private_output->output_backend, mode);
+ ret = func_output->output_set_mode(private_output->output_backend, mode);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_mode(tdm_output *output, const tdm_output_mode **mode)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(mode != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(mode != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_get_mode)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_get_mode) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_get_mode(private_output->output_backend, mode);
+ ret = func_output->output_get_mode(private_output->output_backend, mode);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- if (dpms_value < TDM_OUTPUT_DPMS_ON)
- dpms_value = TDM_OUTPUT_DPMS_ON;
- else if (dpms_value > TDM_OUTPUT_DPMS_OFF)
- dpms_value = TDM_OUTPUT_DPMS_OFF;
+ if (dpms_value < TDM_OUTPUT_DPMS_ON)
+ dpms_value = TDM_OUTPUT_DPMS_ON;
+ else if (dpms_value > TDM_OUTPUT_DPMS_OFF)
+ dpms_value = TDM_OUTPUT_DPMS_OFF;
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_set_dpms)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_set_dpms) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_set_dpms(private_output->output_backend, dpms_value);
+ ret = func_output->output_set_dpms(private_output->output_backend, dpms_value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value)
{
- tdm_func_output *func_output;
- OUTPUT_FUNC_ENTRY();
+ tdm_func_output *func_output;
+ OUTPUT_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(dpms_value != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(dpms_value != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_output = &private_display->func_output;
+ func_output = &private_display->func_output;
- if (!func_output->output_get_dpms)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_output->output_get_dpms) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_output->output_get_dpms(private_output->output_backend, dpms_value);
+ ret = func_output->output_get_dpms(private_output->output_backend, dpms_value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
-EXTERN tdm_capture*
+EXTERN tdm_capture *
tdm_output_create_capture(tdm_output *output, tdm_error *error)
{
- tdm_capture *capture = NULL;
+ tdm_capture *capture = NULL;
- OUTPUT_FUNC_ENTRY_ERROR();
+ OUTPUT_FUNC_ENTRY_ERROR();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- capture = (tdm_capture*)tdm_capture_create_output_internal(private_output, error);
+ capture = (tdm_capture *)tdm_capture_create_output_internal(private_output,
+ error);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return capture;
+ return capture;
}
EXTERN tdm_error
tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities)
{
- LAYER_FUNC_ENTRY();
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *capabilities = private_layer->caps.capabilities;
+ *capabilities = private_layer->caps.capabilities;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats, int *count)
+tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
+ int *count)
{
- LAYER_FUNC_ENTRY();
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *formats = (const tbm_format*)private_layer->caps.formats;
- *count = private_layer->caps.format_count;
+ *formats = (const tbm_format *)private_layer->caps.formats;
+ *count = private_layer->caps.format_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
-tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props, int *count)
+tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
+ int *count)
{
- LAYER_FUNC_ENTRY();
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *props = (const tdm_prop*)private_layer->caps.props;
- *count = private_layer->caps.prop_count;
+ *props = (const tdm_prop *)private_layer->caps.props;
+ *count = private_layer->caps.prop_count;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos)
{
- LAYER_FUNC_ENTRY();
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(zpos != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(zpos != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *zpos = private_layer->caps.zpos;
+ *zpos = private_layer->caps.zpos;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- if (!func_layer->layer_set_property)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_set_property) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_set_property(private_layer->layer_backend, id, value);
+ ret = func_layer->layer_set_property(private_layer->layer_backend, id, value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(value != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(value != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- if (!func_layer->layer_get_property)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_get_property) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_get_property(private_layer->layer_backend, id, value);
+ ret = func_layer->layer_get_property(private_layer->layer_backend, id, value);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- private_layer->usable = 0;
+ private_layer->usable = 0;
- if (!func_layer->layer_set_info)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_set_info) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_set_info(private_layer->layer_backend, info);
+ ret = func_layer->layer_set_info(private_layer->layer_backend, info);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- if (!func_layer->layer_get_info)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_get_info) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_get_info(private_layer->layer_backend, info);
+ ret = func_layer->layer_get_info(private_layer->layer_backend, info);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- private_layer->usable = 0;
+ private_layer->usable = 0;
- if (!func_layer->layer_set_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_set_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- pthread_mutex_lock(&private_display->lock);
- }
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ }
- private_layer->waiting_buffer = tdm_buffer_ref_backend(buffer);
+ private_layer->waiting_buffer = tdm_buffer_ref_backend(buffer);
- ret = func_layer->layer_set_buffer(private_layer->layer_backend, buffer);
+ ret = func_layer->layer_set_buffer(private_layer->layer_backend, buffer);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_unset_buffer(tdm_layer *layer)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- pthread_mutex_lock(&private_display->lock);
- private_layer->waiting_buffer = NULL;
- }
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ private_layer->waiting_buffer = NULL;
+ }
- if (private_layer->showing_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->showing_buffer);
- pthread_mutex_lock(&private_display->lock);
- private_layer->showing_buffer = NULL;
- }
+ if (private_layer->showing_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ private_layer->showing_buffer = NULL;
+ }
- private_layer->usable = 1;
+ private_layer->usable = 1;
- if (!func_layer->layer_unset_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_unset_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
+ ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
static void
_tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data)
{
- TDM_RETURN_IF_FAIL(data != NULL);
- tdm_layer *layer = data;
- tdm_func_layer *func_layer;
- tbm_surface_h surface = NULL;
- LAYER_FUNC_ENTRY_VOID_RETURN();
-
- pthread_mutex_lock(&private_display->lock);
-
- func_layer = &private_display->func_layer;
- if (!func_layer->layer_set_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- return;
- }
-
- if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(private_layer->buffer_queue, &surface) ||
- surface == NULL)
- {
- TDM_ERR("tbm_surface_queue_acquire() failed surface:%p", surface);
- pthread_mutex_unlock(&private_display->lock);
- return;
- }
-
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- tbm_surface_queue_release(private_layer->buffer_queue, private_layer->waiting_buffer);
- pthread_mutex_lock(&private_display->lock);
- }
-
- private_layer->waiting_buffer = tdm_buffer_ref_backend(surface);
-
- func_layer->layer_set_buffer(private_layer->layer_backend, surface);
-
- ret = _tdm_output_commit(private_layer->private_output, 0, NULL, NULL);
- if (ret != TDM_ERROR_NONE)
- TDM_ERR("_tdm_output_commit() is fail");
-
- pthread_mutex_unlock(&private_display->lock);
+ TDM_RETURN_IF_FAIL(data != NULL);
+ tdm_layer *layer = data;
+ tdm_func_layer *func_layer;
+ tbm_surface_h surface = NULL;
+ LAYER_FUNC_ENTRY_VOID_RETURN();
+
+ pthread_mutex_lock(&private_display->lock);
+
+ func_layer = &private_display->func_layer;
+ if (!func_layer->layer_set_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ return;
+ }
+
+ if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(
+ private_layer->buffer_queue, &surface) ||
+ surface == NULL) {
+ TDM_ERR("tbm_surface_queue_acquire() failed surface:%p", surface);
+ pthread_mutex_unlock(&private_display->lock);
+ return;
+ }
+
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ }
+
+ private_layer->waiting_buffer = tdm_buffer_ref_backend(surface);
+
+ func_layer->layer_set_buffer(private_layer->layer_backend, surface);
+
+ ret = _tdm_output_commit(private_layer->private_output, 0, NULL, NULL);
+ if (ret != TDM_ERROR_NONE)
+ TDM_ERR("_tdm_output_commit() is fail");
+
+ pthread_mutex_unlock(&private_display->lock);
}
static void
_tbm_layer_queue_destroy_cb(tbm_surface_queue_h surface_queue, void *data)
{
- TDM_RETURN_IF_FAIL(data != NULL);
- tdm_layer *layer = data;
- LAYER_FUNC_ENTRY_VOID_RETURN();
- TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+ TDM_RETURN_IF_FAIL(data != NULL);
+ tdm_layer *layer = data;
+ LAYER_FUNC_ENTRY_VOID_RETURN();
+ TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- tbm_surface_queue_release(private_layer->buffer_queue, private_layer->waiting_buffer);
- pthread_mutex_lock(&private_display->lock);
- }
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->waiting_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ }
- private_layer->buffer_queue = NULL;
+ private_layer->buffer_queue = NULL;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
}
EXTERN tdm_error
tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
-
- TDM_RETURN_VAL_IF_FAIL(buffer_queue != NULL, TDM_ERROR_INVALID_PARAMETER);
-
- pthread_mutex_lock(&private_display->lock);
-
- func_layer = &private_display->func_layer;
-
- private_layer->usable = 0;
-
- if (!func_layer->layer_set_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
-
- if (buffer_queue == private_layer->buffer_queue)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
-
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- tbm_surface_queue_release(private_layer->buffer_queue, private_layer->waiting_buffer);
- private_layer->waiting_buffer = NULL;
- pthread_mutex_lock(&private_display->lock);
- }
-
- private_layer->buffer_queue = buffer_queue;
- tbm_surface_queue_set_acquirable_cb(private_layer->buffer_queue,
- _tbm_layer_queue_acquirable_cb,
- layer);
- tbm_surface_queue_set_destroy_cb(private_layer->buffer_queue,
- _tbm_layer_queue_destroy_cb,
- layer);
- pthread_mutex_unlock(&private_display->lock);
-
- return ret;
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
+
+ TDM_RETURN_VAL_IF_FAIL(buffer_queue != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ pthread_mutex_lock(&private_display->lock);
+
+ func_layer = &private_display->func_layer;
+
+ private_layer->usable = 0;
+
+ if (!func_layer->layer_set_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ if (buffer_queue == private_layer->buffer_queue) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->waiting_buffer);
+ private_layer->waiting_buffer = NULL;
+ pthread_mutex_lock(&private_display->lock);
+ }
+
+ private_layer->buffer_queue = buffer_queue;
+ tbm_surface_queue_set_acquirable_cb(private_layer->buffer_queue,
+ _tbm_layer_queue_acquirable_cb,
+ layer);
+ tbm_surface_queue_set_destroy_cb(private_layer->buffer_queue,
+ _tbm_layer_queue_destroy_cb,
+ layer);
+ pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
}
EXTERN tdm_error
tdm_layer_unset_buffer_queue(tdm_layer *layer)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
-
- pthread_mutex_lock(&private_display->lock);
-
- func_layer = &private_display->func_layer;
-
- if (private_layer->waiting_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->waiting_buffer);
- tbm_surface_queue_release(private_layer->buffer_queue, private_layer->waiting_buffer);
- private_layer->waiting_buffer = NULL;
- pthread_mutex_lock(&private_display->lock);
- }
-
- if (private_layer->showing_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- tdm_buffer_unref_backend(private_layer->showing_buffer);
- tbm_surface_queue_release(private_layer->buffer_queue, private_layer->showing_buffer);
- pthread_mutex_lock(&private_display->lock);
- private_layer->showing_buffer = NULL;
- }
-
- tbm_surface_queue_set_acquirable_cb(private_layer->buffer_queue, NULL, NULL);
- tbm_surface_queue_set_destroy_cb(private_layer->buffer_queue, NULL, NULL);
- private_layer->buffer_queue = NULL;
- private_layer->usable = 1;
-
- if (!func_layer->layer_unset_buffer)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
-
- ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
-
- pthread_mutex_unlock(&private_display->lock);
-
- return ret;
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
+
+ pthread_mutex_lock(&private_display->lock);
+
+ func_layer = &private_display->func_layer;
+
+ if (private_layer->waiting_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->waiting_buffer);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->waiting_buffer);
+ private_layer->waiting_buffer = NULL;
+ pthread_mutex_lock(&private_display->lock);
+ }
+
+ if (private_layer->showing_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ tdm_buffer_unref_backend(private_layer->showing_buffer);
+ tbm_surface_queue_release(private_layer->buffer_queue,
+ private_layer->showing_buffer);
+ pthread_mutex_lock(&private_display->lock);
+ private_layer->showing_buffer = NULL;
+ }
+
+ tbm_surface_queue_set_acquirable_cb(private_layer->buffer_queue, NULL, NULL);
+ tbm_surface_queue_set_destroy_cb(private_layer->buffer_queue, NULL, NULL);
+ private_layer->buffer_queue = NULL;
+ private_layer->usable = 1;
+
+ if (!func_layer->layer_unset_buffer) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
+
+ pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
}
EXTERN tdm_error
tdm_layer_is_usable(tdm_layer *layer, unsigned int *usable)
{
- LAYER_FUNC_ENTRY();
+ LAYER_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(usable != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(usable != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- *usable = private_layer->usable;
+ *usable = private_layer->usable;
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_layer_set_video_pos(tdm_layer *layer, int zpos)
{
- tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
+ tdm_func_layer *func_layer;
+ LAYER_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ func_layer = &private_display->func_layer;
- if (!(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO))
- {
- TDM_ERR("layer is not video layer");
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_INVALID_PARAMETER;
- }
+ if (!(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)) {
+ TDM_ERR("layer is not video layer");
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_INVALID_PARAMETER;
+ }
- if (!func_layer->layer_set_video_pos)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_layer->layer_set_video_pos) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_layer->layer_set_video_pos(private_layer->layer_backend, zpos);
+ ret = func_layer->layer_set_video_pos(private_layer->layer_backend, zpos);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
-EXTERN tdm_capture*
+EXTERN tdm_capture *
tdm_layer_create_capture(tdm_layer *layer, tdm_error *error)
{
- tdm_capture *capture = NULL;
+ tdm_capture *capture = NULL;
- LAYER_FUNC_ENTRY_ERROR();
+ LAYER_FUNC_ENTRY_ERROR();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- capture = (tdm_capture*)tdm_capture_create_layer_internal(private_layer, error);
+ capture = (tdm_capture *)tdm_capture_create_layer_internal(private_layer,
+ error);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return capture;
+ return capture;
}
_tdm_helper_dump_raw(const char *file, void *data1, int size1, void *data2,
int size2, void *data3, int size3)
{
- unsigned int *blocks;
- FILE *fp = fopen(file, "w+");
- TDM_RETURN_IF_FAIL(fp != NULL);
-
- blocks = (unsigned int*)data1;
- fwrite(blocks, 1, size1, fp);
-
- if (size2 > 0)
- {
- blocks = (unsigned int*)data2;
- fwrite(blocks, 1, size2, fp);
- }
-
- if (size3 > 0)
- {
- blocks = (unsigned int*)data3;
- fwrite(blocks, 1, size3, fp);
- }
-
- fclose(fp);
+ unsigned int *blocks;
+ FILE *fp = fopen(file, "w+");
+ TDM_RETURN_IF_FAIL(fp != NULL);
+
+ blocks = (unsigned int *)data1;
+ fwrite(blocks, 1, size1, fp);
+
+ if (size2 > 0) {
+ blocks = (unsigned int *)data2;
+ fwrite(blocks, 1, size2, fp);
+ }
+
+ if (size3 > 0) {
+ blocks = (unsigned int *)data3;
+ fwrite(blocks, 1, size3, fp);
+ }
+
+ fclose(fp);
}
static void
_tdm_helper_dump_png(const char *file, const void *data, int width,
int height)
{
- FILE *fp = fopen(file, "wb");
- TDM_RETURN_IF_FAIL(fp != NULL);
-
- png_structp pPngStruct =
- png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (!pPngStruct)
- {
- fclose(fp);
- return;
- }
-
- png_infop pPngInfo = png_create_info_struct(pPngStruct);
- if (!pPngInfo)
- {
- png_destroy_write_struct(&pPngStruct, NULL);
- fclose(fp);
- return;
- }
-
- png_init_io(pPngStruct, fp);
- png_set_IHDR(pPngStruct,
- pPngInfo,
- width,
- height,
- PNG_DEPTH,
- PNG_COLOR_TYPE_RGBA,
- PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
-
- png_set_bgr(pPngStruct);
- png_write_info(pPngStruct, pPngInfo);
-
- const int pixel_size = 4; // RGBA
- png_bytep *row_pointers =
- png_malloc(pPngStruct, height * sizeof(png_byte*));
-
- unsigned int *blocks = (unsigned int*)data;
- int y = 0;
- int x = 0;
-
- for (; y < height; ++y)
- {
- png_bytep row =
- png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
- row_pointers[y] = (png_bytep)row;
- for (x = 0; x < width; ++x)
- {
- unsigned int curBlock = blocks[y * width + x];
- row[x * pixel_size] = (curBlock & 0xFF);
- row[1 + x * pixel_size] = (curBlock >> 8) & 0xFF;
- row[2 + x * pixel_size] = (curBlock >> 16) & 0xFF;
- row[3 + x * pixel_size] = (curBlock >> 24) & 0xFF;
- }
- }
-
- png_write_image(pPngStruct, row_pointers);
- png_write_end(pPngStruct, pPngInfo);
-
- for (y = 0; y < height; y++)
- png_free(pPngStruct, row_pointers[y]);
- png_free(pPngStruct, row_pointers);
-
- png_destroy_write_struct(&pPngStruct, &pPngInfo);
-
- fclose(fp);
+ FILE *fp = fopen(file, "wb");
+ TDM_RETURN_IF_FAIL(fp != NULL);
+
+ png_structp pPngStruct =
+ png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!pPngStruct) {
+ fclose(fp);
+ return;
+ }
+
+ png_infop pPngInfo = png_create_info_struct(pPngStruct);
+ if (!pPngInfo) {
+ png_destroy_write_struct(&pPngStruct, NULL);
+ fclose(fp);
+ return;
+ }
+
+ png_init_io(pPngStruct, fp);
+ png_set_IHDR(pPngStruct,
+ pPngInfo,
+ width,
+ height,
+ PNG_DEPTH,
+ PNG_COLOR_TYPE_RGBA,
+ PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+
+ png_set_bgr(pPngStruct);
+ png_write_info(pPngStruct, pPngInfo);
+
+ const int pixel_size = 4; // RGBA
+ png_bytep *row_pointers =
+ png_malloc(pPngStruct, height * sizeof(png_byte *));
+
+ unsigned int *blocks = (unsigned int *)data;
+ int y = 0;
+ int x = 0;
+
+ for (; y < height; ++y) {
+ png_bytep row =
+ png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
+ row_pointers[y] = (png_bytep)row;
+ for (x = 0; x < width; ++x) {
+ unsigned int curBlock = blocks[y * width + x];
+ row[x * pixel_size] = (curBlock & 0xFF);
+ row[1 + x * pixel_size] = (curBlock >> 8) & 0xFF;
+ row[2 + x * pixel_size] = (curBlock >> 16) & 0xFF;
+ row[3 + x * pixel_size] = (curBlock >> 24) & 0xFF;
+ }
+ }
+
+ png_write_image(pPngStruct, row_pointers);
+ png_write_end(pPngStruct, pPngInfo);
+
+ for (y = 0; y < height; y++)
+ png_free(pPngStruct, row_pointers[y]);
+ png_free(pPngStruct, row_pointers);
+
+ png_destroy_write_struct(&pPngStruct, &pPngInfo);
+
+ fclose(fp);
}
EXTERN void
tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file)
{
- tbm_surface_info_s info;
- int len;
- const char *prefix;
-
- TDM_RETURN_IF_FAIL(buffer != NULL);
- TDM_RETURN_IF_FAIL(file != NULL);
-
- tbm_surface_get_info(buffer, &info);
-
- len = strnlen(file, 1024);
- if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888)
- prefix = dump_prefix[0];
- else
- prefix = dump_prefix[1];
-
- if (strncmp(file + (len - 3), prefix, 3))
- {
- TDM_ERR("can't dump to '%s' file", file + (len - 3));
- return;
- }
-
- switch(info.format)
- {
- case TBM_FORMAT_ARGB8888:
- case TBM_FORMAT_XRGB8888:
- _tdm_helper_dump_png(file, info.planes[0].ptr,
- info.planes[0].stride >> 2, info.height);
- break;
- case TBM_FORMAT_YVU420:
- case TBM_FORMAT_YUV420:
- _tdm_helper_dump_raw(file,
- info.planes[0].ptr + info.planes[0].offset,
- info.planes[0].stride * info.height,
- info.planes[1].ptr + info.planes[1].offset,
- info.planes[1].stride * (info.height >> 1),
- info.planes[2].ptr + info.planes[2].offset,
- info.planes[2].stride * (info.height >> 1));
- break;
- case TBM_FORMAT_NV12:
- case TBM_FORMAT_NV21:
- _tdm_helper_dump_raw(file,
- info.planes[0].ptr + info.planes[0].offset,
- info.planes[0].stride * info.height,
- info.planes[1].ptr + info.planes[1].offset,
- info.planes[1].stride * (info.height >> 1), NULL,
- 0);
- break;
- case TBM_FORMAT_YUYV:
- case TBM_FORMAT_UYVY:
- _tdm_helper_dump_raw(file,
- info.planes[0].ptr + info.planes[0].offset,
- info.planes[0].stride * info.height, NULL, 0,
- NULL, 0);
- break;
- default:
- TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR (info.format));
- return;
- }
-
- TDM_INFO("dump %s", file);
+ tbm_surface_info_s info;
+ int len;
+ const char *prefix;
+
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+ TDM_RETURN_IF_FAIL(file != NULL);
+
+ tbm_surface_get_info(buffer, &info);
+
+ len = strnlen(file, 1024);
+ if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888)
+ prefix = dump_prefix[0];
+ else
+ prefix = dump_prefix[1];
+
+ if (strncmp(file + (len - 3), prefix, 3)) {
+ TDM_ERR("can't dump to '%s' file", file + (len - 3));
+ return;
+ }
+
+ switch (info.format) {
+ case TBM_FORMAT_ARGB8888:
+ case TBM_FORMAT_XRGB8888:
+ _tdm_helper_dump_png(file, info.planes[0].ptr,
+ info.planes[0].stride >> 2, info.height);
+ break;
+ case TBM_FORMAT_YVU420:
+ case TBM_FORMAT_YUV420:
+ _tdm_helper_dump_raw(file,
+ info.planes[0].ptr + info.planes[0].offset,
+ info.planes[0].stride * info.height,
+ info.planes[1].ptr + info.planes[1].offset,
+ info.planes[1].stride * (info.height >> 1),
+ info.planes[2].ptr + info.planes[2].offset,
+ info.planes[2].stride * (info.height >> 1));
+ break;
+ case TBM_FORMAT_NV12:
+ case TBM_FORMAT_NV21:
+ _tdm_helper_dump_raw(file,
+ info.planes[0].ptr + info.planes[0].offset,
+ info.planes[0].stride * info.height,
+ info.planes[1].ptr + info.planes[1].offset,
+ info.planes[1].stride * (info.height >> 1), NULL,
+ 0);
+ break;
+ case TBM_FORMAT_YUYV:
+ case TBM_FORMAT_UYVY:
+ _tdm_helper_dump_raw(file,
+ info.planes[0].ptr + info.planes[0].offset,
+ info.planes[0].stride * info.height, NULL, 0,
+ NULL, 0);
+ break;
+ default:
+ TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR (info.format));
+ return;
+ }
+
+ TDM_INFO("dump %s", file);
}
func_pp = &private_display->func_pp
static void
-_tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst, void *user_data)
+_tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst,
+ void *user_data)
{
- tdm_private_pp *private_pp = user_data;
- tdm_private_display *private_display = private_pp->private_display;
- int lock_after_cb_done = 0;
- int ret;
-
- ret = pthread_mutex_trylock(&private_display->lock);
- if (ret == 0)
- pthread_mutex_unlock(&private_display->lock);
- else if (ret == EBUSY)
- {
- pthread_mutex_unlock(&private_display->lock);
- lock_after_cb_done = 1;
- }
-
- tdm_buffer_unref_backend(src);
- tdm_buffer_unref_backend(dst);
-
- if (lock_after_cb_done)
- pthread_mutex_lock(&private_display->lock);
+ tdm_private_pp *private_pp = user_data;
+ tdm_private_display *private_display = private_pp->private_display;
+ int lock_after_cb_done = 0;
+ int ret;
+
+ ret = pthread_mutex_trylock(&private_display->lock);
+ if (ret == 0)
+ pthread_mutex_unlock(&private_display->lock);
+ else if (ret == EBUSY) {
+ pthread_mutex_unlock(&private_display->lock);
+ lock_after_cb_done = 1;
+ }
+
+ tdm_buffer_unref_backend(src);
+ tdm_buffer_unref_backend(dst);
+
+ if (lock_after_cb_done)
+ pthread_mutex_lock(&private_display->lock);
}
-INTERN tdm_private_pp*
+INTERN tdm_private_pp *
tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error)
{
- tdm_func_display *func_display;
- tdm_func_pp *func_pp;
- tdm_private_pp *private_pp = NULL;
- tdm_pp *pp_backend = NULL;
- tdm_error ret = TDM_ERROR_NONE;
-
- func_display = &private_display->func_display;
- func_pp = &private_display->func_pp;
-
- if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP))
- {
- TDM_ERR("no pp capability");
- if (error)
- *error = TDM_ERROR_NO_CAPABILITY;
- return NULL;
- }
-
- pp_backend = func_display->display_create_pp(private_display->bdata, &ret);
- if (ret != TDM_ERROR_NONE)
- {
- if (error)
- *error = ret;
- return NULL;
- }
-
- private_pp = calloc(1, sizeof(tdm_private_pp));
- if (!private_pp)
- {
- TDM_ERR("failed: alloc memory");
- func_pp->pp_destroy(pp_backend);
- if (error)
- *error = TDM_ERROR_OUT_OF_MEMORY;
- return NULL;
- }
-
- ret = func_pp->pp_set_done_handler(pp_backend, _tdm_pp_cb_done, private_pp);
- if (ret != TDM_ERROR_NONE)
- {
- TDM_ERR("set pp_done_handler failed");
- func_pp->pp_destroy(pp_backend);
- if (error)
- *error = ret;
- return NULL;
- }
-
- LIST_ADD(&private_pp->link, &private_display->pp_list);
- private_pp->private_display = private_display;
- private_pp->pp_backend = pp_backend;
-
- if (error)
- *error = TDM_ERROR_NONE;
-
- return private_pp;
+ tdm_func_display *func_display;
+ tdm_func_pp *func_pp;
+ tdm_private_pp *private_pp = NULL;
+ tdm_pp *pp_backend = NULL;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ func_display = &private_display->func_display;
+ func_pp = &private_display->func_pp;
+
+ if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) {
+ TDM_ERR("no pp capability");
+ if (error)
+ *error = TDM_ERROR_NO_CAPABILITY;
+ return NULL;
+ }
+
+ pp_backend = func_display->display_create_pp(private_display->bdata, &ret);
+ if (ret != TDM_ERROR_NONE) {
+ if (error)
+ *error = ret;
+ return NULL;
+ }
+
+ private_pp = calloc(1, sizeof(tdm_private_pp));
+ if (!private_pp) {
+ TDM_ERR("failed: alloc memory");
+ func_pp->pp_destroy(pp_backend);
+ if (error)
+ *error = TDM_ERROR_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ ret = func_pp->pp_set_done_handler(pp_backend, _tdm_pp_cb_done, private_pp);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("set pp_done_handler failed");
+ func_pp->pp_destroy(pp_backend);
+ if (error)
+ *error = ret;
+ return NULL;
+ }
+
+ LIST_ADD(&private_pp->link, &private_display->pp_list);
+ private_pp->private_display = private_display;
+ private_pp->pp_backend = pp_backend;
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return private_pp;
}
INTERN void
tdm_pp_destroy_internal(tdm_private_pp *private_pp)
{
- tdm_func_pp *func_pp;
+ tdm_func_pp *func_pp;
- if (!private_pp)
- return;
+ if (!private_pp)
+ return;
- func_pp = &private_pp->private_display->func_pp;
+ func_pp = &private_pp->private_display->func_pp;
- LIST_DEL(&private_pp->link);
+ LIST_DEL(&private_pp->link);
- func_pp->pp_destroy(private_pp->pp_backend);
+ func_pp->pp_destroy(private_pp->pp_backend);
- free(private_pp);
+ free(private_pp);
}
EXTERN void
tdm_pp_destroy(tdm_pp *pp)
{
- tdm_private_pp *private_pp = pp;
- tdm_private_display *private_display;
+ tdm_private_pp *private_pp = pp;
+ tdm_private_display *private_display;
- if (!private_pp)
- return;
+ if (!private_pp)
+ return;
- private_display = private_pp->private_display;
+ private_display = private_pp->private_display;
- pthread_mutex_lock(&private_display->lock);
- tdm_pp_destroy_internal(private_pp);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
+ tdm_pp_destroy_internal(private_pp);
+ pthread_mutex_unlock(&private_display->lock);
}
EXTERN tdm_error
tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info)
{
- PP_FUNC_ENTRY();
+ PP_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_pp->pp_set_info)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_pp->pp_set_info) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_pp->pp_set_info(private_pp->pp_backend, info);
+ ret = func_pp->pp_set_info(private_pp->pp_backend, info);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst)
{
- PP_FUNC_ENTRY();
+ PP_FUNC_ENTRY();
- TDM_RETURN_VAL_IF_FAIL(src != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(dst != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(src != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(dst != NULL, TDM_ERROR_INVALID_PARAMETER);
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_pp->pp_attach)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_pp->pp_attach) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- tdm_buffer_ref_backend(src);
- tdm_buffer_ref_backend(dst);
- ret = func_pp->pp_attach(private_pp->pp_backend, src, dst);
+ tdm_buffer_ref_backend(src);
+ tdm_buffer_ref_backend(dst);
+ ret = func_pp->pp_attach(private_pp->pp_backend, src, dst);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
EXTERN tdm_error
tdm_pp_commit(tdm_pp *pp)
{
- PP_FUNC_ENTRY();
+ PP_FUNC_ENTRY();
- pthread_mutex_lock(&private_display->lock);
+ pthread_mutex_lock(&private_display->lock);
- if (!func_pp->pp_commit)
- {
- pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_NONE;
- }
+ if (!func_pp->pp_commit) {
+ pthread_mutex_unlock(&private_display->lock);
+ return TDM_ERROR_NONE;
+ }
- ret = func_pp->pp_commit(private_pp->pp_backend);
+ ret = func_pp->pp_commit(private_pp->pp_backend);
- pthread_mutex_unlock(&private_display->lock);
+ pthread_mutex_unlock(&private_display->lock);
- return ret;
+ return ret;
}
#define FOURCC_STR(id) C(id,0), C(id,8), C(id,16), C(id,24)
#define FOURCC_ID(str) FOURCC(((char*)str)[0],((char*)str)[1],((char*)str)[2],((char*)str)[3])
-typedef enum
-{
- TDM_CAPTURE_TARGET_OUTPUT,
- TDM_CAPTURE_TARGET_LAYER,
+typedef enum {
+ TDM_CAPTURE_TARGET_OUTPUT,
+ TDM_CAPTURE_TARGET_LAYER,
} tdm_capture_target;
typedef struct _tdm_private_display tdm_private_display;
typedef struct _tdm_private_vblank_handler tdm_private_vblank_handler;
typedef struct _tdm_private_commit_handler tdm_private_commit_handler;
-struct _tdm_private_display
-{
- pthread_mutex_t lock;
- unsigned int init_count;
+struct _tdm_private_display {
+ pthread_mutex_t lock;
+ unsigned int init_count;
- /* backend module info */
- void *module;
- tdm_backend_module *module_data;
- tdm_backend_data *bdata;
+ /* backend module info */
+ void *module;
+ tdm_backend_module *module_data;
+ tdm_backend_data *bdata;
- /* backend function */
- tdm_display_capability capabilities;
- tdm_func_display func_display;
- tdm_func_output func_output;
- tdm_func_layer func_layer;
- tdm_func_pp func_pp;
- tdm_func_capture func_capture;
+ /* backend function */
+ tdm_display_capability capabilities;
+ tdm_func_display func_display;
+ tdm_func_output func_output;
+ tdm_func_layer func_layer;
+ tdm_func_pp func_pp;
+ tdm_func_capture func_capture;
- /* backend capability */
- tdm_caps_display caps_display;
- tdm_caps_pp caps_pp;
- tdm_caps_capture caps_capture;
+ /* backend capability */
+ tdm_caps_display caps_display;
+ tdm_caps_pp caps_pp;
+ tdm_caps_capture caps_capture;
- /* output, pp list */
- struct list_head output_list;
- struct list_head pp_list;
+ /* output, pp list */
+ struct list_head output_list;
+ struct list_head pp_list;
- void **outputs_ptr;
+ void **outputs_ptr;
- tbm_bufmgr bufmgr;
+ tbm_bufmgr bufmgr;
};
-struct _tdm_private_output
-{
- struct list_head link;
+struct _tdm_private_output {
+ struct list_head link;
- tdm_private_display *private_display;
+ tdm_private_display *private_display;
- tdm_caps_output caps;
- tdm_output *output_backend;
+ tdm_caps_output caps;
+ tdm_output *output_backend;
- unsigned int pipe;
+ unsigned int pipe;
- int regist_vblank_cb;
- int regist_commit_cb;
+ int regist_vblank_cb;
+ int regist_commit_cb;
- struct list_head layer_list;
- struct list_head capture_list;
- struct list_head vblank_handler_list;
- struct list_head commit_handler_list;
+ struct list_head layer_list;
+ struct list_head capture_list;
+ struct list_head vblank_handler_list;
+ struct list_head commit_handler_list;
- void **layers_ptr;
+ void **layers_ptr;
};
-struct _tdm_private_layer
-{
- struct list_head link;
+struct _tdm_private_layer {
+ struct list_head link;
- tdm_private_display *private_display;
- tdm_private_output *private_output;
+ tdm_private_display *private_display;
+ tdm_private_output *private_output;
- tdm_caps_layer caps;
- tdm_layer *layer_backend;
+ tdm_caps_layer caps;
+ tdm_layer *layer_backend;
- tbm_surface_h waiting_buffer;
- tbm_surface_h showing_buffer;
- tbm_surface_queue_h buffer_queue;
+ tbm_surface_h waiting_buffer;
+ tbm_surface_h showing_buffer;
+ tbm_surface_queue_h buffer_queue;
- struct list_head capture_list;
+ struct list_head capture_list;
- unsigned int usable;
+ unsigned int usable;
};
-struct _tdm_private_pp
-{
- struct list_head link;
+struct _tdm_private_pp {
+ struct list_head link;
- tdm_private_display *private_display;
+ tdm_private_display *private_display;
- tdm_pp *pp_backend;
+ tdm_pp *pp_backend;
};
-struct _tdm_private_capture
-{
- struct list_head link;
+struct _tdm_private_capture {
+ struct list_head link;
- tdm_capture_target target;
+ tdm_capture_target target;
- tdm_private_display *private_display;
- tdm_private_output *private_output;
- tdm_private_layer *private_layer;
+ tdm_private_display *private_display;
+ tdm_private_output *private_output;
+ tdm_private_layer *private_layer;
- tdm_capture *capture_backend;
+ tdm_capture *capture_backend;
};
-struct _tdm_private_vblank_handler
-{
- struct list_head link;
+struct _tdm_private_vblank_handler {
+ struct list_head link;
- tdm_private_output *private_output;
- tdm_output_vblank_handler func;
- void *user_data;
+ tdm_private_output *private_output;
+ tdm_output_vblank_handler func;
+ void *user_data;
};
-struct _tdm_private_commit_handler
-{
- struct list_head link;
+struct _tdm_private_commit_handler {
+ struct list_head link;
- tdm_private_output *private_output;
- tdm_output_commit_handler func;
- void *user_data;
+ tdm_private_output *private_output;
+ tdm_output_commit_handler func;
+ void *user_data;
};
-tdm_private_pp* tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error);
-void tdm_pp_destroy_internal(tdm_private_pp *private_pp);
-
-tdm_private_capture* tdm_capture_create_output_internal(tdm_private_output *private_output, tdm_error *error);
-tdm_private_capture* tdm_capture_create_layer_internal(tdm_private_layer *private_layer, tdm_error *error);
-void tdm_capture_destroy_internal(tdm_private_capture *private_capture);
+tdm_private_pp *
+tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error);
+void
+tdm_pp_destroy_internal(tdm_private_pp *private_pp);
+
+tdm_private_capture *
+tdm_capture_create_output_internal(tdm_private_output *private_output,
+ tdm_error *error);
+tdm_private_capture *
+tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
+ tdm_error *error);
+void
+tdm_capture_destroy_internal(tdm_private_capture *private_capture);
#ifdef __cplusplus
}