v2: Use a socket instead of named pipe.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
#include "util/list.h"
#include "util/ralloc.h"
#include "util/os_time.h"
+#include "util/os_socket.h"
#include "util/simple_mtx.h"
#include "vk_enum_to_str.h"
{
if (data->params.output_file)
fclose(data->params.output_file);
+ if (data->params.control >= 0)
+ os_socket_close(data->params.control);
unmap_object(HKEY(data->instance));
ralloc_free(data);
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
#include "overlay_params.h"
+#include "util/os_socket.h"
+
static enum overlay_param_position
parse_position(const char *str)
{
return fopen(str, "w+");
}
+static int
+parse_control(const char *str)
+{
+ int ret = os_socket_listen_abstract(str, 1);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: Couldn't create socket pipe at '%s'\n", str);
+ fprintf(stderr, "ERROR: '%s'\n", strerror(errno));
+ return ret;
+ }
+
+ os_socket_block(ret, false);
+
+ return ret;
+}
+
static uint32_t
parse_fps_sampling_period(const char *str)
{
params->enabled[OVERLAY_PARAM_ENABLED_frame_timing] = true;
params->fps_sampling_period = 500000; /* 500ms */
params->width = params->height = 300;
+ params->control = -1;
if (!env)
return;
OVERLAY_PARAM_CUSTOM(width) \
OVERLAY_PARAM_CUSTOM(height) \
OVERLAY_PARAM_CUSTOM(no_display) \
+ OVERLAY_PARAM_CUSTOM(control) \
OVERLAY_PARAM_CUSTOM(help)
enum overlay_param_position {
bool enabled[OVERLAY_PARAM_ENABLED_MAX];
enum overlay_param_position position;
FILE *output_file;
+ int control;
uint32_t fps_sampling_period; /* us */
bool help;
bool no_display;