mirror of https://github.com/mpv-player/mpv
drm_common: remove hard dependency on drmIsKMS()
ae768a1e14
forgot to bump the required
libdrm version however Debian 11 just barely misses the requirement,
which is a good reason not to require it unconditionally anyway.
This commit is contained in:
parent
5f6e8f856c
commit
f2ef942ef5
10
meson.build
10
meson.build
|
@ -952,6 +952,15 @@ if drm['use']
|
||||||
'video/out/vo_drm.c')
|
'video/out/vo_drm.c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# This can be removed roughly when Debian 12 is released.
|
||||||
|
drm_is_kms = {
|
||||||
|
'name': 'drm-is-kms',
|
||||||
|
'use': drm['use'] and drm['deps'].version().version_compare('>= 2.4.105')
|
||||||
|
}
|
||||||
|
if drm_is_kms['use']
|
||||||
|
features += drm_is_kms['name']
|
||||||
|
endif
|
||||||
|
|
||||||
gbm = dependency('gbm', version: '>=17.1.0', required: get_option('gbm'))
|
gbm = dependency('gbm', version: '>=17.1.0', required: get_option('gbm'))
|
||||||
if gbm.found()
|
if gbm.found()
|
||||||
dependencies += gbm
|
dependencies += gbm
|
||||||
|
@ -1745,6 +1754,7 @@ conf_data.set10('HAVE_DMABUF_INTEROP_GL', dmabuf_interop_gl['use'])
|
||||||
conf_data.set10('HAVE_DMABUF_INTEROP_PL', dmabuf_interop_pl['use'])
|
conf_data.set10('HAVE_DMABUF_INTEROP_PL', dmabuf_interop_pl['use'])
|
||||||
conf_data.set10('HAVE_DOS_PATHS', win32)
|
conf_data.set10('HAVE_DOS_PATHS', win32)
|
||||||
conf_data.set10('HAVE_DRM', drm['use'])
|
conf_data.set10('HAVE_DRM', drm['use'])
|
||||||
|
conf_data.set10('HAVE_DRM_IS_KMS', drm_is_kms['use'])
|
||||||
conf_data.set10('HAVE_DVBIN', dvbin.allowed())
|
conf_data.set10('HAVE_DVBIN', dvbin.allowed())
|
||||||
conf_data.set10('HAVE_DVDNAV', dvdnav.found() and dvdread.found())
|
conf_data.set10('HAVE_DVDNAV', dvdnav.found() and dvdread.found())
|
||||||
conf_data.set10('HAVE_EGL', egl['use'])
|
conf_data.set10('HAVE_EGL', egl['use'])
|
||||||
|
|
|
@ -523,6 +523,19 @@ static int open_card_path(const char *path)
|
||||||
return open(path, O_RDWR | O_CLOEXEC);
|
return open(path, O_RDWR | O_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool card_supports_kms(const char *path)
|
||||||
|
{
|
||||||
|
#if HAVE_DRM_IS_KMS
|
||||||
|
int fd = open_card_path(path);
|
||||||
|
bool ret = fd != -1 && drmIsKMS(fd);
|
||||||
|
if (fd != -1)
|
||||||
|
close(fd);
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static char *get_primary_device_path(struct mp_log *log, int *card_no)
|
static char *get_primary_device_path(struct mp_log *log, int *card_no)
|
||||||
{
|
{
|
||||||
drmDevice *devices[DRM_MAX_MINOR] = { 0 };
|
drmDevice *devices[DRM_MAX_MINOR] = { 0 };
|
||||||
|
@ -558,11 +571,7 @@ static char *get_primary_device_path(struct mp_log *log, int *card_no)
|
||||||
|
|
||||||
const char *primary_node_path = dev->nodes[DRM_NODE_PRIMARY];
|
const char *primary_node_path = dev->nodes[DRM_NODE_PRIMARY];
|
||||||
|
|
||||||
int fd = open_card_path(primary_node_path);
|
if (!card_supports_kms(primary_node_path)) {
|
||||||
const int is_kms = fd != -1 && drmIsKMS(fd);
|
|
||||||
if (fd != -1)
|
|
||||||
close(fd);
|
|
||||||
if (!is_kms) {
|
|
||||||
if (card_no_given) {
|
if (card_no_given) {
|
||||||
mp_err(log,
|
mp_err(log,
|
||||||
"DRM card number %d given, yet it does not support "
|
"DRM card number %d given, yet it does not support "
|
||||||
|
|
6
wscript
6
wscript
|
@ -792,6 +792,12 @@ video_output_features = [
|
||||||
'desc': 'dmabuf libplacebo interop',
|
'desc': 'dmabuf libplacebo interop',
|
||||||
'deps': 'vaapi-libplacebo',
|
'deps': 'vaapi-libplacebo',
|
||||||
'func': check_true,
|
'func': check_true,
|
||||||
|
}, {
|
||||||
|
# This can be removed roughly when Debian 12 is released.
|
||||||
|
'name': 'drm-is-kms',
|
||||||
|
'desc': 'drmIsKMS() function',
|
||||||
|
'deps': 'drm',
|
||||||
|
'func': check_pkg_config('libdrm', '>= 2.4.105'),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue