#define PEPPER_TDM_H
#include <pepper.h>
+#include <tbm_surface_queue.h>
#ifdef __cplusplus
extern "C" {
PEPPER_API pepper_bool_t
pepper_tdm_output_get_pixel_size(pepper_tdm_output_t *output, uint32_t *w, uint32_t *h);
+PEPPER_API tbm_surface_queue_h
+pepper_tdm_output_get_display_buffer_queue(pepper_tdm_output_t *output);
#ifdef __cplusplus
}
return PEPPER_TRUE;
}
+static void
+__tdm_output_destroy_display_buffer_queue(pepper_tdm_output_t *output)
+{
+ if (!output->tbm_surface_queue)
+ return;
+
+ if (!output->hwc)
+ tbm_surface_queue_destroy(output->tbm_surface_queue);
+
+ output->tbm_surface_queue = NULL;
+}
+
+PEPPER_API tbm_surface_queue_h
+pepper_tdm_output_get_display_buffer_queue(pepper_tdm_output_t *output)
+{
+ pepper_tdm_hwc_t *hwc;
+ tbm_surface_queue_h tsurface_queue;
+ tdm_error err = TDM_ERROR_NONE;
+ pepper_bool_t ret = PEPPER_FALSE;
+ unsigned int w, h;
+
+ if (output->tbm_surface_queue)
+ return output->tbm_surface_queue;
+
+ ret = pepper_tdm_output_get_pixel_size(output, &w, &h);
+ PEPPER_CHECK(ret == PEPPER_TRUE, return NULL,
+ "pepper_tdm_output_get_pixel_size() failed.\n");
+
+ if (output->hwc) {
+ hwc = output->hwc;
+ tsurface_queue = tdm_hwc_get_client_target_buffer_queue(hwc->thwc, &err);
+ PEPPER_CHECK(tsurface_queue, goto error,
+ "tdm_hwc_get_client_target_buffer_queue() failed.\n");
+ } else {
+ tsurface_queue = tbm_surface_queue_create(3, w, h,
+ TBM_FORMAT_XBGR8888, TBM_BO_SCANOUT);
+ PEPPER_CHECK(tsurface_queue, goto error,
+ "tbm_surface_queue_create() failed.\n");
+ }
+
+ output->tbm_surface_queue = tsurface_queue;
+
+ return tsurface_queue;
+
+error:
+ __tdm_output_destroy_display_buffer_queue(output);
+
+ return NULL;
+}