summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
Diffstat (limited to 'video/out')
-rw-r--r--video/out/cocoa_cb_common.swift50
-rw-r--r--video/out/d3d11/context.c27
-rw-r--r--video/out/d3d11/ra_d3d11.c20
-rw-r--r--video/out/drm_atomic.c54
-rw-r--r--video/out/drm_common.c2
-rw-r--r--video/out/drm_prime.c14
-rw-r--r--video/out/gpu/lcms.h2
-rw-r--r--video/out/gpu/video.c4
-rw-r--r--video/out/hwdec/dmabuf_interop_wl.c4
-rw-r--r--video/out/hwdec/hwdec_cuda.c47
-rw-r--r--video/out/hwdec/hwdec_cuda.h9
-rw-r--r--video/out/hwdec/hwdec_cuda_gl.c32
-rw-r--r--video/out/hwdec/hwdec_cuda_vk.c50
-rw-r--r--video/out/hwdec/hwdec_drmprime_overlay.c2
-rw-r--r--video/out/hwdec/hwdec_vaapi.c9
-rw-r--r--video/out/mac/common.swift2
-rw-r--r--video/out/mac/gl_layer.swift1
-rw-r--r--video/out/mac/view.swift1
-rw-r--r--video/out/opengl/common.c1
-rw-r--r--video/out/opengl/context_x11egl.c1
-rw-r--r--video/out/opengl/egl_helpers.c111
-rw-r--r--video/out/vo.h2
-rw-r--r--video/out/vo_dmabuf_wayland.c6
-rw-r--r--video/out/vo_gpu_next.c5
-rw-r--r--video/out/vo_sdl.c1
-rw-r--r--video/out/vo_sixel.c4
-rw-r--r--video/out/vo_tct.c1
-rw-r--r--video/out/vo_vaapi.c16
-rw-r--r--video/out/vo_xv.c2
-rw-r--r--video/out/w32_common.c107
-rw-r--r--video/out/wayland_common.c205
-rw-r--r--video/out/win32/menu.c17
-rw-r--r--video/out/win32/menu.h2
-rw-r--r--video/out/x11_common.c38
-rw-r--r--video/out/x11_common.h2
35 files changed, 587 insertions, 264 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift
index 38c47a19a2..b2910dba85 100644
--- a/video/out/cocoa_cb_common.swift
+++ b/video/out/cocoa_cb_common.swift
@@ -120,7 +120,55 @@ class CocoaCB: Common, EventSubscriber {
}
libmpv.setRenderICCProfile(colorSpace)
- layer?.colorspace = colorSpace.cgColorSpace
+ layer?.colorspace = getColorSpace()
+ }
+
+ func getColorSpace() -> CGColorSpace? {
+ guard let colorSpace = window?.screen?.colorSpace?.cgColorSpace else {
+ log.warning("Couldn't retrieve ICC Profile, no color space available")
+ return nil
+ }
+
+ let outputCsp = Int(option.mac.cocoa_cb_output_csp)
+
+ switch outputCsp {
+ case MAC_CSP_AUTO: return colorSpace
+ case MAC_CSP_DISPLAY_P3: return CGColorSpace(name: CGColorSpace.displayP3)
+ case MAC_CSP_DISPLAY_P3_HLG: return CGColorSpace(name: CGColorSpace.displayP3_HLG)
+ case MAC_CSP_DISPLAY_P3_PQ: return CGColorSpace(name: CGColorSpace.displayP3_PQ)
+ case MAC_CSP_DCI_P3: return CGColorSpace(name: CGColorSpace.dcip3)
+ case MAC_CSP_BT_2020: return CGColorSpace(name: CGColorSpace.itur_2020)
+ case MAC_CSP_BT_709: return CGColorSpace(name: CGColorSpace.itur_709)
+ case MAC_CSP_SRGB: return CGColorSpace(name: CGColorSpace.sRGB)
+ case MAC_CSP_SRGB_LINEAR: return CGColorSpace(name: CGColorSpace.linearSRGB)
+ case MAC_CSP_RGB_LINEAR: return CGColorSpace(name: CGColorSpace.genericRGBLinear)
+ case MAC_CSP_ADOBE: return CGColorSpace(name: CGColorSpace.adobeRGB1998)
+ default: break
+ }
+
+#if HAVE_MACOS_11_FEATURES
+ if #available(macOS 11.0, *) {
+ switch outputCsp {
+ case MAC_CSP_BT_2100_HLG: return CGColorSpace(name: CGColorSpace.itur_2100_HLG)
+ case MAC_CSP_BT_2100_PQ: return CGColorSpace(name: CGColorSpace.itur_2100_PQ)
+ default: break
+ }
+ }
+#endif
+
+#if HAVE_MACOS_12_FEATURES
+ if #available(macOS 12.0, *) {
+ switch outputCsp {
+ case MAC_CSP_DISPLAY_P3_LINEAR: return CGColorSpace(name: CGColorSpace.linearDisplayP3)
+ case MAC_CSP_BT_2020_LINEAR: return CGColorSpace(name: CGColorSpace.linearITUR_2020)
+ default: break
+ }
+ }
+#endif
+
+ log.warning("Couldn't retrieve configured color space, falling back to auto")
+
+ return colorSpace
}
override func windowDidEndAnimation() {
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index f183ae8be5..8836af16e0 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -99,8 +99,8 @@ struct priv {
struct pl_color_space swapchain_csp;
int64_t perf_freq;
- unsigned sync_refresh_count;
- int64_t sync_qpc_time;
+ unsigned last_sync_refresh_count;
+ int64_t last_sync_qpc_time;
int64_t vsync_duration_qpc;
int64_t last_submit_qpc;
};
@@ -273,33 +273,28 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info)
DXGI_FRAME_STATISTICS stats;
hr = IDXGISwapChain_GetFrameStatistics(p->swapchain, &stats);
if (hr == DXGI_ERROR_FRAME_STATISTICS_DISJOINT) {
- p->sync_refresh_count = 0;
- p->sync_qpc_time = 0;
+ p->last_sync_refresh_count = 0;
+ p->last_sync_qpc_time = 0;
}
if (FAILED(hr))
return;
- info->last_queue_display_time = 0;
- info->vsync_duration = 0;
// Detecting skipped vsyncs is possible but not supported yet
info->skipped_vsyncs = -1;
- // Get the number of physical vsyncs that have passed since the start of the
- // playback or disjoint event.
+ // Get the number of physical vsyncs that have passed since the last call.
// Check for 0 here, since sometimes GetFrameStatistics returns S_OK but
// with 0s in some (all?) members of DXGI_FRAME_STATISTICS.
unsigned src_passed = 0;
- if (stats.SyncRefreshCount && p->sync_refresh_count)
- src_passed = stats.SyncRefreshCount - p->sync_refresh_count;
- if (p->sync_refresh_count == 0)
- p->sync_refresh_count = stats.SyncRefreshCount;
+ if (stats.SyncRefreshCount && p->last_sync_refresh_count)
+ src_passed = stats.SyncRefreshCount - p->last_sync_refresh_count;
+ p->last_sync_refresh_count = stats.SyncRefreshCount;
// Get the elapsed time passed between the above vsyncs
unsigned sqt_passed = 0;
- if (stats.SyncQPCTime.QuadPart && p->sync_qpc_time)
- sqt_passed = stats.SyncQPCTime.QuadPart - p->sync_qpc_time;
- if (p->sync_qpc_time == 0)
- p->sync_qpc_time = stats.SyncQPCTime.QuadPart;
+ if (stats.SyncQPCTime.QuadPart && p->last_sync_qpc_time)
+ sqt_passed = stats.SyncQPCTime.QuadPart - p->last_sync_qpc_time;
+ p->last_sync_qpc_time = stats.SyncQPCTime.QuadPart;
// If any vsyncs have passed, estimate the physical frame rate
if (src_passed && sqt_passed)
diff --git a/video/out/d3d11/ra_d3d11.c b/video/out/d3d11/ra_d3d11.c
index 4438b2083c..2b35686111 100644
--- a/video/out/d3d11/ra_d3d11.c
+++ b/video/out/d3d11/ra_d3d11.c
@@ -1503,21 +1503,21 @@ static size_t vbuf_upload(struct ra *ra, void *data, size_t size)
}
static const char cache_magic[4] = "RD11";
-static const int cache_version = 3;
+static const uint32_t cache_version = 4;
struct cache_header {
char magic[sizeof(cache_magic)];
- int cache_version;
+ uint32_t cache_version;
char compiler[SPIRV_NAME_MAX_LEN];
- int spv_compiler_version;
- unsigned spvc_compiler_major;
- unsigned spvc_compiler_minor;
- unsigned spvc_compiler_patch;
+ int32_t spv_compiler_version;
+ uint32_t spvc_compiler_major;
+ uint32_t spvc_compiler_minor;
+ uint32_t spvc_compiler_patch;
struct dll_version d3d_compiler_version;
- int feature_level;
- size_t vert_bytecode_len;
- size_t frag_bytecode_len;
- size_t comp_bytecode_len;
+ int32_t feature_level;
+ uint32_t vert_bytecode_len;
+ uint32_t frag_bytecode_len;
+ uint32_t comp_bytecode_len;
};
static void load_cached_program(struct ra *ra,
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index 5754504e98..c1a15fa75f 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -43,7 +43,7 @@ int drm_object_create_properties(struct mp_log *log, int fd,
return 0;
- fail:
+fail:
drm_object_free_properties(object);
return -1;
}
@@ -68,43 +68,43 @@ void drm_object_free_properties(struct drm_object *object)
int drm_object_get_property(struct drm_object *object, char *name, uint64_t *value)
{
- for (int i = 0; i < object->props->count_props; i++) {
- if (strcasecmp(name, object->props_info[i]->name) == 0) {
- *value = object->props->prop_values[i];
- return 0;
- }
- }
-
- return -EINVAL;
+ for (int i = 0; i < object->props->count_props; i++) {
+ if (strcasecmp(name, object->props_info[i]->name) == 0) {
+ *value = object->props->prop_values[i];
+ return 0;
+ }
+ }
+
+ return -EINVAL;
}
drmModePropertyBlobPtr drm_object_get_property_blob(struct drm_object *object, char *name)
{
- uint64_t blob_id;
+ uint64_t blob_id;
- if (!drm_object_get_property(object, name, &blob_id)) {
- return drmModeGetPropertyBlob(object->fd, blob_id);
- }
+ if (!drm_object_get_property(object, name, &blob_id)) {
+ return drmModeGetPropertyBlob(object->fd, blob_id);
+ }
- return NULL;
+ return NULL;
}
int drm_object_set_property(drmModeAtomicReq *request, struct drm_object *object,
char *name, uint64_t value)
{
- for (int i = 0; i < object->props->count_props; i++) {
- if (strcasecmp(name, object->props_info[i]->name) == 0) {
- if (object->props_info[i]->flags & DRM_MODE_PROP_IMMUTABLE) {
- /* Do not try to set immutable values, as this might cause the
- * atomic commit operation to fail. */
- return -EINVAL;
- }
- return drmModeAtomicAddProperty(request, object->id,
- object->props_info[i]->prop_id, value);
- }
- }
-
- return -EINVAL;
+ for (int i = 0; i < object->props->count_props; i++) {
+ if (strcasecmp(name, object->props_info[i]->name) == 0) {
+ if (object->props_info[i]->flags & DRM_MODE_PROP_IMMUTABLE) {
+ /* Do not try to set immutable values, as this might cause the
+ * atomic commit operation to fail. */
+ return -EINVAL;
+ }
+ return drmModeAtomicAddProperty(request, object->id,
+ object->props_info[i]->prop_id, value);
+ }
+ }
+
+ return -EINVAL;
}
struct drm_object *drm_object_create(struct mp_log *log, int fd,
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index e47de7df86..0f65a8426a 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -583,7 +583,7 @@ static bool setup_crtc(struct vo_drm_state *drm, const drmModeRes *res)
drm->connector->connector_id);
return false;
- success:
+success:
MP_VERBOSE(drm, "Selected Encoder %u with CRTC %u\n",
drm->encoder->encoder_id, drm->crtc_id);
return true;
diff --git a/video/out/drm_prime.c b/video/out/drm_prime.c
index 9335fa8e02..581eb717bb 100644
--- a/video/out/drm_prime.c
+++ b/video/out/drm_prime.c
@@ -86,13 +86,13 @@ int drm_prime_create_framebuffer(struct mp_log *log, int fd,
for (int plane = 0; plane < AV_DRM_MAX_PLANES; plane++) {
drm_prime_add_handle_ref(handle_refs, framebuffer->gem_handles[plane]);
}
- }
+ }
- return 0;
+ return 0;
fail:
- memset(framebuffer, 0, sizeof(*framebuffer));
- return -1;
+ memset(framebuffer, 0, sizeof(*framebuffer));
+ return -1;
}
void drm_prime_destroy_framebuffer(struct mp_log *log, int fd,
@@ -129,9 +129,11 @@ void drm_prime_add_handle_ref(struct drm_prime_handle_refs *handle_refs,
{
if (handle) {
if (handle > handle_refs->size) {
- handle_refs->size = handle;
MP_TARRAY_GROW(handle_refs->ctx, handle_refs->handle_ref_count,
- handle_refs->size);
+ handle - 1);
+ uint32_t *p = handle_refs->handle_ref_count;
+ memset(&p[handle_refs->size], 0, (handle - handle_refs->size) * sizeof(p[0]));
+ handle_refs->size = handle;
}
handle_refs->handle_ref_count[handle - 1]++;
}
diff --git a/video/out/gpu/lcms.h b/video/out/gpu/lcms.h
index d0b0fe5b89..30a6c54e83 100644
--- a/video/out/gpu/lcms.h
+++ b/video/out/gpu/lcms.h
@@ -44,6 +44,8 @@ bool gl_lcms_has_changed(struct gl_lcms *p, enum pl_color_primaries prim,
static inline bool gl_parse_3dlut_size(const char *arg, int *p1, int *p2, int *p3)
{
+ if (!arg)
+ return false;
if (!strcmp(arg, "auto")) {
*p1 = *p2 = *p3 = 0;
return true;
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 1478ec4687..4d8e197229 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -965,8 +965,8 @@ static void init_video(struct gl_video *p)
static struct dr_buffer *gl_find_dr_buffer(struct gl_video *p, uint8_t *ptr)
{
- for (int i = 0; i < p->num_dr_buffers; i++) {
- struct dr_buffer *buffer = &p->dr_buffers[i];
+ for (int i = 0; i < p->num_dr_buffers; i++) {
+ struct dr_buffer *buffer = &p->dr_buffers[i];
uint8_t *bufptr = buffer->buf->data;
size_t size = buffer->buf->params.size;
if (ptr >= bufptr && ptr < bufptr + size)
diff --git a/video/out/hwdec/dmabuf_interop_wl.c b/video/out/hwdec/dmabuf_interop_wl.c
index 606a0aa601..78baf146f0 100644
--- a/video/out/hwdec/dmabuf_interop_wl.c
+++ b/video/out/hwdec/dmabuf_interop_wl.c
@@ -46,7 +46,7 @@ static bool map(struct ra_hwdec_mapper *mapper,
return false;
} else if (!ra_compatible_format(mapper->ra, drm_format,
mapper_p->desc.objects[0].format_modifier)) {
- MP_VERBOSE(mapper, "Mapped surface with format %s; drm format '%s(%016lx)' "
+ MP_VERBOSE(mapper, "Mapped surface with format %s; drm format '%s(%016" PRIx64 ")' "
"is not supported by compositor.\n",
mp_imgfmt_to_name(mapper->src->params.hw_subfmt),
mp_tag_str(drm_format),
@@ -54,7 +54,7 @@ static bool map(struct ra_hwdec_mapper *mapper,
return false;
}
- MP_VERBOSE(mapper, "Supported Wayland display format %s: '%s(%016lx)'\n",
+ MP_VERBOSE(mapper, "Supported Wayland display format %s: '%s(%016" PRIx64 ")'\n",
mp_imgfmt_to_name(mapper->src->params.hw_subfmt),
mp_tag_str(drm_format), mapper_p->desc.objects[0].format_modifier);
diff --git a/video/out/hwdec/hwdec_cuda.c b/video/out/hwdec/hwdec_cuda.c
index 57e4fb40e3..8987cf3407 100644
--- a/video/out/hwdec/hwdec_cuda.c
+++ b/video/out/hwdec/hwdec_cuda.c
@@ -57,12 +57,12 @@ int check_cu(const struct ra_hwdec *hw, CUresult err, const char *func)
#define CHECK_CU(x) check_cu(hw, (x), #x)
-static const cuda_interop_init interop_inits[] = {
+static const struct cuda_interop_fn *interop_fns[] = {
#if HAVE_GL
- cuda_gl_init,
+ &cuda_gl_fn,
#endif
#if HAVE_VULKAN
- cuda_vk_init,
+ &cuda_vk_fn,
#endif
NULL
};
@@ -73,25 +73,36 @@ static int cuda_init(struct ra_hwdec *hw)
CUcontext dummy;
int ret = 0;
struct cuda_hw_priv *p = hw->priv;
- CudaFunctions *cu;
+ CudaFunctions *cu = NULL;
int level = hw->probing ? MSGL_V : MSGL_ERR;
-
- ret = cuda_load_functions(&p->cu, NULL);
- if (ret != 0) {
- MP_MSG(hw, level, "Failed to load CUDA symbols\n");
- return -1;
- }
- cu = p->cu;
-
- ret = CHECK_CU(cu->cuInit(0));
- if (ret < 0)
- return -1;
+ bool initialized = false;
// Initialise CUDA context from backend.
- for (int i = 0; interop_inits[i]; i++) {
- if (interop_inits[i](hw)) {
- break;
+ // Note that the interop check doesn't require the CUDA backend to be initialized.
+ // This is important because cuInit wakes up the dgpu (even if the cuda hwdec won't be used!)
+ // Doing this allows us to check if CUDA should be used without waking up the dgpu, avoiding
+ // a few seconds of delay and improving battery life for laptops!
+ for (int i = 0; interop_fns[i]; i++) {
+ if (!interop_fns[i]->check(hw))
+ continue;
+
+ if (!initialized) {
+ ret = cuda_load_functions(&p->cu, NULL);
+ if (ret != 0) {
+ MP_MSG(hw, level, "Failed to load CUDA symbols\n");
+ return -1;
+ }
+
+ cu = p->cu;
+ ret = CHECK_CU(cu->cuInit(0));
+ if (ret < 0)
+ return -1;
+
+ initialized = true;
}
+
+ if (interop_fns[i]->init(hw))
+ break;
}
if (!p->ext_init || !p->ext_uninit) {
diff --git a/video/out/hwdec/hwdec_cuda.h b/video/out/hwdec/hwdec_cuda.h
index 9c55053d59..6e671b364e 100644
--- a/video/out/hwdec/hwdec_cuda.h
+++ b/video/out/hwdec/hwdec_cuda.h
@@ -50,10 +50,13 @@ struct cuda_mapper_priv {
void *ext[4];
};
-typedef bool (*cuda_interop_init)(const struct ra_hwdec *hw);
+struct cuda_interop_fn {
+ bool (*check)(const struct ra_hwdec *hw);
+ bool (*init)(const struct ra_hwdec *hw);
+};
-bool cuda_gl_init(const struct ra_hwdec *hw);
+extern struct cuda_interop_fn cuda_gl_fn;
-bool cuda_vk_init(const struct ra_hwdec *hw);
+extern struct cuda_interop_fn cuda_vk_fn;
int check_cu(const struct ra_hwdec *hw, CUresult err, const char *func);
diff --git a/video/out/hwdec/hwdec_cuda_gl.c b/video/out/hwdec/hwdec_cuda_gl.c
index f20540ed4d..4c2535232f 100644
--- a/video/out/hwdec/hwdec_cuda_gl.c
+++ b/video/out/hwdec/hwdec_cuda_gl.c
@@ -25,7 +25,6 @@
#include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_cuda.h>
-#include <unistd.h>
#define CHECK_CU(x) check_cu((mapper)->owner, (x), #x)
@@ -106,22 +105,24 @@ static void cuda_ext_gl_uninit(const struct ra_hwdec_mapper *mapper, int n)
#undef CHECK_CU
#define CHECK_CU(x) check_cu(hw, (x), #x)
-bool cuda_gl_init(const struct ra_hwdec *hw) {
- int ret = 0;
- struct cuda_hw_priv *p = hw->priv;
- CudaFunctions *cu = p->cu;
+static bool cuda_gl_check(const struct ra_hwdec *hw) {
+ if (!ra_is_gl(hw->ra_ctx->ra))
+ return false; // This is not an OpenGL RA.
- if (ra_is_gl(hw->ra_ctx->ra)) {
- GL *gl = ra_gl_get(hw->ra_ctx->ra);
- if (gl->version < 210 && gl->es < 300) {
- MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n");
- return false;
- }
- } else {
- // This is not an OpenGL RA.
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
+ if (gl->version < 210 && gl->es < 300) {
+ MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n");
return false;
}
+ return true;
+}
+
+static bool cuda_gl_init(const struct ra_hwdec *hw) {
+ int ret = 0;
+ struct cuda_hw_priv *p = hw->priv;
+ CudaFunctions *cu = p->cu;
+
CUdevice display_dev;
unsigned int device_count;
ret = CHECK_CU(cu->cuGLGetDevices(&device_count, &display_dev, 1,
@@ -172,3 +173,8 @@ bool cuda_gl_init(const struct ra_hwdec *hw) {
return true;
}
+
+struct cuda_interop_fn cuda_gl_fn = {
+ .check = cuda_gl_check,
+ .init = cuda_gl_init
+};
diff --git a/video/out/hwdec/hwdec_cuda_vk.c b/video/out/hwdec/hwdec_cuda_vk.c
index b9f8caa815..e744ff628a 100644
--- a/video/out/hwdec/hwdec_cuda_vk.c
+++ b/video/out/hwdec/hwdec_cuda_vk.c
@@ -24,7 +24,8 @@
#include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_cuda.h>
#include <libplacebo/vulkan.h>
-#include <unistd.h>
+
+#include "osdep/io.h"
#if HAVE_WIN32_DESKTOP
#include <versionhelpers.h>
@@ -147,8 +148,8 @@ static bool cuda_ext_vk_init(struct ra_hwdec_mapper *mapper,
if (evk->vk_sem.sem == VK_NULL_HANDLE) {
ret = -1;
goto error;
- }
- // The returned FD or Handle is owned by the caller (us).
+ }
+ // The returned FD or Handle is owned by the caller (us).
CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC w_desc = {
#if HAVE_WIN32_DESKTOP
@@ -233,8 +234,8 @@ static bool cuda_ext_vk_wait(const struct ra_hwdec_mapper *mapper, int n)
.value = evk->vk_sem.value
}
}
- };
- ret = CHECK_CU(cu->cuWaitExternalSemaphoresAsync(&evk->cuda_sem,
+ };
+ ret = CHECK_CU(cu->cuWaitExternalSemaphoresAsync(&evk->cuda_sem,
&wp, 1, 0));
return ret == 0;
}
@@ -272,27 +273,30 @@ static bool cuda_ext_vk_signal(const struct ra_hwdec_mapper *mapper, int n)
#undef CHECK_CU
#define CHECK_CU(x) check_cu(hw, (x), #x)
-bool cuda_vk_init(const struct ra_hwdec *hw) {
+static bool cuda_vk_check(const struct ra_hwdec *hw) {
+ pl_gpu gpu = ra_pl_get(hw->ra_ctx->ra);
+ if (gpu == NULL)
+ return false; // This is not a Vulkan RA.
+
+ if (!(gpu->export_caps.tex & HANDLE_TYPE)) {
+ MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable texture memory of type 0x%X.\n",
+ HANDLE_TYPE);
+ return false;
+ } else if (!(gpu->export_caps.sync & HANDLE_TYPE)) {
+ MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable semaphores of type 0x%X.\n",
+ HANDLE_TYPE);
+ return false;
+ }
+
+ return true;
+}
+
+static bool cuda_vk_init(const struct ra_hwdec *hw) {
int ret = 0;
int level = hw->probing ? MSGL_V : MSGL_ERR;
struct cuda_hw_priv *p = hw->priv;
CudaFunctions *cu = p->cu;
-
pl_gpu gpu = ra_pl_get(hw->ra_ctx->ra);
- if (gpu != NULL) {
- if (!(gpu->export_caps.tex & HANDLE_TYPE)) {
- MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable texture memory of type 0x%X.\n",
- HANDLE_TYPE);
- return false;
- } else if (!(gpu->export_caps.sync & HANDLE_TYPE)) {
- MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable semaphores of type 0x%X.\n",
- HANDLE_TYPE);
- return false;
- }
- } else {
- // This is not a Vulkan RA.
- return false;
- }
if (!cu->cuImportExternalMemory) {
MP_MSG(hw, level, "CUDA hwdec with Vulkan requires driver version 410.48 or newer.\n");
@@ -342,3 +346,7 @@ bool cuda_vk_init(const struct ra_hwdec *hw) {
return true;
}
+struct cuda_interop_fn cuda_vk_fn = {
+ .check = cuda_vk_check,
+ .init = cuda_vk_init
+};
diff --git a/video/out/hwdec/hwdec_drmprime_overlay.c b/video/out/hwdec/hwdec_drmprime_overlay.c
index 6b6aae60f0..f5c4b1a4cb 100644
--- a/video/out/hwdec/hwdec_drmprime_overlay.c
+++ b/video/out/hwdec/hwdec_drmprime_overlay.c
@@ -88,7 +88,7 @@ static void set_current_frame(struct ra_hwdec *hw, struct drm_frame *frame)
}
}
-static void scale_dst_rect(struct ra_hwdec *hw, int source_w, int source_h ,struct mp_rect *src, struct mp_rect *dst)
+static void scale_dst_rect(struct ra_hwdec *hw, int source_w, int source_h, struct mp_rect *src, struct mp_rect *dst)
{
struct priv *p = hw->priv;
diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c
index 34b6e52b3c..504880ad4e 100644
--- a/video/out/hwdec/hwdec_vaapi.c
+++ b/video/out/hwdec/hwdec_vaapi.c
@@ -18,7 +18,6 @@
#include <stddef.h>
#include <string.h>
#include <assert.h>
-#include <unistd.h>
#include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_vaapi.h>
@@ -85,16 +84,18 @@ static const struct va_create_native create_native_cbs[] = {
#if HAVE_VAAPI_DRM
{"drm", create_drm_va_display},
#endif
+ {0}
};
static VADisplay *create_native_va_display(struct ra *ra, struct mp_log *log)
{
- for (int n = 0; n < MP_ARRAY_SIZE(create_native_cbs); n++) {
- const struct va_create_native *disp = &create_native_cbs[n];
+ const struct va_create_native *disp = create_native_cbs;
+ while (disp->name) {
mp_verbose(log, "Trying to open a %s VA display...\n", disp->name);
VADisplay *display = disp->create(ra);
if (display)
return display;
+ disp++;
}
return NULL;
}
@@ -242,7 +243,7 @@ static int mapper_init(struct ra_hwdec_mapper *mapper)
if (mapper->ra->num_formats &&
!ra_get_imgfmt_desc(mapper->ra, mapper->dst_params.imgfmt, &desc))
- return -1;
+ return -1;
p->num_planes = desc.num_planes;
mp_image_set_params(&p->layout, &mapper->dst_params);
diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift
index 50a508e872..9fd7dbc9ea 100644
--- a/video/out/mac/common.swift
+++ b/video/out/mac/common.swift
@@ -668,6 +668,8 @@ class Common: NSObject {
titleBar?.set(material: Int(option.mac.macos_title_bar_material))
case TypeHelper.toPointer(&option.macPtr.pointee.macos_title_bar_color):
titleBar?.set(color: option.mac.macos_title_bar_color)
+ case TypeHelper.toPointer(&option.macPtr.pointee.cocoa_cb_output_csp):
+ updateICCProfile()
default:
break
}
diff --git a/video/out/mac/gl_layer.swift b/video/out/mac/gl_layer.swift
index eba6f1a2d4..6a98f3dbec 100644
--- a/video/out/mac/gl_layer.swift
+++ b/video/out/mac/gl_layer.swift
@@ -106,6 +106,7 @@ class GLLayer: CAOpenGLLayer {
super.init()
autoresizingMask = [.layerWidthSizable, .layerHeightSizable]
backgroundColor = NSColor.black.cgColor
+ wantsExtendedDynamicRangeContent = true
if bufferDepth > 8 {
contentsFormat = .RGBA16Float
diff --git a/video/out/mac/view.swift b/video/out/mac/view.swift
index 4921b7512c..b82151ba96 100644
--- a/video/out/mac/view.swift
+++ b/video/out/mac/view.swift
@@ -32,6 +32,7 @@ class View: NSView, CALayerDelegate {
super.init(frame: frame)
autoresizingMask = [.width, .height]
wantsBestResolutionOpenGLSurface = true
+ wantsExtendedDynamicRangeOpenGLSurface = true
registerForDraggedTypes([ .fileURL, .URL, .string ])
}
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c
index e3fc1ba032..6d361217b9 100644
--- a/video/out/opengl/common.c
+++ b/video/out/opengl/common.c
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <strings.h>
#include <stdbool.h>
#include <math.h>
#include <assert.h>
diff --git a/video/out/opengl/context_x11egl.c b/video/out/opengl/context_x11egl.c
index e5885b6106..0803f48ad4 100644
--- a/video/out/opengl/context_x11egl.c
+++ b/video/out/opengl/context_x11egl.c
@@ -18,7 +18,6 @@
#include <assert.h>
#include <X11/Xlib.h>
-#include <X11/extensions/Xpresent.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c
index 18d9027762..91a6480eb2 100644
--- a/video/out/opengl/egl_helpers.c
+++ b/video/out/opengl/egl_helpers.c
@@ -16,6 +16,7 @@
*/
#include "config.h"
+#include "options/m_config.h"
#if HAVE_LIBDL
#include <dlfcn.h>
@@ -53,6 +54,12 @@ typedef intptr_t EGLAttrib;
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0
#endif
+#ifndef EGL_COLOR_COMPONENT_TYPE_E