File tree Expand file tree Collapse file tree 6 files changed +33
-3
lines changed
Expand file tree Collapse file tree 6 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ Command line arguments
105105 You can set X11 geometry with this parameter [W[xH]][+-x+-y][/WS] or x:y.
106106 Resolution of OSD get from settings of output plugin (softhd*). OSD is scaled to video size.
107107
108+ -e drm device
109+ force set drm device (ex. /dev/dri/card0). Otherwise they will be tried /dev/dri/card1 and /dev/dri/card0.
110+
108111Plugin setup options
109112--------------------
110113
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ cMpvPluginConfig::cMpvPluginConfig()
4545 Geometry = "";
4646 Windowed = 0;
4747 ShowOptions = 0;
48+ DRMdev = "";
4849}
4950
5051vector<string> cMpvPluginConfig::ExplodeString(string Input)
@@ -73,7 +74,7 @@ int cMpvPluginConfig::ProcessArgs(int argc, char *const argv[])
7374
7475 for (;;)
7576 {
76- switch (getopt(argc, argv, "a:v:h:c:d:b:l:x:rm:swg:"))
77+ switch (getopt(argc, argv, "a:v:h:c:d:b:l:x:rm:swg:e: "))
7778 {
7879 case 'a': // audio out
7980 AudioOut = optarg;
@@ -114,6 +115,9 @@ int cMpvPluginConfig::ProcessArgs(int argc, char *const argv[])
114115 case 'g':
115116 Geometry = optarg;
116117 continue;
118+ case 'e':
119+ DRMdev = optarg;
120+ continue;
117121 case EOF:
118122 break;
119123 case ':':
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ class cMpvPluginConfig
6060 string X11Display; // X11 display used for mpv
6161 string TitleOverride; // title to display (ovveride used via service interface)
6262 string Geometry; // X11 display geometry
63+ string DRMdev; // DRM device
6364 int Windowed; // windowed mode, not fullscreen
6465
6566 int ShowOptions; // switch show menu options or filebrowser menu
Original file line number Diff line number Diff line change 1919#include "menu_options.h"
2020#include "mpv_service.h"
2121
22- static const char *VERSION = "1.6.1 "
22+ static const char *VERSION = "1.7.0 "
2323#ifdef GIT_REV
2424 "-GIT" GIT_REV
2525#endif
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ volatile int cMpvPlayer::running = 0;
4343cMpvPlayer *cMpvPlayer::PlayerHandle = NULL;
4444std::string LocaleSave;
4545int drm_ctx = 0;
46-
46+ const char *drm_dev = NULL;
4747Display *Dpy = NULL;
4848xcb_connection_t *Connect = NULL;
4949xcb_window_t VideoWindow = 0;
@@ -453,6 +453,25 @@ void cMpvPlayer::PlayerHideCursor()
453453}
454454
455455#ifdef USE_DRM
456+ int cMpvPlayer::PlayerTryDRM()
457+ {
458+ int fd;
459+ if (strcmp(MpvPluginConfig->DRMdev.c_str(),"")) {
460+ drm_dev = MpvPluginConfig->DRMdev.c_str();
461+ return 1;
462+ }
463+ //card1 mean external card, card0 internal. First try external card
464+ fd = open("/dev/dri/card1", O_RDWR);
465+ if (fd < 0) {
466+ fd = open("/dev/dri/card0", O_RDWR);
467+ if (fd < 0) return 0;
468+ else drm_dev = "/dev/dri/card0";
469+ } else drm_dev = "/dev/dri/card1";
470+
471+ close(fd);
472+ return 1;
473+ }
474+
456475void cMpvPlayer::PlayerGetDRM()
457476{
458477 int fd, i;
@@ -520,6 +539,8 @@ void cMpvPlayer::PlayerStart()
520539 if (!strcmp(MpvPluginConfig->GpuCtx.c_str(),"drm") || !strcmp(MpvPluginConfig->VideoOut.c_str(),"drm"))
521540 {
522541 drm_ctx = 1;
542+ if (!PlayerTryDRM()) return;
543+ check_error(mpv_set_option_string(hMpv, "drm-device", drm_dev));
523544 }
524545 //no geometry with drm
525546 if (!drm_ctx) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class cMpvPlayer:public cPlayer
2626 void SwitchOsdToMpv();
2727 void PlayerHideCursor();
2828 void PlayerGetDRM();
29+ int PlayerTryDRM();
2930
3031 string PlayFilename; // file to play
3132 bool PlayShuffle; // shuffle playlist
You can’t perform that action at this time.
0 commit comments