summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meson.build5
-rw-r--r--video/out/vo_kitty.c9
-rw-r--r--wscript5
3 files changed, 15 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index c182bad653..5c6439d2f7 100644
--- a/meson.build
+++ b/meson.build
@@ -962,6 +962,11 @@ if features['sixel']
sources += files('video/out/vo_sixel.c')
endif
+features += {'posix_shm': false}
+if features['posix']
+ features += {'posix_shm': cc.has_function('shm_open', prefix: '#include <sys/mman.h>')}
+endif
+
spirv_cross = dependency('spirv-cross-c-shared', required: get_option('spirv-cross'))
features += {'spirv-cross': spirv_cross.found()}
if features['spirv-cross']
diff --git a/video/out/vo_kitty.c b/video/out/vo_kitty.c
index 99bbc7092f..6a511c8c8e 100644
--- a/video/out/vo_kitty.c
+++ b/video/out/vo_kitty.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <signal.h>
-#include <config.h>
+#include "config.h"
#if HAVE_POSIX
#include <fcntl.h>
@@ -34,7 +34,6 @@
#include <libswscale/swscale.h>
#include <libavutil/base64.h>
-#include "config.h"
#include "options/m_config.h"
#include "osdep/terminal.h"
#include "sub/osd.h"
@@ -109,7 +108,7 @@ static bool resized;
static void close_shm(struct priv *p)
{
-#if HAVE_POSIX
+#if HAVE_POSIX_SHM
if (p->buffer != NULL) {
munmap(p->buffer, p->buffer_size);
p->buffer = NULL;
@@ -210,7 +209,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
static int create_shm(struct vo *vo)
{
-#if HAVE_POSIX
+#if HAVE_POSIX_SHM
struct priv *p = vo->priv;
p->shm_fd = shm_open(p->shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
if (p->shm_fd == -1) {
@@ -344,7 +343,9 @@ static int preinit(struct vo *vo)
struct sigaction sa;
sa.sa_handler = handle_winch;
sigaction(SIGWINCH, &sa, &saved_sigaction);
+#endif
+#if HAVE_POSIX_SHM
if (p->opts.use_shm) {
p->shm_path = talloc_asprintf(vo, "/mpv-kitty-%p", vo);
int p_size = strlen(p->shm_path) - 1;
diff --git a/wscript b/wscript
index 1acba8a756..ab7ded7f8b 100644
--- a/wscript
+++ b/wscript
@@ -814,6 +814,11 @@ video_output_features = [
'desc': 'drmIsKMS() function',
'deps': 'drm',
'func': check_pkg_config('libdrm', '>= 2.4.105'),
+ }, {
+ 'name': 'posix-shm',
+ 'desc': "POSIX shared memory API",
+ 'deps': 'posix',
+ 'func': check_statement('sys/mman.h', 'shm_open("",0,0)')
}
]