Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed Feb 26, 2024
1 parent 2d6716a commit 414baad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/v4p/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/v4p/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/v4p/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 414baad

Please sign in to comment.