• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

Revisionfac3fb471759c436e0e7dab0d083929586292074 (tree)
Zeit2016-03-03 12:56:42
AutorCyril Drouet <cyril.drouet@imme...>
CommiterXiang, Haihao

Log Message

glx: check OpenGL 3.1 extensions

I successfully implemented hardware decoding with VAAPI via FFmpeg
by copying the data back to the CPU's memory; however, when I tried
to use the data directly from the GPU (instead of copying them back)
by using VA/GLX to convert the decoded VASurfaces to OpenGL textures,
I ran into some issues.

With the latest version of libva, vaCreateSurfaceGLX fails all the time
when I set OpenGL to 3.1 or above. If I set it to 3.0, then it doesn't
fail, and everything works correctly. I downloaded the sources of libva
and it fails when checking for GL extensions because of the use of
glGetString(GL_EXTENSIONS) which is deprecated. I have implemented a fix
on my end (which I've attached for convenience) which works well for me
but I haven't done a lot of testing, and I would rather use the official
version of libva.

Signed-off-by: Cyril Drouet <cyril.drouet@immerex.com>
Signed-off-by: Víctor Jáquez <vjaquez@igalia.com>

Ändern Zusammenfassung

Diff

--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -191,18 +191,40 @@ static int check_extension(const char *name, const char *ext)
191191 return 0;
192192 }
193193
194+static int check_extension3(const char *name)
195+{
196+ int nbExtensions, i;
197+ PFNGLGETSTRINGIPROC glGetStringi = 0;
198+
199+ glGetStringi = (PFNGLGETSTRINGIPROC) get_proc_address("glGetStringi");
200+ if(!glGetStringi)
201+ return 0;
202+
203+
204+ glGetIntegerv(GL_NUM_EXTENSIONS, &nbExtensions);
205+ for(i = 0; i < nbExtensions; i++)
206+ {
207+ const GLubyte *strExtension = glGetStringi(GL_EXTENSIONS, i);
208+ if(strcmp(strExtension, (const GLubyte *)name) == 0)
209+ return 1;
210+ }
211+
212+ return 0;
213+}
214+
194215 static int check_tfp_extensions(VADriverContextP ctx)
195216 {
196217 const char *gl_extensions;
197218 const char *glx_extensions;
198219
199220 gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
200- if (!check_extension("GL_ARB_texture_non_power_of_two", gl_extensions))
221+ if (!check_extension("GL_ARB_texture_non_power_of_two", gl_extensions) && !check_extension3("GL_ARB_texture_non_power_of_two"))
201222 return 0;
202223
203224 glx_extensions = glXQueryExtensionsString(ctx->native_dpy, ctx->x11_screen);
204225 if (!check_extension("GLX_EXT_texture_from_pixmap", glx_extensions))
205226 return 0;
227+
206228 return 1;
207229 }
208230
@@ -211,10 +233,11 @@ static int check_fbo_extensions(VADriverContextP ctx)
211233 const char *gl_extensions;
212234
213235 gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
214- if (check_extension("GL_ARB_framebuffer_object", gl_extensions))
236+ if (check_extension("GL_ARB_framebuffer_object", gl_extensions) || check_extension3("GL_ARB_framebuffer_object"))
215237 return 1;
216- if (check_extension("GL_EXT_framebuffer_object", gl_extensions))
238+ if (check_extension("GL_EXT_framebuffer_object", gl_extensions) || check_extension3("GL_EXT_framebuffer_object"))
217239 return 1;
240+
218241 return 0;
219242 }
220243