2019-04-21 05:22:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
|
|
|
#include <xf86drm.h>
|
|
|
|
#include <xf86drmMode.h>
|
|
|
|
|
|
|
|
class DrmRenderer : public IFFmpegRenderer {
|
|
|
|
public:
|
|
|
|
DrmRenderer();
|
|
|
|
virtual ~DrmRenderer() override;
|
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
2020-02-09 01:47:26 +00:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
2019-04-21 05:22:37 +00:00
|
|
|
virtual void renderFrame(AVFrame* frame) override;
|
|
|
|
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
2020-02-09 19:35:05 +00:00
|
|
|
virtual int getRendererAttributes() override;
|
2021-01-31 21:19:19 +00:00
|
|
|
virtual bool needsTestFrame() override;
|
|
|
|
virtual bool isDirectRenderingSupported() override;
|
2021-01-30 23:52:23 +00:00
|
|
|
#ifdef HAVE_EGL
|
|
|
|
virtual bool canExportEGL() override;
|
2021-02-05 01:39:18 +00:00
|
|
|
virtual AVPixelFormat getEGLImagePixelFormat() override;
|
2021-01-30 23:52:23 +00:00
|
|
|
virtual bool initializeEGL(EGLDisplay dpy, const EGLExtensions &ext) override;
|
|
|
|
virtual ssize_t exportEGLImages(AVFrame *frame, EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]) override;
|
|
|
|
virtual void freeEGLImages(EGLDisplay dpy, EGLImage[EGL_MAX_PLANES]) override;
|
|
|
|
#endif
|
2019-04-21 05:22:37 +00:00
|
|
|
|
|
|
|
private:
|
2021-01-30 22:33:58 +00:00
|
|
|
AVBufferRef* m_HwContext;
|
2019-04-21 05:22:37 +00:00
|
|
|
int m_DrmFd;
|
2021-01-31 21:03:40 +00:00
|
|
|
bool m_SdlOwnsDrmFd;
|
2021-01-31 21:19:19 +00:00
|
|
|
bool m_SupportsDirectRendering;
|
2019-04-21 05:22:37 +00:00
|
|
|
uint32_t m_CrtcId;
|
|
|
|
uint32_t m_PlaneId;
|
|
|
|
uint32_t m_CurrentFbId;
|
|
|
|
SDL_Rect m_OutputRect;
|
2021-01-31 22:24:31 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_EGL
|
2021-03-22 04:23:12 +00:00
|
|
|
bool m_EGLExtDmaBuf;
|
2021-01-31 22:24:31 +00:00
|
|
|
PFNEGLCREATEIMAGEPROC m_eglCreateImage;
|
|
|
|
PFNEGLDESTROYIMAGEPROC m_eglDestroyImage;
|
|
|
|
PFNEGLCREATEIMAGEKHRPROC m_eglCreateImageKHR;
|
|
|
|
PFNEGLDESTROYIMAGEKHRPROC m_eglDestroyImageKHR;
|
|
|
|
#endif
|
2019-04-21 05:22:37 +00:00
|
|
|
};
|
|
|
|
|