From e08f235578aa6305a41e7c7132225e58bd191ef0 Mon Sep 17 00:00:00 2001 From: Anton Kindestam Date: Thu, 12 Sep 2019 21:00:50 +0200 Subject: 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 --- libmpv/render_gl.h | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'libmpv/render_gl.h') 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 -- cgit v1.2.3