summaryrefslogtreecommitdiffstats
path: root/libmpv
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2019-09-12 21:00:50 +0200
committerJan Ekström <jeebjp@gmail.com>2019-09-18 23:59:32 +0300
commite08f235578aa6305a41e7c7132225e58bd191ef0 (patch)
tree5a96a85f873f1dc0e117d2fb3fb0191e6e44c462 /libmpv
parentb04ddcdc0b24c8d594bcb001c964035aa7ebd008 (diff)
downloadmpv-e08f235578aa6305a41e7c7132225e58bd191ef0.tar.bz2
mpv-e08f235578aa6305a41e7c7132225e58bd191ef0.tar.xz
drm: fix libmpv ABI breakage introduced in 351c083487050c88adb0e3d60f2174850f869018
Extending the client-allocated mpv_opengl_drm_params struct constituted a break of ABI that could cause UB. Create a clean break by deprecating "drm_params" and related structs and enum values, and replacing it with "drm_params_v2". Also fix some comments and code that wrongly assumed that open could return any other negative number than -1 for failure. This commit updates the libmpv version to 1.104
Diffstat (limited to 'libmpv')
-rw-r--r--libmpv/client.h2
-rw-r--r--libmpv/render.h9
-rw-r--r--libmpv/render_gl.h38
3 files changed, 33 insertions, 16 deletions
diff --git a/libmpv/client.h b/libmpv/client.h
index 51beb1a41b..eec3d0776f 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -223,7 +223,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 103)
+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 104)
/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
diff --git a/libmpv/render.h b/libmpv/render.h
index 304a21a932..14933674ca 100644
--- a/libmpv/render.h
+++ b/libmpv/render.h
@@ -277,8 +277,7 @@ typedef enum mpv_render_param_type {
*/
MPV_RENDER_PARAM_SKIP_RENDERING = 13,
/**
- * DRM display, contains drm display handles.
- * Valid for mpv_render_context_create().
+ * Deprecated. Not supported. Use MPV_RENDER_PARAM_DRM_DISPLAY_V2 instead.
* Type : struct mpv_opengl_drm_params*
*/
MPV_RENDER_PARAM_DRM_DISPLAY = 14,
@@ -288,6 +287,12 @@ typedef enum mpv_render_param_type {
* Type : struct mpv_opengl_drm_draw_surface_size*
*/
MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE = 15,
+ /**
+ * DRM display, contains drm display handles.
+ * Valid for mpv_render_context_create().
+ * Type : struct mpv_opengl_drm_params_v2*
+ */
+ MPV_RENDER_PARAM_DRM_DISPLAY_V2 = 16,
} mpv_render_param_type;
/**
diff --git a/libmpv/render_gl.h b/libmpv/render_gl.h
index 69bec75c47..cb141df564 100644
--- a/libmpv/render_gl.h
+++ b/libmpv/render_gl.h
@@ -150,11 +150,32 @@ typedef struct mpv_opengl_fbo {
} mpv_opengl_fbo;
/**
- * For MPV_RENDER_PARAM_DRM_DISPLAY.
+ * Deprecated. For MPV_RENDER_PARAM_DRM_DISPLAY.
*/
typedef struct mpv_opengl_drm_params {
+ int fd;
+ int crtc_id;
+ int connector_id;
+ struct _drmModeAtomicReq **atomic_request_ptr;
+ int render_fd;
+} mpv_opengl_drm_params;
+
+/**
+ * For MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE.
+ */
+typedef struct mpv_opengl_drm_draw_surface_size {
/**
- * DRM fd (int). Set to a negative number if invalid.
+ * size of the draw plane surface in pixels.
+ */
+ int width, height;
+} mpv_opengl_drm_draw_surface_size;
+
+/**
+ * For MPV_RENDER_PARAM_DRM_DISPLAY_V2.
+ */
+typedef struct mpv_opengl_drm_params_v2 {
+ /**
+ * DRM fd (int). Set to -1 if invalid.
*/
int fd;
@@ -177,20 +198,11 @@ typedef struct mpv_opengl_drm_params {
/**
* DRM render node. Used for VAAPI interop.
- * Set to a negative number if invalid.
+ * Set to -1 if invalid.
*/
int render_fd;
-} mpv_opengl_drm_params;
+} mpv_opengl_drm_params_v2;
-/**
- * For MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE.
- */
-typedef struct mpv_opengl_drm_draw_surface_size {
- /**
- * size of the draw plane surface in pixels.
- */
- int width, height;
-} mpv_opengl_drm_draw_surface_size;
/**
* For backwards compatibility with the old naming of mpv_opengl_drm_draw_surface_size