MythTV  master
mythegldmabuf.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "fourcc.h"
4 #include "mythavutil.h"
6 #include "opengl/mythegldmabuf.h"
7 #include "opengl/mythegldefs.h"
8 
9 // FFmpeg
10 extern "C" {
11 #include "libavutil/hwcontext_drm.h"
12 }
13 
14 #define LOC QString("EGLDMABUF: ")
15 
17 {
18  if (Context)
19  {
20  OpenGLLocker locker(Context);
21  m_useModifiers = Context->IsEGL() && Context->HasEGLExtension("EGL_EXT_image_dma_buf_import_modifiers");
22  }
23 }
24 
26 {
27  if (!Context)
28  return false;
29  OpenGLLocker locker(Context);
30  return (Context->IsEGL() && Context->hasExtension("GL_OES_EGL_image") &&
31  Context->HasEGLExtension("EGL_EXT_image_dma_buf_import"));
32 }
33 
34 static void inline DebugDRMFrame(AVDRMFrameDescriptor* Desc)
35 {
36  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("DRM frame: Layers %1 Objects %2")
37  .arg(Desc->nb_layers).arg(Desc->nb_objects));
38  for (int i = 0; i < Desc->nb_layers; ++i)
39  {
40  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Layer %1: Format %2 Planes %3")
41  .arg(i).arg(fourcc_str(static_cast<int>(Desc->layers[i].format)))
42  .arg(Desc->layers[i].nb_planes));
43  for (int j = 0; j < Desc->layers[i].nb_planes; ++j)
44  {
45  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString(" Plane %1: Index %2 Offset %3 Pitch %4")
46  .arg(j).arg(Desc->layers[i].planes[j].object_index)
47  .arg(Desc->layers[i].planes[j].offset).arg(Desc->layers[i].planes[j].pitch));
48  }
49  }
50  for (int i = 0; i < Desc->nb_objects; ++i)
51  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Object: %1 FD %2 Mods 0x%3")
52  .arg(i).arg(Desc->objects[i].fd).arg(Desc->objects[i].format_modifier, 0 , 16));
53 }
54 
60 inline std::vector<MythVideoTextureOpenGL*> MythEGLDMABUF::CreateComposed(AVDRMFrameDescriptor* Desc,
61  MythRenderOpenGL *Context,
62  MythVideoFrame *Frame, FrameScanType Scan) const
63 {
64  Frame->m_alreadyDeinterlaced = true;
65  std::vector<MythVideoTextureOpenGL*> result;
66  for (int i = 0; i < (Scan == kScan_Progressive ? 1 : 2); ++i)
67  {
68  std::vector<QSize> sizes;
69  int frameheight = Scan == kScan_Progressive ? Frame->m_height : Frame->m_height >> 1;
70  sizes.emplace_back(QSize(Frame->m_width, frameheight));
71  std::vector<MythVideoTextureOpenGL*> textures =
74  if (textures.empty())
75  {
76  ClearDMATextures(Context, result);
77  return result;
78  }
79 
80  textures[0]->m_allowGLSLDeint = false;
81 
82  EGLint colourspace = EGL_ITU_REC709_EXT;
83  switch (Frame->m_colorspace)
84  {
85  case AVCOL_SPC_BT470BG:
86  case AVCOL_SPC_SMPTE170M:
87  case AVCOL_SPC_SMPTE240M:
88  colourspace = EGL_ITU_REC601_EXT;
89  break;
90  case AVCOL_SPC_BT2020_CL:
91  case AVCOL_SPC_BT2020_NCL:
92  colourspace = EGL_ITU_REC2020_EXT;
93  break;
94  default:
95  if (Frame->m_width < 1280)
96  colourspace = EGL_ITU_REC601_EXT;
97  break;
98  }
99 
100  static constexpr std::array<EGLint,4> kPlaneFd
103  static constexpr std::array<EGLint,4> kPlaneOffset
106  static constexpr std::array<EGLint,4> kPlanePitch
109  static constexpr std::array<EGLint,4> kPlaneModlo
112  static constexpr std::array<EGLint,4> kPlaneModhi
115 
116  AVDRMLayerDescriptor* layer = &Desc->layers[0];
117 
118  QVector<EGLint> attribs = {
119  EGL_LINUX_DRM_FOURCC_EXT, static_cast<EGLint>(layer->format),
120  EGL_WIDTH, Frame->m_width,
121  EGL_HEIGHT, frameheight,
122  EGL_YUV_COLOR_SPACE_HINT_EXT, colourspace,
126  };
127 
128  for (int plane = 0; plane < layer->nb_planes; ++plane)
129  {
130  AVDRMPlaneDescriptor* drmplane = &layer->planes[plane];
131  ptrdiff_t pitch = drmplane->pitch;
132  ptrdiff_t offset = drmplane->offset;
133  if (Scan != kScan_Progressive)
134  {
135  if (i > 0)
136  offset += pitch;
137  pitch = pitch << 1;
138  }
139  attribs << kPlaneFd[plane] << Desc->objects[drmplane->object_index].fd
140  << kPlaneOffset[plane] << static_cast<EGLint>(offset)
141  << kPlanePitch[plane] << static_cast<EGLint>(pitch);
142  if (m_useModifiers && (Desc->objects[drmplane->object_index].format_modifier != 0 /* DRM_FORMAT_MOD_NONE*/))
143  {
144  attribs << kPlaneModlo[plane]
145  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier & 0xffffffff)
146  << kPlaneModhi[plane]
147  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier >> 32);
148  }
149  }
150  attribs << EGL_NONE;
151 
152  EGLImageKHR image = Context->eglCreateImageKHR(Context->GetEGLDisplay(), EGL_NO_CONTEXT,
153  EGL_LINUX_DMA_BUF_EXT, nullptr, attribs.data());
154  if (!image)
155  {
156  LOG(VB_GENERAL, LOG_ERR, LOC + QString("No EGLImage '%1'").arg(Context->GetEGLError()));
157  // Ensure we release anything already created and return nothing
158  ClearDMATextures(Context, result);
159  return result;
160  }
161 
162  MythVideoTextureOpenGL *texture = textures[0];
163  Context->glBindTexture(texture->m_target, texture->m_textureId);
164  Context->eglImageTargetTexture2DOES(texture->m_target, image);
165  Context->glBindTexture(texture->m_target, 0);
166  texture->m_data = static_cast<unsigned char *>(image);
167  result.push_back(texture);
168  }
169 
170  return result;
171 }
172 
177 inline std::vector<MythVideoTextureOpenGL*> MythEGLDMABUF::CreateSeparate(AVDRMFrameDescriptor* Desc,
178  MythRenderOpenGL *Context,
179  MythVideoFrame *Frame) const
180 {
181  // N.B. this works for YV12/NV12/P010 etc but will probably break for YUV422 etc
182  std::vector<QSize> sizes;
183  for (int plane = 0 ; plane < Desc->nb_layers; ++plane)
184  {
185  int width = Frame->m_width >> ((plane > 0) ? 1 : 0);
186  int height = Frame->m_height >> ((plane > 0) ? 1 : 0);
187  sizes.emplace_back(QSize(width, height));
188  }
189 
190  VideoFrameType format = MythAVUtil::PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->m_swPixFmt));
191  std::vector<MythVideoTextureOpenGL*> result =
192  MythVideoTextureOpenGL::CreateTextures(Context, Frame->m_type, format, sizes,
193  QOpenGLTexture::Target2D);
194  if (result.empty())
195  return result;
196 
197  for (uint plane = 0; plane < result.size(); ++plane)
198  {
199  result[plane]->m_allowGLSLDeint = true;
200  AVDRMLayerDescriptor* layer = &Desc->layers[plane];
201  AVDRMPlaneDescriptor* drmplane = &layer->planes[0];
202  QVector<EGLint> attribs = {
203  EGL_LINUX_DRM_FOURCC_EXT, static_cast<EGLint>(layer->format),
204  EGL_WIDTH, result[plane]->m_size.width(),
205  EGL_HEIGHT, result[plane]->m_size.height(),
206  EGL_DMA_BUF_PLANE0_FD_EXT, Desc->objects[drmplane->object_index].fd,
207  EGL_DMA_BUF_PLANE0_OFFSET_EXT, static_cast<EGLint>(drmplane->offset),
208  EGL_DMA_BUF_PLANE0_PITCH_EXT, static_cast<EGLint>(drmplane->pitch)
209  };
210 
211  if (m_useModifiers && (Desc->objects[drmplane->object_index].format_modifier != 0 /* DRM_FORMAT_MOD_NONE*/))
212  {
214  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier & 0xffffffff)
216  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier >> 32);
217  }
218 
219  attribs << EGL_NONE;
220 
221  EGLImageKHR image = Context->eglCreateImageKHR(Context->GetEGLDisplay(), EGL_NO_CONTEXT,
222  EGL_LINUX_DMA_BUF_EXT, nullptr, attribs.data());
223  if (!image)
224  {
225  LOG(VB_GENERAL, LOG_ERR, LOC + QString("No EGLImage for plane %1 %2")
226  .arg(plane).arg(Context->GetEGLError()));
227  ClearDMATextures(Context, result);
228  return result;
229  }
230 
231  Context->glBindTexture(result[plane]->m_target, result[plane]->m_textureId);
232  Context->eglImageTargetTexture2DOES(result[plane]->m_target, image);
233  Context->glBindTexture(result[plane]->m_target, 0);
234  result[plane]->m_data = static_cast<unsigned char *>(image);
235  }
236 
237  return result;
238 }
239 
240 #ifndef DRM_FORMAT_R8
241 #define MKTAG2(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | (static_cast<unsigned>(d) << 24))
242 #define DRM_FORMAT_R8 MKTAG2('R', '8', ' ', ' ')
243 #define DRM_FORMAT_GR88 MKTAG2('G', 'R', '8', '8')
244 #define DRM_FORMAT_R16 MKTAG2('R', '1', '6', ' ')
245 #define DRM_FORMAT_GR32 MKTAG2('G', 'R', '3', '2')
246 #define DRM_FORMAT_NV12 MKTAG2('N', 'V', '1', '2')
247 #define DRM_FORMAT_NV21 MKTAG2('N', 'V', '2', '1')
248 #define DRM_FORMAT_YUV420 MKTAG2('Y', 'U', '1', '2')
249 #define DRM_FORMAT_YVU420 MKTAG2('Y', 'V', '1', '2')
250 #define DRM_FORMAT_P010 MKTAG2('P', '0', '1', '0')
251 #endif
252 
267 inline std::vector<MythVideoTextureOpenGL*> MythEGLDMABUF::CreateSeparate2(AVDRMFrameDescriptor* Desc,
268  MythRenderOpenGL *Context,
269  MythVideoFrame *Frame) const
270 {
271  // As for CreateSeparate - may not work for some formats
272  AVDRMLayerDescriptor* layer = &Desc->layers[0];
273  std::vector<QSize> sizes;
274  for (int plane = 0 ; plane < layer->nb_planes; ++plane)
275  {
276  int width = Frame->m_width >> ((plane > 0) ? 1 : 0);
277  int height = Frame->m_height >> ((plane > 0) ? 1 : 0);
278  sizes.emplace_back(QSize(width, height));
279  }
280 
281  // TODO - the v4l2_m2m decoder is not setting the correct sw_fmt - so we
282  // need to deduce the frame format from the fourcc
283  VideoFrameType format = FMT_YV12;
284  EGLint fourcc1 = DRM_FORMAT_R8;
285  EGLint fourcc2 = DRM_FORMAT_R8;
286  if (layer->format == DRM_FORMAT_NV12 || layer->format == DRM_FORMAT_NV21)
287  {
288  format = FMT_NV12;
289  fourcc2 = DRM_FORMAT_GR88;
290  }
291  else if (layer->format == DRM_FORMAT_P010)
292  {
293  format = FMT_P010;
294  fourcc1 = DRM_FORMAT_R16;
295  fourcc2 = DRM_FORMAT_GR32;
296  }
297 
298  std::vector<MythVideoTextureOpenGL*> result =
299  MythVideoTextureOpenGL::CreateTextures(Context, Frame->m_type, format, sizes,
300  QOpenGLTexture::Target2D);
301  if (result.empty())
302  return result;
303 
304  for (uint plane = 0; plane < result.size(); ++plane)
305  {
306  result[plane]->m_allowGLSLDeint = true;
307  EGLint fourcc = fourcc1;
308  if (plane > 0)
309  fourcc = fourcc2;
310  AVDRMPlaneDescriptor* drmplane = &layer->planes[plane];
311  QVector<EGLint> attribs = {
312  EGL_LINUX_DRM_FOURCC_EXT, fourcc,
313  EGL_WIDTH, result[plane]->m_size.width(),
314  EGL_HEIGHT, result[plane]->m_size.height(),
315  EGL_DMA_BUF_PLANE0_FD_EXT, Desc->objects[drmplane->object_index].fd,
316  EGL_DMA_BUF_PLANE0_OFFSET_EXT, static_cast<EGLint>(drmplane->offset),
317  EGL_DMA_BUF_PLANE0_PITCH_EXT, static_cast<EGLint>(drmplane->pitch)
318  };
319 
320  if (m_useModifiers && (Desc->objects[drmplane->object_index].format_modifier != 0 /* DRM_FORMAT_MOD_NONE*/))
321  {
323  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier & 0xffffffff)
325  << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier >> 32);
326  }
327 
328  attribs << EGL_NONE;
329 
330  EGLImageKHR image = Context->eglCreateImageKHR(Context->GetEGLDisplay(), EGL_NO_CONTEXT,
331  EGL_LINUX_DMA_BUF_EXT, nullptr, attribs.data());
332  if (!image)
333  {
334  LOG(VB_GENERAL, LOG_ERR, LOC + QString("No EGLImage for plane %1 %2")
335  .arg(plane).arg(Context->GetEGLError()));
336  ClearDMATextures(Context, result);
337  return result;
338  }
339 
340  Context->glBindTexture(result[plane]->m_target, result[plane]->m_textureId);
341  Context->eglImageTargetTexture2DOES(result[plane]->m_target, image);
342  Context->glBindTexture(result[plane]->m_target, 0);
343  result[plane]->m_data = static_cast<unsigned char *>(image);
344  }
345 
346  return result;
347 }
348 
350  std::vector<MythVideoTextureOpenGL *> &Textures)
351 {
352  for (auto & texture : Textures)
353  {
354  if (texture->m_data)
355  Context->eglDestroyImageKHR(Context->GetEGLDisplay(), texture->m_data);
356  texture->m_data = nullptr;
357  if (texture->m_textureId)
358  Context->glDeleteTextures(1, &texture->m_textureId);
359  MythVideoTextureOpenGL::DeleteTexture(Context, texture);
360  }
361  Textures.clear();
362 }
363 
364 std::vector<MythVideoTextureOpenGL*> MythEGLDMABUF::CreateTextures(AVDRMFrameDescriptor* Desc,
365  MythRenderOpenGL *Context,
367  bool UseSeparate,
368  FrameScanType Scan)
369 {
370  std::vector<MythVideoTextureOpenGL*> result;
371  if (!Desc || !Context || !Frame)
372  return result;
373 
374  if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_DEBUG))
375  DebugDRMFrame(Desc);
376 
377  uint numlayers = static_cast<uint>(Desc->nb_layers);
378  if (numlayers < 1)
379  return result;
380 
381  OpenGLLocker locker(Context);
382 
383  // N.B. If the descriptor has a single layer (RGB, packed YUV), it shouldn't
384  // matter which path is taken here - the resulting calls are identical (with the
385  // exception of the colourspace hints for composed - which should be ignored per the spec for RGB).
386  // This MAY breakdown however for packed YUV formats when the frame format
387  // is not set correctly and/or the 'returned' format does not match
388  // our expectations.
389 
390  // For multiplanar formats (ie. YUV), this essentially assumes the implementation
391  // will supply a descriptor that matches the expectation of the
392  // EGL_EXT_image_dma_buf_import implementation (i.e. if it can cope with
393  // separate layers, it will supply a suitable descriptor).
394 
395  // One layer with X planes
396  if (numlayers == 1)
397  {
398  if (UseSeparate)
399  return CreateSeparate2(Desc, Context, Frame);
400  return CreateComposed(Desc, Context, Frame, Scan);
401  }
402  // X layers with one plane each
403  return CreateSeparate(Desc, Context, Frame);
404 }
EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT
#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT
Definition: mythegldefs.h:59
EGL_DMA_BUF_PLANE2_FD_EXT
#define EGL_DMA_BUF_PLANE2_FD_EXT
Definition: mythegldefs.h:31
EGL_DMA_BUF_PLANE1_OFFSET_EXT
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT
Definition: mythegldefs.h:29
MythEGLDMABUF::m_useModifiers
bool m_useModifiers
Definition: mythegldmabuf.h:40
EGL_DMA_BUF_PLANE0_FD_EXT
#define EGL_DMA_BUF_PLANE0_FD_EXT
Definition: mythegldefs.h:25
EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT
#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT
Definition: mythegldefs.h:58
EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT
Definition: mythegldefs.h:36
MythVideoTextureOpenGL
Definition: mythvideotextureopengl.h:21
EGL_ITU_REC601_EXT
#define EGL_ITU_REC601_EXT
Definition: mythegldefs.h:38
DRM_FORMAT_P010
#define DRM_FORMAT_P010
Definition: mythegldmabuf.cpp:250
MythEGL::GetEGLDisplay
void * GetEGLDisplay(void)
Definition: mythegl.cpp:80
EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT
#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT
Definition: mythegldefs.h:55
Frame
Definition: zmdefines.h:93
FMT_P010
@ FMT_P010
Definition: mythframe.h:52
MythGLTexture::m_data
unsigned char * m_data
Definition: mythrenderopengl.h:63
EGL_DMA_BUF_PLANE2_OFFSET_EXT
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT
Definition: mythegldefs.h:32
arg
arg(title).arg(filename).arg(doDelete))
DRM_FORMAT_R16
#define DRM_FORMAT_R16
Definition: mythegldmabuf.cpp:244
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
MythEGL::eglImageTargetTexture2DOES
void eglImageTargetTexture2DOES(GLenum Target, void *Image)
Definition: mythegl.cpp:146
EGL_DMA_BUF_PLANE0_PITCH_EXT
#define EGL_DMA_BUF_PLANE0_PITCH_EXT
Definition: mythegldefs.h:27
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT
#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT
Definition: mythegldefs.h:52
mythvideotextureopengl.h
EGL_ITU_REC709_EXT
#define EGL_ITU_REC709_EXT
Definition: mythegldefs.h:39
MythEGLDMABUF::HaveDMABuf
static bool HaveDMABuf(MythRenderOpenGL *Context)
Definition: mythegldmabuf.cpp:25
MythEGL::eglDestroyImageKHR
void eglDestroyImageKHR(void *Disp, void *Image)
Definition: mythegl.cpp:160
EGL_YUV_COLOR_SPACE_HINT_EXT
#define EGL_YUV_COLOR_SPACE_HINT_EXT
Definition: mythegldefs.h:34
EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT
#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT
Definition: mythegldefs.h:56
mythegldmabuf.h
EGL_LINUX_DRM_FOURCC_EXT
#define EGL_LINUX_DRM_FOURCC_EXT
Definition: mythegldefs.h:24
GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_EXTERNAL_OES
Definition: mythrenderopengldefs.h:13
EGL_YUV_NARROW_RANGE_EXT
#define EGL_YUV_NARROW_RANGE_EXT
Definition: mythegldefs.h:42
mythrenderopengl.h
MythEGLDMABUF::CreateTextures
std::vector< MythVideoTextureOpenGL * > CreateTextures(AVDRMFrameDescriptor *Desc, MythRenderOpenGL *Context, MythVideoFrame *Frame, bool UseSeparate, FrameScanType Scan=kScan_Progressive)
Definition: mythegldmabuf.cpp:364
EGL_YUV_FULL_RANGE_EXT
#define EGL_YUV_FULL_RANGE_EXT
Definition: mythegldefs.h:41
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
EGL_SAMPLE_RANGE_HINT_EXT
#define EGL_SAMPLE_RANGE_HINT_EXT
Definition: mythegldefs.h:35
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:22
EGL_ITU_REC2020_EXT
#define EGL_ITU_REC2020_EXT
Definition: mythegldefs.h:40
MythEGLDMABUF::CreateSeparate
std::vector< MythVideoTextureOpenGL * > CreateSeparate(AVDRMFrameDescriptor *Desc, MythRenderOpenGL *Context, MythVideoFrame *Frame) const
Create multiple textures that represent the planes for the given AVDRMFrameDescriptor.
Definition: mythegldmabuf.cpp:177
MythEGL::GetEGLError
static qint32 GetEGLError(void)
Definition: mythegl.cpp:137
DRM_FORMAT_R8
#define DRM_FORMAT_R8
Definition: mythegldmabuf.cpp:242
EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT
#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT
Definition: mythegldefs.h:53
EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT
Definition: mythegldefs.h:37
DRM_FORMAT_GR88
#define DRM_FORMAT_GR88
Definition: mythegldmabuf.cpp:243
EGL_DMA_BUF_PLANE3_PITCH_EXT
#define EGL_DMA_BUF_PLANE3_PITCH_EXT
Definition: mythegldefs.h:51
MythEGL::IsEGL
bool IsEGL(void)
Definition: mythegl.cpp:29
MythVideoTextureOpenGL::DeleteTexture
static void DeleteTexture(MythRenderOpenGL *Context, MythVideoTextureOpenGL *Texture)
Definition: mythvideotextureopengl.cpp:17
uint
unsigned int uint
Definition: compat.h:141
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:70
MythGLTexture::m_target
GLenum m_target
Definition: mythrenderopengl.h:77
mythegldefs.h
MythRenderOpenGL
Definition: mythrenderopengl.h:96
VERBOSE_LEVEL_CHECK
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
Definition: mythlogging.h:14
MythEGLDMABUF::MythEGLDMABUF
MythEGLDMABUF(MythRenderOpenGL *Context)
Definition: mythegldmabuf.cpp:16
MythEGL::eglCreateImageKHR
void * eglCreateImageKHR(void *Disp, void *Context, unsigned int Target, void *Buffer, const int32_t *Attributes)
Definition: mythegl.cpp:152
MythGLTexture::m_textureId
GLuint m_textureId
Definition: mythrenderopengl.h:65
LOC
#define LOC
Definition: mythegldmabuf.cpp:14
DRM_FORMAT_GR32
#define DRM_FORMAT_GR32
Definition: mythegldmabuf.cpp:245
EGL_DMA_BUF_PLANE3_FD_EXT
#define EGL_DMA_BUF_PLANE3_FD_EXT
Definition: mythegldefs.h:49
MythEGLDMABUF::ClearDMATextures
static void ClearDMATextures(MythRenderOpenGL *Context, std::vector< MythVideoTextureOpenGL * > &Textures)
Definition: mythegldmabuf.cpp:349
mythavutil.h
EGL_DMA_BUF_PLANE0_OFFSET_EXT
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT
Definition: mythegldefs.h:26
EGL_DMA_BUF_PLANE3_OFFSET_EXT
#define EGL_DMA_BUF_PLANE3_OFFSET_EXT
Definition: mythegldefs.h:50
EGL_DMA_BUF_PLANE1_FD_EXT
#define EGL_DMA_BUF_PLANE1_FD_EXT
Definition: mythegldefs.h:28
DRM_FORMAT_NV12
#define DRM_FORMAT_NV12
Definition: mythegldmabuf.cpp:246
fourcc_str
static const char * fourcc_str(int i)
Definition: fourcc.h:26
MythEGLDMABUF::CreateComposed
std::vector< MythVideoTextureOpenGL * > CreateComposed(AVDRMFrameDescriptor *Desc, MythRenderOpenGL *Context, MythVideoFrame *Frame, FrameScanType Scan) const
Create a single RGBA32 texture using the provided AVDRMFramDescriptor.
Definition: mythegldmabuf.cpp:60
MythEGLDMABUF::CreateSeparate2
std::vector< MythVideoTextureOpenGL * > CreateSeparate2(AVDRMFrameDescriptor *Desc, MythRenderOpenGL *Context, MythVideoFrame *Frame) const
Create multiple textures that represent the planes for the given AVDRMFrameDescriptor.
Definition: mythegldmabuf.cpp:267
DRM_FORMAT_NV21
#define DRM_FORMAT_NV21
Definition: mythegldmabuf.cpp:247
EGL_DMA_BUF_PLANE1_PITCH_EXT
#define EGL_DMA_BUF_PLANE1_PITCH_EXT
Definition: mythegldefs.h:30
VideoFrameType
VideoFrameType
Definition: mythframe.h:18
MythVideoFrame
Definition: mythframe.h:85
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:51
EGL_YUV_CHROMA_SITING_0_EXT
#define EGL_YUV_CHROMA_SITING_0_EXT
Definition: mythegldefs.h:43
EGL_DMA_BUF_PLANE2_PITCH_EXT
#define EGL_DMA_BUF_PLANE2_PITCH_EXT
Definition: mythegldefs.h:33
EGL_LINUX_DMA_BUF_EXT
#define EGL_LINUX_DMA_BUF_EXT
Definition: mythegldefs.h:23
MythEGL::HasEGLExtension
bool HasEGLExtension(QString Extension)
Definition: mythegl.cpp:65
EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT
#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT
Definition: mythegldefs.h:54
MythVideoTextureOpenGL::CreateTextures
static std::vector< MythVideoTextureOpenGL * > CreateTextures(MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, std::vector< QSize > Sizes, GLenum Target=QOpenGLTexture::Target2D)
Create a set of textures suitable for the given Type and Format.
Definition: mythvideotextureopengl.cpp:57
EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT
#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT
Definition: mythegldefs.h:57
DebugDRMFrame
static void DebugDRMFrame(AVDRMFrameDescriptor *Desc)
Definition: mythegldmabuf.cpp:34
fourcc.h
FMT_RGBA32
@ FMT_RGBA32
Definition: mythframe.h:33
OpenGLLocker
Definition: mythrenderopengl.h:252