mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
eglglessink: Fix render_and_display logic
Switch procedure according to enabled rendering path
This commit is contained in:
parent
ada5a83eb4
commit
3fce24549f
1 changed files with 95 additions and 92 deletions
|
@ -1187,6 +1187,12 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
||||||
GstBuffer * buf)
|
GstBuffer * buf)
|
||||||
{
|
{
|
||||||
gint w, h;
|
gint w, h;
|
||||||
|
#ifdef EGL_FAST_RENDERING_POSSIBLE
|
||||||
|
EGLImageKHR img = EGL_NO_IMAGE_KHR;
|
||||||
|
EGLint attrs[] = { EGL_IMAGE_PRESERVED_KHR,
|
||||||
|
EGL_FALSE, EGL_NONE, EGL_NONE
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
|
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
|
||||||
|
@ -1207,6 +1213,24 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (eglglessink->rendering_path) {
|
||||||
|
#ifdef EGL_FAST_RENDERING_POSSIBLE
|
||||||
|
case GST_EGLGLESSINK_RENDER_FAST:
|
||||||
|
/* XXX: Not Fully implemented */
|
||||||
|
img = my_eglCreateImageKHR (eglglessink->display, EGL_NO_CONTEXT,
|
||||||
|
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) GST_BUFFER_DATA (buf),
|
||||||
|
attrs);
|
||||||
|
|
||||||
|
if (img == EGL_NO_IMAGE_KHR) {
|
||||||
|
GST_ERROR_OBJECT (eglglessink, "my_eglCreateImageKHR failed");
|
||||||
|
goto HANDLE_EGL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
my_glEGLImageTargetTexture2DOES (GL_TEXTURE_2D, img);
|
||||||
|
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default: /* case GST_EGLGLESSINK_RENDER_SLOW */
|
||||||
/* XXX: This should actually happen each time
|
/* XXX: This should actually happen each time
|
||||||
* frame/window dimension changes.
|
* frame/window dimension changes.
|
||||||
* Also might want to find a way to pass buffer's
|
* Also might want to find a way to pass buffer's
|
||||||
|
@ -1230,7 +1254,6 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
||||||
g_mutex_lock (eglglessink->flow_lock);
|
g_mutex_lock (eglglessink->flow_lock);
|
||||||
if (!eglglessink->have_vbo) {
|
if (!eglglessink->have_vbo) {
|
||||||
GST_DEBUG_OBJECT (eglglessink, "Doing initial VBO setup");
|
GST_DEBUG_OBJECT (eglglessink, "Doing initial VBO setup");
|
||||||
|
|
||||||
eglglessink->coordarray[0].x = -1;
|
eglglessink->coordarray[0].x = -1;
|
||||||
eglglessink->coordarray[0].y = 1;
|
eglglessink->coordarray[0].y = 1;
|
||||||
eglglessink->coordarray[0].z = 0;
|
eglglessink->coordarray[0].z = 0;
|
||||||
|
@ -1293,33 +1316,13 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
|
|
||||||
eglSwapBuffers (eglglessink->display, eglglessink->surface);
|
eglSwapBuffers (eglglessink->display, eglglessink->surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (eglglessink, "Succesfully rendered 1 frame");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
EGLImageKHR img = EGL_NO_IMAGE_KHR;
|
|
||||||
EGLint attrs[] = { EGL_IMAGE_PRESERVED_KHR,
|
|
||||||
EGL_FALSE, EGL_NONE, EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!buf) {
|
|
||||||
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
img = my_eglCreateImageKHR (eglglessink->display, EGL_NO_CONTEXT,
|
|
||||||
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) GST_BUFFER_DATA (buf), attrs);
|
|
||||||
|
|
||||||
if (img == EGL_NO_IMAGE_KHR) {
|
|
||||||
GST_ERROR_OBJECT (eglglessink, "my_eglCreateImageKHR failed");
|
|
||||||
goto HANDLE_EGL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
my_glEGLImageTargetTexture2DOES (GL_TEXTURE_2D, img);
|
|
||||||
|
|
||||||
HANDLE_EGL_ERROR:
|
HANDLE_EGL_ERROR:
|
||||||
GST_ERROR_OBJECT (eglglessink, "EGL call returned error %x", eglGetError ());
|
GST_ERROR_OBJECT (eglglessink, "EGL call returned error %x", eglGetError ());
|
||||||
*/
|
|
||||||
HANDLE_ERROR_LOCKED:
|
HANDLE_ERROR_LOCKED:
|
||||||
g_mutex_unlock (eglglessink->flow_lock);
|
g_mutex_unlock (eglglessink->flow_lock);
|
||||||
HANDLE_ERROR:
|
HANDLE_ERROR:
|
||||||
|
|
Loading…
Reference in a new issue