From 414baadc40eb5d6edfd29c4e06ecd222a7faf0ba Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Mon, 26 Feb 2024 21:14:36 +0200 Subject: [PATCH] refactoring --- src/v4p/drm.c | 8 +++----- src/v4p/drm.h | 2 +- src/v4p/main.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/v4p/drm.c b/src/v4p/drm.c index f9915b64e..953501c0c 100644 --- a/src/v4p/drm.c +++ b/src/v4p/drm.c @@ -61,7 +61,7 @@ static float _get_refresh_rate(const drmModeModeInfo *mode); #define _D_LOG_DEBUG(x_msg, ...) US_LOG_DEBUG("DRM: " x_msg, ##__VA_ARGS__) -us_drm_s *us_drm_init(const char *path, const char *port) { +us_drm_s *us_drm_init(void) { us_drm_runtime_s *run; US_CALLOC(run, 1); run->fd = -1; @@ -72,8 +72,8 @@ us_drm_s *us_drm_init(const char *path, const char *port) { us_drm_s *drm; US_CALLOC(drm, 1); - drm->path = us_strdup(path); - drm->port = us_strdup(port); + drm->path = "/dev/dri/card0"; + drm->port = "HDMI-A-1"; drm->n_bufs = 4; drm->timeout = 5; drm->run = run; @@ -84,8 +84,6 @@ void us_drm_destroy(us_drm_s *drm) { _drm_cleanup(drm); us_ftext_destroy(drm->run->ft); US_DELETE(drm->run, free); - US_DELETE(drm->port, free); - US_DELETE(drm->path, free); US_DELETE(drm, free); // cppcheck-suppress uselessAssignmentPtrArg } diff --git a/src/v4p/drm.h b/src/v4p/drm.h index ce8773ae5..4f2155caf 100644 --- a/src/v4p/drm.h +++ b/src/v4p/drm.h @@ -85,7 +85,7 @@ typedef struct { } us_drm_s; -us_drm_s *us_drm_init(const char *path, const char *port); +us_drm_s *us_drm_init(void); void us_drm_destroy(us_drm_s *drm); int us_drm_wait_for_vsync(us_drm_s *drm); diff --git a/src/v4p/main.c b/src/v4p/main.c index 165b6827e..a1fda981b 100644 --- a/src/v4p/main.c +++ b/src/v4p/main.c @@ -179,8 +179,8 @@ static void _install_signal_handlers(void) { } static void _main_loop(void) { - us_drm_s *drm = us_drm_init("/dev/dri/card0", "HDMI-A-2"); - drm->n_bufs = 4; + us_drm_s *drm = us_drm_init(); + drm->port = "HDMI-A-2"; us_device_s *dev = us_device_init(); dev->path = "/dev/kvmd-video";