From patchwork Fri Feb 11 18:05:55 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: 131 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:14 -0000 Delivered-To: patches@linaro.org Received: by 10.147.124.5 with SMTP id b5cs226415yan; Fri, 11 Feb 2011 10:07:09 -0800 (PST) Received: by 10.216.30.80 with SMTP id j58mr746177wea.64.1297447628670; Fri, 11 Feb 2011 10:07:08 -0800 (PST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id o51si1428312wee.136.2011.02.11.10.07.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Feb 2011 10:07:08 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by wyb42 with SMTP id 42so2687172wyb.37 for ; Fri, 11 Feb 2011 10:07:08 -0800 (PST) Received: by 10.216.167.84 with SMTP id h62mr904132wel.3.1297447627984; Fri, 11 Feb 2011 10:07:07 -0800 (PST) Received: from localhost ([194.219.210.40]) by mx.google.com with ESMTPS id u2sm471393weh.12.2011.02.11.10.06.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Feb 2011 10:07:00 -0800 (PST) From: alexandros.frantzis@linaro.org To: cairo@cairographics.org Subject: [PATCH 3/3] boilerplate/egl: Ensure that we are using an RGBA32 egl config Date: Fri, 11 Feb 2011 20:05:55 +0200 Message-Id: <1297447555-29654-4-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1297447555-29654-1-git-send-email-alexandros.frantzis@linaro.org> References: <1297447555-29654-1-git-send-email-alexandros.frantzis@linaro.org> From: Alexandros Frantzis --- boilerplate/cairo-boilerplate-egl.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c index 75439a9..1a5abec 100644 --- a/boilerplate/cairo-boilerplate-egl.c +++ b/boilerplate/cairo-boilerplate-egl.c @@ -73,8 +73,17 @@ _cairo_boilerplate_egl_create_surface (const char *name, egl_target_closure_t *gltc; cairo_surface_t *surface; int major, minor; - EGLConfig *configs; + EGLConfig config; EGLint numConfigs; + EGLint config_attribs[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, + EGL_NONE + }; gltc = xcalloc (1, sizeof (egl_target_closure_t)); *closure = gltc; @@ -86,17 +95,15 @@ _cairo_boilerplate_egl_create_surface (const char *name, return NULL; } - eglGetConfigs (gltc->dpy, NULL, 0, &numConfigs); + eglChooseConfig (gltc->dpy, config_attribs, &config, 1, &numConfigs); if (numConfigs == 0) { free (gltc); return NULL; } - configs = xmalloc(sizeof(*configs) *numConfigs); - eglGetConfigs (gltc->dpy, configs, numConfigs, &numConfigs); eglBindAPI (EGL_OPENGL_API); - gltc->ctx = eglCreateContext (gltc->dpy, configs[0], EGL_NO_CONTEXT, NULL); + gltc->ctx = eglCreateContext (gltc->dpy, config, EGL_NO_CONTEXT, NULL); if (gltc->ctx == EGL_NO_CONTEXT) { eglTerminate (gltc->dpy); free (gltc);