From patchwork Mon Jul 25 13:56:45 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: 3091 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 3ADDC23E54 for ; Mon, 25 Jul 2011 13:57:58 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 04387A183B4 for ; Mon, 25 Jul 2011 13:57:57 +0000 (UTC) Received: by mail-qw0-f52.google.com with SMTP id 8so3003702qwb.11 for ; Mon, 25 Jul 2011 06:57:57 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr3730724qci.114.1311602277743; Mon, 25 Jul 2011 06:57:57 -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 hl14cs77911qcb; Mon, 25 Jul 2011 06:57:57 -0700 (PDT) Received: by 10.213.9.207 with SMTP id m15mr223376ebm.5.1311602276473; Mon, 25 Jul 2011 06:57:56 -0700 (PDT) Received: from mail-ey0-f176.google.com (mail-ey0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id v9si5049238eef.34.2011.07.25.06.57.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.215.176; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by eya28 with SMTP id 28so4403321eya.35 for ; Mon, 25 Jul 2011 06:57:55 -0700 (PDT) Received: by 10.204.136.19 with SMTP id p19mr1398355bkt.146.1311602274733; Mon, 25 Jul 2011 06:57:54 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id s16sm1325570fah.0.2011.07.25.06.57.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:57:53 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 18/21] boilerplate/egl: Add GLES2 support Date: Mon, 25 Jul 2011 16:56:45 +0300 Message-Id: <1311602208-5973-18-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> References: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis Signed-off-by: Chris Wilson --- boilerplate/cairo-boilerplate-egl.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c index 1a5abec..6ecb8a8 100644 --- a/boilerplate/cairo-boilerplate-egl.c +++ b/boilerplate/cairo-boilerplate-egl.c @@ -33,6 +33,11 @@ #include "cairo-boilerplate-private.h" #include +#if CAIRO_HAS_GL_SURFACE +#include +#elif CAIRO_HAS_GLESV2_SURFACE +#include +#endif static const cairo_user_data_key_t gl_closure_key; @@ -81,7 +86,17 @@ _cairo_boilerplate_egl_create_surface (const char *name, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, +#if CAIRO_HAS_GL_SURFACE EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, +#elif CAIRO_HAS_GLESV2_SURFACE + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, +#endif + EGL_NONE + }; + const EGLint ctx_attribs[] = { +#if CAIRO_HAS_GLESV2_SURFACE + EGL_CONTEXT_CLIENT_VERSION, 2, +#endif EGL_NONE }; @@ -101,9 +116,14 @@ _cairo_boilerplate_egl_create_surface (const char *name, return NULL; } +#if CAIRO_HAS_GL_SURFACE eglBindAPI (EGL_OPENGL_API); +#elif CAIRO_HAS_GLESV2_SURFACE + eglBindAPI (EGL_OPENGL_ES_API); +#endif - gltc->ctx = eglCreateContext (gltc->dpy, config, EGL_NO_CONTEXT, NULL); + gltc->ctx = eglCreateContext (gltc->dpy, config, EGL_NO_CONTEXT, + ctx_attribs); if (gltc->ctx == EGL_NO_CONTEXT) { eglTerminate (gltc->dpy); free (gltc);