return TDM_ERROR_NONE;
}
+
+
+static void
+_tdm_display_ttrace_vblank_cb(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
+ unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+{
+ tdm_error ret = TDM_ERROR_NONE;
+
+ TDM_TRACE_COUNT(VBlank, sequence);
+
+ ret = tdm_vblank_wait(vblank, 0, 0, 1, _tdm_display_ttrace_vblank_cb, NULL);
+ TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+}
+
+INTERN tdm_error
+tdm_display_enable_ttrace_vblank(tdm_display *dpy, tdm_output *output, int enable)
+{
+ static tdm_vblank *vblank = NULL;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ if (!enable) {
+ if (vblank)
+ tdm_vblank_destroy(vblank);
+ vblank = NULL;
+ return TDM_ERROR_NONE;
+ } else {
+ const tdm_output_mode *mode = NULL;
+
+ if (vblank)
+ return TDM_ERROR_NONE;
+
+ vblank = tdm_vblank_create(dpy, output, &ret);
+ TDM_RETURN_VAL_IF_FAIL(vblank != NULL, ret);
+
+ ret = tdm_output_get_mode(output, &mode);
+ TDM_RETURN_VAL_IF_FAIL(mode != NULL, ret);
+
+ ret = tdm_vblank_set_fps(vblank, mode->vrefresh);
+ TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+
+ ret = tdm_vblank_set_enable_fake(vblank, 1);
+ TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+
+ ret = tdm_vblank_wait(vblank, 0, 0, 1, _tdm_display_ttrace_vblank_cb, NULL);
+ TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+ }
+
+ return TDM_ERROR_NONE;
+}
+
TDM_SNPRINTF(reply, len, "done: DPMS %s\n", tdm_dpms_str(dpms_value));
}
+static void
+_tdm_monitor_server_ttrace_vblank(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy)
+{
+ int enable, output_id = 0;
+ tdm_output *output;
+ const char *name = NULL;
+ char *arg;
+ char *end;
+ tdm_error ret;
+ tdm_output_type type;
+
+ if (argc < 3) {
+ _tdm_monitor_server_usage(argv[0], reply, len);
+ return;
+ }
+
+ arg = argv[2];
+ enable = strtol(arg, &end, 10);
+
+ if (*end == '@') {
+ arg = end + 1;
+ output_id = strtol(arg, &end, 10);
+ }
+
+ output = tdm_display_get_output(dpy, output_id, NULL);
+ if (!output) {
+ TDM_SNPRINTF(reply, len, "can't find the output_id(%d)\n", output_id);
+ return;
+ }
+
+ ret = tdm_output_get_output_type(output, &type);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_SNPRINTF(reply, len, "can't find the type of output_id(%d)\n", output_id);
+ return;
+ }
+
+ tdm_output_get_model_info(output, NULL, NULL, &name);
+
+ tdm_display_enable_ttrace_vblank(dpy, output, enable);
+
+ TDM_SNPRINTF(reply, len, "%s ttrace vblank for '%s'\n",
+ (enable)?"enable":"disable", tdm_conn_str(type));
+}
+
static void
_tdm_monitor_server_debug(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy)
{
"dpms", _tdm_monitor_server_dpms,
"set output dpms", "<output_idx>:<dpms>", "0:3 or 0:0"
},
+ {
+ "ttrace_vblank", _tdm_monitor_server_ttrace_vblank,
+ "enable/disable the vblank for ttrace [0:disable 1:enable]",
+ "<enable>[@<output_idx>]", "0 or 1"
+ },
{
"debug", _tdm_monitor_server_debug,
"set the debug level and modules(module: none, mutex, buffer, thread, vblank)",
#include <ttrace.h>
#define TDM_TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_GRAPHICS, "TDM:"#NAME)
#define TDM_TRACE_END() traceEnd(TTRACE_TAG_GRAPHICS)
+#define TDM_TRACE_COUNT(NAME, COUNT) traceCounter(TTRACE_TAG_GRAPHICS, COUNT, "TDM:"#NAME)
#else
#define TDM_TRACE_BEGIN(NAME)
#define TDM_TRACE_END()
+#define TDM_TRACE_COUNT(NAME, COUNT)
#endif
typedef enum {
tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_str, char *reply, int *len);
tdm_error
tdm_display_enable_path(const char *path);
+tdm_error
+tdm_display_enable_ttrace_vblank(tdm_display *dpy, tdm_output *output, int enable);
/**
* @brief The tdm vblank object