void
tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len);
+/**
+ * @brief Get whether the commit-per-vblank functionality is enabled or not.
+ * @param[in] dpy A display object
+ * @return 1 if enabled. Otherwise, 0.
+ */
+int
+tdm_helper_commit_per_vblank_enabled(tdm_display *dpy);
+
#ifdef __cplusplus
}
#endif
tdm_display_enable_path(str);
str = getenv("TDM_COMMIT_PER_VBLANK");
- if (str && (strstr(str, "1")))
- tdm_display_enable_commit_per_vblank(private_display, 1);
+ if (str) {
+ char *end;
+ int enable = strtol(str, &end, 10);
+
+ tdm_display_enable_commit_per_vblank(private_display, enable);
+ }
if (pthread_mutex_init(&private_display->lock, NULL)) {
ret = TDM_ERROR_OPERATION_FAILED;
{
private_display->commit_per_vblank = enable;
- if (private_display->commit_per_vblank == 1)
+ if (private_display->commit_per_vblank == 0)
+ TDM_INFO("commit per vblank: disable");
+ else if (private_display->commit_per_vblank == 1)
TDM_INFO("commit per vblank: enable (1 layer)");
else if (private_display->commit_per_vblank == 2)
TDM_INFO("commit per vblank: enable (previous commit)");
- else if (private_display->commit_per_vblank > 0)
- TDM_INFO("commit per vblank: enable (unknown)");
- else
- TDM_INFO("commit per vblank: disable");
+ else {
+ private_display->commit_per_vblank = 1;
+ TDM_INFO("commit per vblank: enable (changed to 1 layer)");
+ }
return TDM_ERROR_NONE;
}
unlock:
_pthread_mutex_unlock(&private_display->lock);
}
+
+EXTERN int
+tdm_helper_commit_per_vblank_enabled(tdm_display *dpy)
+{
+ tdm_private_display *private_display;
+
+ TDM_RETURN_VAL_IF_FAIL(dpy != NULL, 0);
+
+ private_display = dpy;
+
+ return private_display->commit_per_vblank;
+}
+