From patchwork Mon Jul 25 14:05:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 3099 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5F77123E54 for ; Mon, 25 Jul 2011 14:05:24 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 26E93A18527 for ; Mon, 25 Jul 2011 14:05:24 +0000 (UTC) Received: by qyk30 with SMTP id 30so2969821qyk.11 for ; Mon, 25 Jul 2011 07:05:23 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr3478561qcc.148.1311602723434; Mon, 25 Jul 2011 07:05:23 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs78170qcb; Mon, 25 Jul 2011 07:05:23 -0700 (PDT) Received: by 10.223.7.65 with SMTP id c1mr2114185fac.131.1311602722578; Mon, 25 Jul 2011 07:05:22 -0700 (PDT) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by mx.google.com with ESMTPS id o15si7048838fal.135.2011.07.25.07.05.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:05:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.161.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.44 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by mail-fx0-f44.google.com with SMTP id 6so6811099fxe.17 for ; Mon, 25 Jul 2011 07:05:22 -0700 (PDT) Received: by 10.223.14.24 with SMTP id e24mr6885701faa.15.1311602722168; Mon, 25 Jul 2011 07:05:22 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id 28sm3812295fax.3.2011.07.25.07.05.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 07:05:21 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 3/9] gl: Embed the GL dispatch table in the cairo-gl context and initialize it. Date: Mon, 25 Jul 2011 17:05:07 +0300 Message-Id: <1311602713-6182-3-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602713-6182-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602713-6182-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis --- src/cairo-egl-context.c | 6 ++++++ src/cairo-gl-private.h | 2 ++ src/cairo-glx-context.c | 7 +++++++ src/cairo-wgl-context.c | 7 +++++++ 4 files changed, 22 insertions(+), 0 deletions(-) diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c index a4ec281..b4c18fc 100644 --- a/src/cairo-egl-context.c +++ b/src/cairo-egl-context.c @@ -179,6 +179,12 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) } } + status = _cairo_gl_dispatch_init (&ctx->base.dispatch, eglGetProcAddress); + if (unlikely (status)) { + free (ctx); + return _cairo_gl_context_create_in_error (status); + } + status = _cairo_gl_context_init (&ctx->base); if (unlikely (status)) { if (ctx->dummy_surface != EGL_NO_SURFACE) diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h index a050e18..be16ede 100644 --- a/src/cairo-gl-private.h +++ b/src/cairo-gl-private.h @@ -262,6 +262,8 @@ struct _cairo_gl_context { unsigned int vertex_size; cairo_region_t *clip_region; + cairo_gl_dispatch_t dispatch; + void (*acquire) (void *ctx); void (*release) (void *ctx); diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c index fa9d8be..83963fb 100644 --- a/src/cairo-glx-context.c +++ b/src/cairo-glx-context.c @@ -193,6 +193,13 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx) ctx->base.swap_buffers = _glx_swap_buffers; ctx->base.destroy = _glx_destroy; + status = _cairo_gl_dispatch_init (&ctx->base.dispatch, + (cairo_gl_get_proc_addr_func_t) glXGetProcAddress); + if (unlikely (status)) { + free (ctx); + return _cairo_gl_context_create_in_error (status); + } + status = _cairo_gl_context_init (&ctx->base); if (unlikely (status)) { free (ctx); diff --git a/src/cairo-wgl-context.c b/src/cairo-wgl-context.c index 308d57a..82f1211 100644 --- a/src/cairo-wgl-context.c +++ b/src/cairo-wgl-context.c @@ -199,6 +199,13 @@ cairo_wgl_device_create (HGLRC rc) ctx->base.swap_buffers = _wgl_swap_buffers; ctx->base.destroy = _wgl_destroy; + status = _cairo_gl_dispatch_init (&ctx->base.dispatch, + (cairo_gl_get_proc_addr_func_t) wglGetProcAddress); + if (unlikely (status)) { + free (ctx); + return _cairo_gl_context_create_in_error (status); + } + status = _cairo_gl_context_init (&ctx->base); if (unlikely (status)) { free (ctx);