This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM5728:使用 EGLImage 下载纹理

Guru**** 2601915 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/649850/am5728-texture-downloading-with-eglimage

器件型号:AM5728

您好!

我想将现有 OpenGL 纹理下载到具有零复制性能的用户空间(gstreamer)中。 我正在尝试遵循 Anand 在(https://e2e.ti.com/support/embedded/linux/f/354/p/563420/2066253#2066253)上概述的步骤

1.将 DMABUF 导入为 GBM BO

2.利用它创建像素图表面

3.根据像素图创建 EGL 图像


除了在(e2e.ti.com/.../606575 通过这些步骤、我可以创建 EGLImage 并将其连接到我的 OpenGL 纹理、如代码片段中所示。 我正在使用 OMAP-BO_MAP 获取一个空指针、我可以读取该指针并将其传递到 gstreamer 中。 我发现这个偏移量为(480*800*4=1536000)的指针对应于一些模糊的颜色数据、我认为这些数据来自我的纹理。  这是从 GPU 向用户空间下载纹理的正确方法吗? 为什么我从 OMAP-BO_MAP 读取的数据全部跳转、如所附图像中所示?

我还认为、在该应用中、dmabuf 架构可能很方便。 如果 EGLImage 包含有效的纹理数据、如何使用 dmabuf 框架将其共享给 gstreamer? 如果任何人都有关于如何使用 dmabuf 共享(下载) OpenGL 纹理的说明或资源、我们将不胜感激。

内部宽度= 800;
内部高度= 480;
int DRI_FD =打开("/dev/dri/card0、O_RDWR | O_CLOEXEC);

struct GBM_device *gbmDev = GBM_CREASE_DEVICE (DRI_FD);
struct omap_device* omapDev = omap_device_new (dri_fd);
struct omapDev, Width * Height * 4,3 );

静态 void* omap_bo_map_stat = omap_bo_map (lpOmapBo);

struct GBM_import_FD_DATA GbmImportData;
GbmImportData.fd = omap_bo_dmabuf( lpOmapBo );

GbmImportData.width =宽度;
GbmImportData.Height =高度;
GbmImportData.STRIDE =宽度* 4;
GbmImportData.format = GBM_BO_FORMAT_ARGB8888;

静态 GbmBo* lpBo_stat = GBM_BO_IMPORT (gbmDev_stat、GBM_BO_IMPORT_FD、&GbmImportData、
GBM_BO_USE_SCANOUT );

QEGLNativeContext qEglContext = qvariant_cast (m_context->nativeHandle();

const EGLint attrib_list[]={
EGL_IMAGE_Preserved_KHR、true、
EGL_NONE
};

PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR = reinterpret_cast (eglGetProcAddress("eglCreateImageKHR");

EGLImageKHR eglImageHandle_stat = eglCreateImageKHR (qEglContext.display ()、EGL_NO_Context、EGL_NATE_PIXMAP_KHR、lpBO_stat、attrib_list);

if (eglImageHandle_stat =EGL_NO_IMAGE_KHR)
{
qDebug ("eglImageHandle == EGL_NO_IMAGE_KHR");
fprintf (stderr、"[ERR]无法创建 eglImage:0x%04x\n"、eglGetError();
}
其他
{
fprintf (stderr、"eglImage created!");
}

glBindTexture (gL_tecture_external_OES、m_FBO->tecture ());
GlTextParameteri (GL_turete_external_OES、GL_turete_min_filter、GL_linear_linear);
GlTextParameteri (GL_turete_external_OES、GL_turete_mag_filter、GL_linear);

PFNGLEGLIMAGETTRGETTEXURE2DOESPROC glEGLImageTargetText2DOES = reinterpret_cast (eglGetProcAddress("glEGLImageTargetTexture2DOES");
glEGLImageTargetTexture2DOES (GL_T纹 理_EXTERNAL_OES、eglImageHandle_stat); 

下面是我接收的帧类型的示例。 您可以看到我的纹理中有一些有效的部分显示(中间的字母)。 GStreamer 将缓冲区视为 ABGR。

谢谢、

Vishal