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