[274/906] add some other debug outputs and checks

This commit is contained in:
Julien Isorce 2008-11-20 01:24:10 +01:00 committed by Matthew Waters
parent 94f74d4b50
commit f2c3f8baa3
2 changed files with 31 additions and 9 deletions

View file

@ -257,9 +257,9 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass)
" y=1.1643*(y-0.0625);\n"
" u=u-0.5;\n"
" v=v-0.5;\n"
" r=y+1.5958*v;\n"
" g=y-0.39173*u-0.81290*v;\n"
" b=y+2.017*u;\n"
" r=clamp(y+1.5958*v+0.8, 0, 1);\n"
" g=clamp(y-0.39173*u-0.81290*v, 0, 1);\n"
" b=clamp(y+2.017*u, 0, 1);\n"
" gl_FragColor=vec4(r,g,b,1.0);\n"
"}\n";
@ -2247,6 +2247,10 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay *display)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, display->upload_fbo);
//setup a texture to render to
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex);
//attach the texture to the FBO to renderer to
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex, 0);

View file

@ -81,6 +81,7 @@ gst_gl_window_finalize (GObject * object)
GstGLWindow *window = GST_GL_WINDOW (object);
GstGLWindowPrivate *priv = window->priv;
XEvent event;
Bool ret = TRUE;
g_mutex_lock (priv->x_lock);
@ -88,12 +89,16 @@ gst_gl_window_finalize (GObject * object)
XUnmapWindow (priv->device, priv->internal_win_id);
glXMakeCurrent (priv->device, None, NULL);
ret = glXMakeCurrent (priv->device, None, NULL);
if (!ret)
g_debug ("failed to release opengl context\n");
glXDestroyContext (priv->device, priv->gl_context);
XFree (priv->visual_info);
XReparentWindow (priv->device, priv->internal_win_id, priv->root, 0, 0);
XDestroyWindow (priv->device, priv->internal_win_id);
XSync (priv->device, FALSE);
@ -238,9 +243,6 @@ gst_gl_window_new (gint width, gint height)
gint error_base;
gint event_base;
//XVisualInfo templ;
//gint unused;
XSetWindowAttributes win_attr;
XTextProperty text_property;
XWMHints wm_hints;
@ -260,6 +262,8 @@ gst_gl_window_new (gint width, gint height)
priv->device = XOpenDisplay (priv->display_name);
XSynchronize (priv->device, FALSE);
g_debug ("gl device id: %ld\n", (gulong) priv->device);
priv->screen = DefaultScreenOfDisplay (priv->device);
@ -283,8 +287,6 @@ gst_gl_window_new (gint width, gint height)
priv->visual_info = glXChooseVisual (priv->device, priv->screen_num, attrib);
//priv->visual_info = XGetVisualInfo(priv->device, VisualNoMask, &templ, &unused);
if (priv->visual_info->visual != priv->visual)
g_debug ("selected visual is different from the default\n");
@ -357,6 +359,11 @@ gst_gl_window_new (gint width, gint height)
if (!ret)
g_debug ("failed to make opengl context current\n");
if (glXIsDirect (priv->device, priv->gl_context))
g_debug ("Direct Rendering: yes\n");
else
g_debug ("Direct Rendering: no\n");
g_mutex_unlock (priv->x_lock);
return window;
@ -580,7 +587,16 @@ gst_gl_window_run_loop (GstGLWindow *window)
XFlush (priv->device);
while (XCheckTypedEvent (priv->device, ClientMessage, &event))
{
GstGLWindowCB custom_cb = (GstGLWindowCB) event.xclient.data.l[0];
gpointer custom_data = (gpointer) event.xclient.data.l[1];
g_debug ("discared custom x event\n");
if (!custom_cb || !custom_data)
g_debug ("custom cb not initialized\n");
custom_cb (custom_data);
g_cond_signal (priv->cond_send_message);
}
}
@ -606,6 +622,8 @@ gst_gl_window_run_loop (GstGLWindow *window)
case Expose:
if (priv->draw_cb)
{
if (glXGetCurrentContext () != priv->gl_context)
g_warning ("current gl context has changed\n");
priv->draw_cb (priv->draw_data);
glFlush();
glXSwapBuffers (priv->device, priv->internal_win_id);