summaryrefslogtreecommitdiffstats
path: root/src/core/delegated_frame_node.cpp
diff options
context:
space:
mode:
authorMansoor Chishtie <mchishtie@blackberry.com>2014-05-27 19:35:12 -0500
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-02 20:49:50 +0200
commit5e5a99fa374d4b83e548ada8c76fa191a27e4b51 (patch)
tree9ed2144ddc001fbbb7ca1964772b78bae015a61e /src/core/delegated_frame_node.cpp
parent65bf1a1334acce38983896241d3b211e1fa4659a (diff)
Support EGLStream video streaming on QNX platform
On QNX platform, we implement video streaming via OpenGL EGLStream streams. Changes were added to StreamVideo class to support EGLStream objects. For non-QNX platforms, we kept the StreamVideoNode class unchanged - assuming other platforms will continue to support streaming via EGLImage objects. On QNX, cc::StreamVideoDrawQuad contains an external OES texture that is associated with an EGLStream. Before we draw with that texture, an 'acquire' is performed to grab latest video frame. See EGL_KHR_stream specs from Khronos. Change-Id: Ia3fe25e9047f475594a55591e3e11caa0eab1e6a Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/delegated_frame_node.cpp')
-rw-r--r--src/core/delegated_frame_node.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index fd073ad3a..09cc540b7 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -138,6 +138,9 @@ private:
bool m_hasAlpha;
GLenum m_target;
int m_importCount;
+#ifdef Q_OS_QNX
+ EGLStreamData m_eglStreamData;
+#endif
};
static inline QSharedPointer<RenderPassTexture> findRenderPassTexture(const cc::RenderPass::Id &id, const QList<QSharedPointer<RenderPassTexture> > &list)
@@ -343,6 +346,20 @@ MailboxTexture::MailboxTexture(const cc::TransferableResource &resource)
void MailboxTexture::bind()
{
glBindTexture(m_target, m_textureId);
+#ifdef Q_OS_QNX
+ if (m_target == GL_TEXTURE_EXTERNAL_OES) {
+ static bool resolved = false;
+ static PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquire = 0;
+
+ if (!resolved) {
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ eglStreamConsumerAcquire = (PFNEGLSTREAMCONSUMERACQUIREKHRPROC)context->getProcAddress("eglStreamConsumerAcquireKHR");
+ resolved = true;
+ }
+ if (eglStreamConsumerAcquire)
+ eglStreamConsumerAcquire(m_eglStreamData.egl_display, m_eglStreamData.egl_str_handle);
+ }
+#endif
}
void MailboxTexture::setTarget(GLenum target)
@@ -371,8 +388,14 @@ void MailboxTexture::fetchTexture(gpu::gles2::MailboxManager *mailboxManager)
gpu::gles2::Texture *tex = ConsumeTexture(mailboxManager, m_target, *reinterpret_cast<const gpu::gles2::MailboxName*>(m_resource.mailbox.name));
// The texture might already have been deleted (e.g. when navigating away from a page).
- if (tex)
+ if (tex) {
m_textureId = service_id(tex);
+#ifdef Q_OS_QNX
+ if (m_target == GL_TEXTURE_EXTERNAL_OES) {
+ m_eglStreamData = eglstream_connect_consumer(tex);
+ }
+#endif
+ }
}
DelegatedFrameNode::DelegatedFrameNode(QSGRenderContext *sgRenderContext)
@@ -595,6 +618,7 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
StreamVideoNode *svideoNode = new StreamVideoNode(texture.data());
svideoNode->setRect(toQt(squad->rect));
+ svideoNode->setTextureMatrix(toQt(squad->matrix.matrix()));
currentLayerChain->appendChildNode(svideoNode);
break;
#endif