#include <tdm_backend.h>
#include <tdm_log.h>
#include <tdm_list.h>
+#include "tdm_nexell_types.h"
+#include "tdm_nexell_hwc.h"
+#include "tdm_nexell_hwc_window.h"
#if HAVE_UDEV
#include <libudev.h>
tdm_error nexell_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
tdm_error nexell_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
tdm_error nexell_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data);
+tdm_hwc *nexell_output_get_hwc(tdm_output *output, tdm_error *error);
+
+tdm_hwc_window *nexell_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
+tdm_error nexell_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
+tdm_error nexell_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
+tdm_error nexell_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
+tbm_surface_queue_h nexell_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
+tdm_error nexell_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h buffer, tdm_region damage);
+tdm_error nexell_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types);
+tdm_error nexell_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_wnds, tdm_hwc_window_composition *composition_types);
+tdm_error nexell_hwc_accept_validation(tdm_hwc *hwc);
+tdm_error nexell_hwc_commit(tdm_hwc *hwc, int sync, void *user_data);
+tdm_error nexell_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func);
+
+void nexell_hwc_window_destroy(tdm_hwc_window *hwc_window);
+tdm_error nexell_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, tdm_hwc_window_composition composition_type);
+tdm_error nexell_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
+tdm_error nexell_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
+tdm_error nexell_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface);
+tdm_error nexell_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value value);
+tdm_error nexell_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value);
+tdm_error nexell_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
+tbm_surface_queue_h nexell_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
+void nexell_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
+tdm_error nexell_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
+tdm_error nexell_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
+
tdm_error nexell_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps);
tdm_error nexell_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
tdm_error nexell_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
tdm_error nexell_pp_commit(tdm_pp *pp);
tdm_error nexell_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
-/* drm module internal macros, structures, functions */
-#define NEVER_GET_HERE() TDM_ERR("** NEVER GET HERE **")
-
-#define C(b,m) (((b) >> (m)) & 0xFF)
-#define B(c,s) ((((unsigned int)(c)) & 0xff) << (s))
-#define FOURCC(a,b,c,d) (B(d,24) | B(c,16) | B(b,8) | B(a,0))
-#define FOURCC_STR(id) C(id,0), C(id,8), C(id,16), C(id,24)
-
-#define IS_RGB(format) (format == TBM_FORMAT_XRGB8888 || format == TBM_FORMAT_ARGB8888 || \
- format == TBM_FORMAT_XBGR8888 || format == TBM_FORMAT_ABGR8888)
-
-#define CLEAR(x) memset(&(x), 0, sizeof(x))
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#define SWAP(a, b) ({int t; t = a; a = b; b = t;})
-#define ROUNDUP(x) (ceil (floor ((float)(height) / 4)))
-
-#define ALIGN_TO_16B(x) ((((x) + (1 << 4) - 1) >> 4) << 4)
-#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
-#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
-#define ALIGN_TO_2KB(x) ((((x) + (1 << 11) - 1) >> 11) << 11)
-#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
-#define ALIGN_TO_64KB(x) ((((x) + (1 << 16) - 1) >> 16) << 16)
-
-#define RETURN_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TDM_ERR("'%s' failed", #cond);\
- return val;\
- }\
-}
-
-#define GOTO_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TDM_ERR("'%s' failed", #cond);\
- goto val;\
- }\
-}
-
-typedef struct _tdm_nexell_data
-{
- tdm_display *dpy;
-
- int drm_fd;
- int scaler_fd;
-
-#if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4 && LIBDRM_MICRO_VERSION >= 47
- int has_universal_plane;
-#endif
-
-#if HAVE_UDEV
- struct udev_monitor *uevent_monitor;
- tdm_event_loop_source *uevent_source;
-#endif
-
- drmModeResPtr mode_res;
- drmModePlaneResPtr plane_res;
- struct list_head output_list;
- struct list_head buffer_list;
-} tdm_nexell_data;
uint32_t tdm_nexell_format_to_drm_format(tbm_format format);
tbm_format tdm_nexell_format_to_tbm_format(uint32_t format);
void tdm_nexell_display_destroy_output_list(tdm_nexell_data *nexell_data);
tdm_error tdm_nexell_display_create_layer_list(tdm_nexell_data *nexell_data);
+tdm_nexell_layer_data * nexell_output_data_get_layer_data(tdm_nexell_output_data *output_data, int layer_zops);
+void tdm_nexell_data_destroy_buffer_list(tdm_nexell_data *nexell_data);
+tbm_surface_queue_h tdm_nexell_hwc_window_create_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
+void tdm_nexell_hwc_window_destroy_tbm_buffer_queue(tbm_surface_queue_h tqueue);
#endif /* _TDM_NEXELL_H_ */