#include "config.h"
#endif
-#include <sys/socket.h>
-
-#include "tdm.h"
#include "tdm_private.h"
-#include "tdm_list.h"
static tdm_private_thread *keep_private_thread;
tdm_private_thread *private_thread;
tdm_thread_cb_base *base;
char buffer[1024];
- unsigned int len, i;
+ unsigned int i;
+ int len;
/* DON'T check TDM_MUTEX_IS_LOCKED here */
private_thread = private_loop->private_thread;
private_display = private_loop->dpy;
- len = read(private_thread->pipe[0], buffer, sizeof buffer);
+ do {
+ len = read(private_thread->pipe[0], buffer, sizeof buffer);
+ } while (len < 0 && errno == EINTR);
if (tdm_debug_module & TDM_DEBUG_THREAD)
TDM_INFO("fd(%d) read length(%d)", private_thread->pipe[0], len);
+ if (len < 0) {
+ TDM_ERR("read failed: errno(%d), len(%d) %m", errno, len);
+ return TDM_ERROR_OPERATION_FAILED;
+ }
+
if (len == 0)
return TDM_ERROR_NONE;
if (len < sizeof * base) {
- TDM_NEVER_GET_HERE();
+ TDM_ERR("read failed: len(%d)", len);
return TDM_ERROR_OPERATION_FAILED;
}
tdm_output *output_backend =
tdm_display_find_output_stamp(private_loop->dpy, output_commit->output_stamp);
if (!output_backend) {
- TDM_WRN("no output(%ld)", output_commit->output_stamp);
+ TDM_WRN("no output(%f)", output_commit->output_stamp);
break;
}
tdm_output_cb_commit(output_backend, output_commit->sequence,
tdm_output *output_backend =
tdm_display_find_output_stamp(private_loop->dpy, output_vblank->output_stamp);
if (!output_backend) {
- TDM_WRN("no output(%ld)", output_vblank->output_stamp);
+ TDM_WRN("no output(%f)", output_vblank->output_stamp);
break;
}
tdm_output_cb_vblank(output_backend, output_vblank->sequence,
break;
}
case TDM_THREAD_CB_OUTPUT_STATUS: {
+ /* LCOV_EXCL_START */
tdm_thread_cb_output_status *output_status = (tdm_thread_cb_output_status*)base;
tdm_output *output_backend =
tdm_display_find_output_stamp(private_loop->dpy, output_status->output_stamp);
if (!output_backend) {
- TDM_WRN("no output(%ld)", output_status->output_stamp);
+ TDM_WRN("no output(%f)", output_status->output_stamp);
break;
}
tdm_output_cb_status(output_backend, output_status->status,
output_status->user_data);
break;
+ /* LCOV_EXCL_STOP */
+ }
+ case TDM_THREAD_CB_OUTPUT_DPMS: {
+ /* LCOV_EXCL_START */
+ tdm_thread_cb_output_dpms *output_dpms = (tdm_thread_cb_output_dpms*)base;
+ tdm_output *output_backend =
+ tdm_display_find_output_stamp(private_loop->dpy, output_dpms->output_stamp);
+ if (!output_backend) {
+ TDM_WRN("no output(%f)", output_dpms->output_stamp);
+ break;
+ }
+ tdm_output_cb_dpms(output_backend, output_dpms->dpms, output_dpms->user_data);
+ break;
+ /* LCOV_EXCL_STOP */
}
case TDM_THREAD_CB_PP_DONE: {
tdm_thread_cb_pp_done *pp_done = (tdm_thread_cb_pp_done*)base;
tdm_pp *pp_backend =
tdm_pp_find_stamp(private_loop->dpy, pp_done->pp_stamp);
if (!pp_backend) {
- TDM_WRN("no pp(%ld)", pp_done->pp_stamp);
+ TDM_WRN("no pp(%f)", pp_done->pp_stamp);
break;
}
tdm_pp_cb_done(pp_backend, pp_done->src, pp_done->dst, pp_done->user_data);
tdm_capture *capture_backend =
tdm_capture_find_stamp(private_loop->dpy, capture_done->capture_stamp);
if (!capture_backend) {
- TDM_WRN("no capture(%ld)", capture_done->capture_stamp);
+ TDM_WRN("no capture(%f)", capture_done->capture_stamp);
break;
}
tdm_capture_cb_done(capture_backend, capture_done->buffer, capture_done->user_data);
break;
}
+ case TDM_THREAD_CB_VBLANK_SW: {
+ tdm_thread_cb_vblank_sw *vblank_sw = (tdm_thread_cb_vblank_sw*)base;
+ tdm_vblank_cb_vblank_SW(NULL, vblank_sw->vblank_stamp);
+ break;
+ }
+ case TDM_THREAD_CB_VBLANK_CREATE: {
+ tdm_thread_cb_vblank_create *vblank_create = (tdm_thread_cb_vblank_create*)base;
+ tdm_vblank_cb_vblank_create(NULL, vblank_create->vblank_stamp);
+ break;
+ }
+ case TDM_THREAD_CB_NEED_VALIDATE: {
+ tdm_thread_cb_need_validate *ev = (tdm_thread_cb_need_validate*)base;
+ tdm_output_cb_need_validate(ev->o);
+ break;
+ }
default:
break;
}