hardware/intel/libva
修订版 | 8428600c94857d53ba83da174215cd589c0fbda0 (tree) |
---|---|
时间 | 2010-07-07 15:53:15 |
作者 | Gwenole Beauchesne <gbeauchesne@spli...> |
Commiter | Xiang, Haihao |
Call GLX Pixmap related functions through the vtable.
@@ -222,6 +222,14 @@ static int load_tfp_extensions(VADriverContextP ctx) | ||
222 | 222 | { |
223 | 223 | VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); |
224 | 224 | |
225 | + pOpenGLVTable->glx_create_pixmap = (PFNGLXCREATEPIXMAPPROC) | |
226 | + get_proc_address("glXCreatePixmap"); | |
227 | + if (!pOpenGLVTable->glx_create_pixmap) | |
228 | + return 0; | |
229 | + pOpenGLVTable->glx_destroy_pixmap = (PFNGLXDESTROYPIXMAPPROC) | |
230 | + get_proc_address("glXDestroyPixmap"); | |
231 | + if (!pOpenGLVTable->glx_destroy_pixmap) | |
232 | + return 0; | |
225 | 233 | pOpenGLVTable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC) |
226 | 234 | get_proc_address("glXBindTexImageEXT"); |
227 | 235 | if (!pOpenGLVTable->glx_bind_tex_image) |
@@ -451,15 +459,16 @@ struct VASurfaceGLX { | ||
451 | 459 | // Create Pixmaps for GLX texture-from-pixmap extension |
452 | 460 | static int create_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) |
453 | 461 | { |
454 | - const unsigned int width = pSurfaceGLX->width; | |
455 | - const unsigned int height = pSurfaceGLX->height; | |
456 | - Pixmap pixmap = None; | |
457 | - GLXFBConfig *fbconfig = NULL; | |
458 | - GLXPixmap glx_pixmap = None; | |
459 | - Window root_window; | |
460 | - XWindowAttributes wattr; | |
461 | - int *attrib; | |
462 | - int n_fbconfig_attrs; | |
462 | + VAOpenGLVTableP const pOpenGLVTable = gl_get_vtable(ctx); | |
463 | + const unsigned int width = pSurfaceGLX->width; | |
464 | + const unsigned int height = pSurfaceGLX->height; | |
465 | + Pixmap pixmap = None; | |
466 | + GLXFBConfig *fbconfig = NULL; | |
467 | + GLXPixmap glx_pixmap = None; | |
468 | + Window root_window; | |
469 | + XWindowAttributes wattr; | |
470 | + int *attrib; | |
471 | + int n_fbconfig_attrs; | |
463 | 472 | |
464 | 473 | root_window = RootWindow((Display *)ctx->native_dpy, ctx->x11_screen); |
465 | 474 | XGetWindowAttributes((Display *)ctx->native_dpy, root_window, &wattr); |
@@ -523,7 +532,7 @@ static int create_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
523 | 532 | *attrib++ = GL_NONE; |
524 | 533 | |
525 | 534 | x11_trap_errors(); |
526 | - glx_pixmap = glXCreatePixmap( | |
535 | + glx_pixmap = pOpenGLVTable->glx_create_pixmap( | |
527 | 536 | (Display *)ctx->native_dpy, |
528 | 537 | fbconfig[0], |
529 | 538 | pixmap, |
@@ -544,13 +553,15 @@ static int create_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
544 | 553 | // Destroy Pixmaps used for TFP |
545 | 554 | static void destroy_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) |
546 | 555 | { |
556 | + VAOpenGLVTableP const pOpenGLVTable = gl_get_vtable(ctx); | |
557 | + | |
547 | 558 | if (pSurfaceGLX->pix_texture) { |
548 | 559 | glDeleteTextures(1, &pSurfaceGLX->pix_texture); |
549 | 560 | pSurfaceGLX->pix_texture = 0; |
550 | 561 | } |
551 | 562 | |
552 | 563 | if (pSurfaceGLX->glx_pixmap) { |
553 | - glXDestroyPixmap((Display *)ctx->native_dpy, pSurfaceGLX->glx_pixmap); | |
564 | + pOpenGLVTable->glx_destroy_pixmap((Display *)ctx->native_dpy, pSurfaceGLX->glx_pixmap); | |
554 | 565 | pSurfaceGLX->glx_pixmap = None; |
555 | 566 | } |
556 | 567 |
@@ -31,15 +31,25 @@ | ||
31 | 31 | #include "va_x11.h" |
32 | 32 | #include "va_glx.h" |
33 | 33 | #include "va_backend_glx.h" |
34 | +#include <GL/glxext.h> | |
34 | 35 | |
35 | 36 | #if GLX_GLXEXT_VERSION < 18 |
36 | 37 | typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *); |
37 | 38 | typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int); |
38 | 39 | #endif |
39 | 40 | |
41 | +#if GLX_GLXEXT_VERSION < 27 | |
42 | +/* XXX: this is not exactly that version but this is the only means to | |
43 | + make sure we have the correct <GL/glx.h> with those signatures */ | |
44 | +typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *); | |
45 | +typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap); | |
46 | +#endif | |
47 | + | |
40 | 48 | typedef struct VAOpenGLVTable *VAOpenGLVTableP; |
41 | 49 | |
42 | 50 | struct VAOpenGLVTable { |
51 | + PFNGLXCREATEPIXMAPPROC glx_create_pixmap; | |
52 | + PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap; | |
43 | 53 | PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image; |
44 | 54 | PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image; |
45 | 55 | PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers; |