Simplify EGLImageFactory and remove caching logic for now

The platforms that would most benefit (embedded V4L2 decoders)
either don't use frame pooling or don't synchronize with
modified DMA-BUFs unless eglCreateImage() is called each time.
This commit is contained in:
Cameron Gutman
2025-12-28 17:54:31 -06:00
parent 085480e9f4
commit 3e5aa9b127
8 changed files with 29 additions and 98 deletions
@@ -2,12 +2,12 @@
#include "renderer.h"
#include <unordered_map>
#ifdef HAVE_LIBVA
#include <va/va_drmcommon.h>
#endif
#include <optional>
class EglImageFactory
{
class EglImageContext {
@@ -64,19 +64,14 @@ public:
ssize_t exportVAImages(AVFrame* frame, uint32_t exportFlags, EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]);
#endif
void freeEGLImages();
bool supportsImportingFormat(EGLDisplay dpy, EGLint format);
bool supportsImportingModifier(EGLDisplay dpy, EGLint format, EGLuint64KHR modifier);
void freeEGLImages(EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]);
private:
ssize_t queryImageCache(AVFrame* frame, EGLImage images[EGL_MAX_PLANES]);
void populateImageCache(AVFrame* frame, EglImageContext &&imgCtx);
private:
IFFmpegRenderer* m_Renderer;
bool m_CacheDisabled;
std::unordered_map<AVBuffer*, EglImageContext> m_CachedImages;
std::optional<EglImageContext> m_LastImageCtx;
bool m_EGLExtDmaBuf;
PFNEGLCREATEIMAGEPROC m_eglCreateImage;
PFNEGLDESTROYIMAGEPROC m_eglDestroyImage;