From cfcee4cfe70536faeb9f2aaa87257d067e902b70 Mon Sep 17 00:00:00 2001 From: Lionel CHAZALLON Date: Mon, 23 Oct 2017 08:51:49 -0700 Subject: Add DRM_PRIME Format Handling and Display for RockChip MPP decoders This commit allows to use the AV_PIX_FMT_DRM_PRIME newly introduced format in ffmpeg that allows decoders to provide an AVDRMFrameDescriptor struct. That struct holds dmabuf fds and information allowing zerocopy rendering using KMS / DRM Atomic. This has been tested on RockChip ROCK64 device. --- libmpv/opengl_cb.h | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'libmpv/opengl_cb.h') diff --git a/libmpv/opengl_cb.h b/libmpv/opengl_cb.h index 799e353a41..1434c6cee3 100644 --- a/libmpv/opengl_cb.h +++ b/libmpv/opengl_cb.h @@ -151,6 +151,24 @@ extern "C" { * up until mpv_opengl_cb_uninit_gl() is called. If the name is not anything * you know/expected, return NULL from the function. * + * * Windowing system scaling + * ------------------------------------ + * + * When using GL, sometimes GL rendering window is upscaled to display buffer. + * Typically with drm where GL framebuffer can be upscaled at later stage. + * In That case glMPGetNativeDisplay("opengl-cb-window-pos") should return an + * mpv_opengl_cb_window_pos struct pointer defined below. + * Note : The intended use is for hardware overlays that might require + * upscaling features (typically upscaling GL windows with drm to screen size). + */ +struct mpv_opengl_cb_window_pos { + int x; // left coordinates of window (usually 0) + int y; // top coordinates of window (usually 0) + int width; // width of GL window + int height; // height of GL window +}; + +/** * Windowing system interop on Intel/Linux with VAAPI * -------------------------------------------------- * @@ -163,10 +181,22 @@ extern "C" { * * glMPGetNativeDisplay("wl") should return a Wayland "struct wl_display *". * - * glMPGetNativeDisplay("drm") should return a DRM FD casted to intptr_t (note - * that a 0 FD is not supported - if this can happen in your case, you must - * dup2() it to a non-0 FD). - * + * glMPGetNativeDisplay("opengl-cb-drm-params") should return an + * mpv_opengl_cb_drm_params structure pointer : + */ +struct mpv_opengl_cb_drm_params { + // DRM fd (int). set this to -1 if invalid. + int fd; + + // currently used crtc id + int crtc_id; + + // pointer to the drmModeAtomicReq that is being used for the renderloop. + // This atomic request pointer should be usually created at every renderloop. + struct _drmModeAtomicReq *atomic_request; +}; + +/** * nVidia/Linux via VDPAU requires GLX, which does not have this problem (the * GLX API can return the current X11 Display). * -- cgit v1.2.3