int dx, dy;
int width, height;
int rotation;
+ /* for damage region */
+ int num_rects;
+ int *rects;
twe_wl_surf_source *surf_source;
};
buf_info->dx = wl_egl_window->dx;
buf_info->dy = wl_egl_window->dy;
+ if (buf_info->rects) {
+ free(buf_info->rects);
+ buf_info->rects = NULL;
+ buf_info->num_rects = 0;
+ }
return TPL_ERROR_NONE;
} else {
buf_info = (twe_wl_buffer_info *)calloc(1, sizeof(twe_wl_buffer_info));
return TPL_ERROR_INVALID_OPERATION;
}
+ buf_info->rotation = wl_egl_window->rotation;
+ buf_info->dx = wl_egl_window->dx;
+ buf_info->dy = wl_egl_window->dy;
+ buf_info->width = wl_egl_window->width;
+ buf_info->height = wl_egl_window->height;
+ buf_info->num_rects = 0;
+ buf_info->rects = NULL;
+
wl_buffer_add_listener((void *)buf_info->wl_buffer,
&wl_buffer_release_listener, tbm_surface);
wl_display_flush(source->disp_source->disp);
return TPL_ERROR_INVALID_OPERATION;
}
+ TPL_LOG_T("WL_EGL",
+ "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) rot(%d)",
+ buf_info, tbm_surface,
+ tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)),
+ buf_info->width, buf_info->height, buf_info->rotation);
+
return TPL_ERROR_NONE;
}
+tpl_result_t
+twe_surface_set_damage_region(tbm_surface_h tbm_surface,
+ int num_rects,
+ const int *rects)
+{
+ twe_wl_buffer_info *buf_info = NULL;
+
+ if (!tbm_surface || !tbm_surface_internal_is_valid(tbm_surface)) {
+ TPL_ERR("Invalid parameter. tbm_surface(%p)", tbm_surface);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (num_rects == 0 || rects == NULL) {
+ return TPL_ERROR_NONE;
+ }
+
+ tbm_surface_internal_get_user_data(tbm_surface, KEY_BUFFER_INFO,
+ (void **)&buf_info);
+ if (!buf_info) {
+ TPL_ERR("Failed to get twe_wl_buffer_info from tbm_surface(%p)",
+ tbm_surface);
+ return TPL_ERROR_INVALID_OPERATION;
+ }
+
+ /* Destroy old region if there are old region info. */
+ if (buf_info->rects != NULL) {
+ free(buf_info->rects);
+ buf_info->rects = NULL;
+ buf_info->num_rects = 0;
+ }
+
+ buf_info->rects = (int *)calloc(1, (sizeof(int) * 4 * num_rects));
+ buf_info->num_rects = num_rects;
+
+ if (!buf_info->rects) {
+ TPL_ERR("Failed to allocate memory fo damage rects info.");
+ return TPL_ERROR_INVALID_OPERATION;
+ }
+
+ memcpy((char *)buf_info->rects, (char *)rects, sizeof(int) * 4 * num_rects);
+
+ return TPL_ERROR_NONE;
+}
#ifdef WORKER_TEST_ONLY
static void reg_global(void *data,