Introduce a new FFMPEG frontend renderer: EGLRenderer

Right now this renderer works on X11 & Wayland with VAAPI as a backend.

Some rendering latency benchmarks on my `i7-10510U` (with
`intel-media-driver` 20.1.1 which cause a *huge* regression with the
SDL_Renderer):
|             | X11    | Wayland |
| Before      | 6.78ms | 22.50ms |
| EGLRenderer | 0.76ms | 00.77ms |

Signed-off-by: Antoine Damhet <antoine.damhet@lse.epita.fr>
This commit is contained in:
Antoine Damhet
2020-04-13 10:40:28 +02:00
parent 2aa18dc88f
commit 0a396f3112
11 changed files with 761 additions and 1 deletions
@@ -9,6 +9,23 @@ extern "C" {
#include <libavcodec/avcodec.h>
}
#ifdef HAVE_EGL
// SDL_egl.h have too many conflicts, we will do without
typedef void *EGLDisplay;
typedef void *EGLImage;
#define EGL_MAX_PLANES 4
class EGLExtensions {
public:
EGLExtensions(EGLDisplay dpy);
~EGLExtensions() {}
bool isSupported(const QString &extension) const;
private:
const QStringList m_Extensions;
};
#endif
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
@@ -68,4 +85,25 @@ public:
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
// Nothing
}
#ifdef HAVE_EGL
// By default we can't do EGL
virtual bool canExportEGL() {
return false;
}
virtual bool initializeEGL(EGLDisplay,
const EGLExtensions &) {
return false;
}
virtual ssize_t exportEGLImages(AVFrame *,
EGLDisplay,
EGLImage[EGL_MAX_PLANES]) {
return -1;
}
// Free the ressources allocated during the last `exportEGLImages` call
virtual void freeEGLImages(EGLDisplay, EGLImage[EGL_MAX_PLANES]) {}
#endif
};