void init(void) { load("libEGL.so.1"); initX(); eglExtensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); if (eglExtensions && checkExtension("EGL_EXT_platform_x11", eglExtensions)) { Attributes<EGLint> attribs; attribs.add(EGL_PLATFORM_X11_SCREEN_EXT, screen); attribs.add(EGL_NONE); eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11_EXT, display, attribs); } else { eglDisplay = eglGetDisplay((EGLNativeDisplayType)display); } if (eglDisplay == EGL_NO_DISPLAY) { std::cerr << "error: unable to get EGL display\n"; XCloseDisplay(display); exit(1); } EGLint major, minor; if (!eglInitialize(eglDisplay, &major, &minor)) { std::cerr << "error: unable to initialize EGL display\n"; XCloseDisplay(display); exit(1); } eglExtensions = eglQueryString(eglDisplay, EGL_EXTENSIONS); has_EGL_KHR_create_context = checkExtension("EGL_KHR_create_context", eglExtensions); }
static ClutterFeatureFlags clutter_backend_wayland_get_features (ClutterBackend *backend) { ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend); ClutterFeatureFlags flags = 0; g_assert (backend_wayland->egl_context != NULL); flags |= CLUTTER_FEATURE_STAGE_MULTIPLE | CLUTTER_FEATURE_SWAP_EVENTS | CLUTTER_FEATURE_SYNC_TO_VBLANK; CLUTTER_NOTE (BACKEND, "Checking features\n" "GL_VENDOR: %s\n" "GL_RENDERER: %s\n" "GL_VERSION: %s\n" "EGL_VENDOR: %s\n" "EGL_VERSION: %s\n" "EGL_EXTENSIONS: %s\n", glGetString (GL_VENDOR), glGetString (GL_RENDERER), glGetString (GL_VERSION), eglQueryString (backend_wayland->edpy, EGL_VENDOR), eglQueryString (backend_wayland->edpy, EGL_VERSION), eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS)); return flags; }
static void info(EGLDisplay egl_dpy) { const char *s; s = eglQueryString(egl_dpy, EGL_VERSION); printf("EGL_VERSION: %s\n", s); s = eglQueryString(egl_dpy, EGL_VENDOR); printf("EGL_VENDOR: %s\n", s); s = eglQueryString(egl_dpy, EGL_EXTENSIONS); printf("EGL_EXTENSIONS:\n", s); print_extension_list((char *) s); s = eglQueryString(egl_dpy, EGL_CLIENT_APIS); printf("EGL_CLIENT_APIS: %s\n", s); const char *glGetString (int name); #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION)); printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); printf("GL_EXTENSIONS:\n"); print_extension_list((char *) glGetString(GL_EXTENSIONS)); }
EGLDisplay Egl_Initialize() { // Get the EGL display (fb0) EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (display == EGL_NO_DISPLAY) { printf("eglGetDisplay failed.\n"); exit(1); } // Initialize EGL EGLint major; EGLint minor; EGLBoolean success = eglInitialize(display, &major, &minor); if (success != EGL_TRUE) { Egl_CheckError(); } printf("EGL: major=%d, minor=%d\n", major, minor); printf("EGL: Vendor=%s\n", eglQueryString(display, EGL_VENDOR)); printf("EGL: Version=%s\n", eglQueryString(display, EGL_VERSION)); printf("EGL: ClientAPIs=%s\n", eglQueryString(display, EGL_CLIENT_APIS)); printf("EGL: Extensions=%s\n", eglQueryString(display, EGL_EXTENSIONS)); printf("EGL: ClientExtensions=%s\n", eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)); printf("\n"); return display; }
void eglutInit(int argc, char **argv) { int i; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-display") == 0) _eglut->display_name = argv[++i]; else if (strcmp(argv[i], "-info") == 0) { _eglut->verbose = 1; } } _eglutNativeInitDisplay(); _eglut->dpy = eglGetDisplay(_eglut->native_dpy); if (!eglInitialize(_eglut->dpy, &_eglut->major, &_eglut->minor)) _eglutFatal("failed to initialize EGL display"); _eglut->init_time = _eglutNow(); printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION)); if (_eglut->verbose) { printf("EGL_VENDOR = %s\n", eglQueryString(_eglut->dpy, EGL_VENDOR)); printf("EGL_EXTENSIONS = %s\n", eglQueryString(_eglut->dpy, EGL_EXTENSIONS)); printf("EGL_CLIENT_APIS = %s\n", eglQueryString(_eglut->dpy, EGL_CLIENT_APIS)); } }
static ClutterFeatureFlags clutter_backend_egl_get_features (ClutterBackend *backend) { ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend); ClutterFeatureFlags flags; flags = clutter_backend_x11_get_features (backend); flags |= CLUTTER_FEATURE_STAGE_MULTIPLE; CLUTTER_NOTE (BACKEND, "Checking features\n" "GL_VENDOR: %s\n" "GL_RENDERER: %s\n" "GL_VERSION: %s\n" "EGL_VENDOR: %s\n" "EGL_VERSION: %s\n" "EGL_EXTENSIONS: %s\n", glGetString (GL_VENDOR), glGetString (GL_RENDERER), glGetString (GL_VERSION), eglQueryString (backend_egl->edpy, EGL_VENDOR), eglQueryString (backend_egl->edpy, EGL_VERSION), eglQueryString (backend_egl->edpy, EGL_EXTENSIONS)); return flags; }
static void x11_display_init(struct display *d) { static const EGLint conf_att[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, EGL_ALPHA_SIZE, 0, EGL_NONE, }; static const EGLint ctx_att[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; EGLBoolean b; EGLenum api; EGLint major, minor, n; d->x11.dpy = XOpenDisplay(NULL); if (!d->x11.dpy) error(1, errno, "Unable to open X server display"); d->x11.egl_display = eglGetDisplay((EGLNativeDisplayType)d->x11.dpy); if (d->x11.egl_display == EGL_NO_DISPLAY) error(1, errno, "Failed to get EGL display"); if (!eglInitialize(d->x11.egl_display, &major, &minor)) error(1, errno, "Failed to init EGL display"); fprintf(stderr, "EGL major/minor: %d.%d\n", major, minor); fprintf(stderr, "EGL version: %s\n", eglQueryString(d->x11.egl_display, EGL_VERSION)); fprintf(stderr, "EGL vendor: %s\n", eglQueryString(d->x11.egl_display, EGL_VENDOR)); fprintf(stderr, "EGL extensions: %s\n", eglQueryString(d->x11.egl_display, EGL_EXTENSIONS)); api = EGL_OPENGL_ES_API; b = eglBindAPI(api); if (!b) error(1, errno, "cannot bind OpenGLES API"); b = eglChooseConfig(d->x11.egl_display, conf_att, &d->x11.egl_conf, 1, &n); if (!b || n != 1) error(1, errno, "cannot find suitable EGL config"); d->x11.egl_ctx = eglCreateContext(d->x11.egl_display, d->x11.egl_conf, EGL_NO_CONTEXT, ctx_att); if (!d->x11.egl_ctx) error(1, errno, "cannot create EGL context"); eglMakeCurrent(d->x11.egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); }
static int init_egl(void) { EGLint major, minor, n; GLint ret; static const EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, EGL_ALPHA_SIZE, 0, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; gl.display = eglGetDisplay(gbm.dev); if (!eglInitialize(gl.display, &major, &minor)) { printf("failed to initialize\n"); return -1; } printf("Using display %p with EGL version %d.%d\n", gl.display, major, minor); printf("EGL Version \"%s\"\n", eglQueryString(gl.display, EGL_VERSION)); printf("EGL Vendor \"%s\"\n", eglQueryString(gl.display, EGL_VENDOR)); printf("EGL Extensions \"%s\"\n", eglQueryString(gl.display, EGL_EXTENSIONS)); if (!eglBindAPI(EGL_OPENGL_API)) { printf("failed to bind api EGL_OPENGL_API\n"); return -1; } if (!eglChooseConfig(gl.display, config_attribs, &gl.config, 1, &n) || n != 1) { printf("failed to choose config: %d\n", n); return -1; } gl.context = eglCreateContext(gl.display, gl.config, EGL_NO_CONTEXT, NULL); if (gl.context == NULL) { printf("failed to create context\n"); return -1; } gl.surface = eglCreateWindowSurface(gl.display, gl.config, gbm.surface, NULL); if (gl.surface == EGL_NO_SURFACE) { printf("failed to create egl surface\n"); return -1; } /* connect the context to the surface */ eglMakeCurrent(gl.display, gl.surface, gl.surface, gl.context); return 0; }
int main (int argc, char *argv[]) { EGLint config_cc; EGLint cc; EGLConfig config[100]; EGLDisplay edpy = EGL_NO_DISPLAY; griCtlErrorCommit (GRI_ERROR_CRIT_ATTR); /* * * Запрос устройства по-умолчанию * */ edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); if (edpy == EGL_NO_DISPLAY) griError ("EGL_GET_DISPLAY_FAIL"); /* * * Инициализация устройства * */ if (eglInitialize (edpy, NULL, NULL) == EGL_FALSE) { griError ("EGL_INIT_FAIL"); } /* * * Распечатка версии EGL, поставщика и доступных API * */ printf ("EGL Version: %s\n", eglQueryString (edpy, EGL_VERSION)); printf ("EGL Vendor: %s\n", eglQueryString (edpy, EGL_VENDOR)); printf ("EGL APIs: %s\n", eglQueryString (edpy, EGL_CLIENT_APIS)); /* * * Запрос подходящей конфигурации, подходящей под атрибуты egl_attribs * * EGLDisplay dpy : указатель на интересующее устройство * * EGLConfig *config : указатель на массив возвращаемых конфигов * * EGLint config_size : максимальное количество возможных элементов * * в *config * * EGLint *num_config : количество возвращённых (в *config) конфигураций * */ if (eglGetConfigs (edpy, config, 100, &config_cc) == EGL_FALSE) griError ("EGL_CHOOSE_CONFIG_FAIL"); if (!config_cc) griError ("EGL_NO_CONFIG_AVAILABLE"); cc = config_cc; printf ("# count: %d\n", config_cc); while (cc--) { printf ("# EGLConfig: %d/%d\n", cc, config_cc); print_eglConfig (edpy, config[cc]); } printf ("@ END\n"); return 0; }
gboolean gdk_wayland_display_init_gl (GdkDisplay *display) { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); EGLint major, minor; EGLDisplay *dpy; if (display_wayland->have_egl) return TRUE; dpy = eglGetDisplay ((EGLNativeDisplayType)display_wayland->wl_display); if (dpy == NULL) return FALSE; if (!eglInitialize (dpy, &major, &minor)) return FALSE; if (!eglBindAPI (EGL_OPENGL_API)) return FALSE; display_wayland->egl_display = dpy; display_wayland->egl_major_version = major; display_wayland->egl_minor_version = minor; display_wayland->have_egl = TRUE; display_wayland->have_egl_khr_create_context = epoxy_has_egl_extension (dpy, "EGL_KHR_create_context"); display_wayland->have_egl_buffer_age = epoxy_has_egl_extension (dpy, "EGL_EXT_buffer_age"); display_wayland->have_egl_swap_buffers_with_damage = epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage"); display_wayland->have_egl_surfaceless_context = epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context"); GDK_NOTE (OPENGL, g_print ("EGL API version %d.%d found\n" " - Vendor: %s\n" " - Version: %s\n" " - Client APIs: %s\n" " - Extensions:\n" "\t%s\n" , display_wayland->egl_major_version, display_wayland->egl_minor_version, eglQueryString (dpy, EGL_VENDOR), eglQueryString(dpy, EGL_VERSION), eglQueryString(dpy, EGL_CLIENT_APIS), eglQueryString(dpy, EGL_EXTENSIONS))); return TRUE; }
bool GraphicsContext3DInternal::initEGL() { m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (m_dpy == EGL_NO_DISPLAY) return false; EGLint majorVersion; EGLint minorVersion; EGLBoolean returnValue = eglInitialize(m_dpy, &majorVersion, &minorVersion); if (returnValue != EGL_TRUE) return false; LOGWEBGL("EGL version %d.%d", majorVersion, minorVersion); const char *s = eglQueryString(m_dpy, EGL_VENDOR); LOGWEBGL("EGL_VENDOR = %s", s); s = eglQueryString(m_dpy, EGL_VERSION); LOGWEBGL("EGL_VERSION = %s", s); s = eglQueryString(m_dpy, EGL_EXTENSIONS); LOGWEBGL("EGL_EXTENSIONS = %s", s); s = eglQueryString(m_dpy, EGL_CLIENT_APIS); LOGWEBGL("EGL_CLIENT_APIS = %s", s); EGLint config_attribs[21]; int p = 0; config_attribs[p++] = EGL_BLUE_SIZE; config_attribs[p++] = 8; config_attribs[p++] = EGL_GREEN_SIZE; config_attribs[p++] = 8; config_attribs[p++] = EGL_RED_SIZE; config_attribs[p++] = 8; config_attribs[p++] = EGL_SURFACE_TYPE; config_attribs[p++] = EGL_PBUFFER_BIT; config_attribs[p++] = EGL_RENDERABLE_TYPE; config_attribs[p++] = EGL_OPENGL_ES2_BIT; config_attribs[p++] = EGL_ALPHA_SIZE; config_attribs[p++] = m_attrs.alpha ? 8 : 0; if (m_attrs.depth) { config_attribs[p++] = EGL_DEPTH_SIZE; config_attribs[p++] = 16; } if (m_attrs.stencil) { config_attribs[p++] = EGL_STENCIL_SIZE; config_attribs[p++] = 8; } // Antialiasing currently is not supported. m_attrs.antialias = false; config_attribs[p] = EGL_NONE; EGLint num_configs = 0; return (eglChooseConfig(m_dpy, config_attribs, &m_config, 1, &num_configs) == EGL_TRUE); }
gboolean _gdk_mir_display_init_egl_display (GdkDisplay *display) { GdkMirDisplay *mir_dpy = GDK_MIR_DISPLAY (display); EGLint major_version, minor_version; EGLDisplay *dpy; if (mir_dpy->egl_display) return TRUE; dpy = eglGetDisplay (mir_connection_get_egl_native_display (mir_dpy->connection)); if (dpy == NULL) return FALSE; if (!eglInitialize (dpy, &major_version, &minor_version)) return FALSE; if (!eglBindAPI (EGL_OPENGL_API)) return FALSE; mir_dpy->egl_display = dpy; mir_dpy->have_egl_khr_create_context = epoxy_has_egl_extension (dpy, "EGL_KHR_create_context"); mir_dpy->have_egl_buffer_age = epoxy_has_egl_extension (dpy, "EGL_EXT_buffer_age"); mir_dpy->have_egl_swap_buffers_with_damage = epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage"); mir_dpy->have_egl_surfaceless_context = epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context"); GDK_NOTE (OPENGL, g_print ("EGL API version %d.%d found\n" " - Vendor: %s\n" " - Version: %s\n" " - Client APIs: %s\n" " - Extensions:\n" "\t%s\n", major_version, minor_version, eglQueryString (dpy, EGL_VENDOR), eglQueryString (dpy, EGL_VERSION), eglQueryString (dpy, EGL_CLIENT_APIS), eglQueryString (dpy, EGL_EXTENSIONS))); return TRUE; }
void test_caps(void) { GLint width, height; EGLint pbuffer_attribute_list[] = { EGL_WIDTH, 256, EGL_HEIGHT, 256, EGL_LARGEST_PBUFFER, EGL_TRUE, EGL_NONE }; EGLSurface surface; int i; RD_START("caps", ""); ECHK(surface = eglCreatePbufferSurface(display, config, pbuffer_attribute_list)); ECHK(eglQuerySurface(display, surface, EGL_WIDTH, &width)); ECHK(eglQuerySurface(display, surface, EGL_HEIGHT, &height)); DEBUG_MSG("PBuffer: %dx%d", width, height); /* connect the context to the surface */ ECHK(eglMakeCurrent(display, surface, surface, context)); GCHK(glFlush()); printf("EGL Version %s\n", eglQueryString(display, EGL_VERSION)); printf("EGL Vendor %s\n", eglQueryString(display, EGL_VENDOR)); printf("EGL Extensions %s\n", eglQueryString(display, EGL_EXTENSIONS)); printf("GL Version %s\n", glGetString(GL_VERSION)); printf("GL extensions: %s\n", glGetString(GL_EXTENSIONS)); for (i = 0; i < ARRAY_SIZE(int_params); i++) { GLint val[4] = {}; GLenum err; glGetIntegerv(int_params[i].pname, val); err = glGetError(); if (err != GL_NO_ERROR) { printf("no %s: %s\n", int_params[i].name, glStrError(err)); } else { printf("%s: %d %d %d %d\n", int_params[i].name, val[0], val[1], val[2], val[3]); } } RD_END(); }
void QGLContext::makeCurrent() { Q_D(QGLContext); if (!d->valid || !d->eglContext || d->eglSurfaceForDevice() == EGL_NO_SURFACE) { qWarning("QGLContext::makeCurrent(): Cannot make invalid context current"); return; } if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) { QGLContextPrivate::setCurrentContext(this); if (!d->workaroundsCached) { d->workaroundsCached = true; const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); if (renderer && (strstr(renderer, "SGX") || strstr(renderer, "MBX"))) { // PowerVR MBX/SGX chips needs to clear all buffers when starting to render // a new frame, otherwise there will be a performance penalty to pay for // each frame. d->workaround_needsFullClearOnEveryFrame = true; // Older PowerVR SGX drivers (like the one in the N900) have a // bug which prevents glCopyTexSubImage2D() to work with a POT // or GL_ALPHA texture bound to an FBO. The only way to // identify that driver is to check the EGL version number for it. const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION); if (egl_version && strstr(egl_version, "1.3")) d->workaround_brokenFBOReadBack = true; } } } }
// The recommended technique for querying OpenGL extensions; // adapted from http://opengl.org/resources/features/OGLextensions/ static bool PVRShellIsExtensionSupported(EGLDisplay dpy, const char *extension) { const char *extensions = NULL; const char *start; char *where, *terminator; /* Extension names should not have spaces. */ where = (char *) strchr(extension, ' '); if (where || *extension == '\0') return false; extensions = eglQueryString(dpy, EGL_EXTENSIONS); /* It takes a bit of care to be fool-proof about parsing the OpenGL extensions string. Don't be fooled by sub-strings, etc. */ start = extensions; for (;;) { where = (char *) strstr((const char *) start, extension); if (!where) break; terminator = where + strlen(extension); if (where == start || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') return true; start = terminator; } return false; }
/* Updates all the function pointers */ static void check_egl_extensions(cg_renderer_t *renderer) { cg_renderer_egl_t *egl_renderer = renderer->winsys; const char *egl_extensions; char **split_extensions; int i; egl_extensions = eglQueryString(egl_renderer->edpy, EGL_EXTENSIONS); split_extensions = c_strsplit(egl_extensions, " ", 0 /* max_tokens */); CG_NOTE(WINSYS, " EGL Extensions: %s", egl_extensions); egl_renderer->private_features = 0; for (i = 0; i < C_N_ELEMENTS(winsys_feature_data); i++) if (_cg_feature_check(renderer, "EGL", winsys_feature_data + i, 0, 0, CG_DRIVER_GL, /* the driver isn't used */ split_extensions, egl_renderer)) { egl_renderer->private_features |= winsys_feature_data[i].feature_flags_private; } c_strfreev(split_extensions); }
bool QEgl::hasExtension(const char* extensionName) { QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *> (eglQueryString(QEgl::display(), EGL_EXTENSIONS))).split(' '); return extensions.contains(extensionName); }
void _eglutNativeInitWindow(struct eglut_window *win, const char *title, int x, int y, int w, int h) { EGLint surf_attribs[16]; EGLint i; const char *exts; exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS); if (!exts || !strstr(exts, "EGL_MESA_screen_surface")) _eglutFatal("EGL_MESA_screen_surface is not supported\n"); init_kms(); i = 0; surf_attribs[i++] = EGL_WIDTH; surf_attribs[i++] = kms_width; surf_attribs[i++] = EGL_HEIGHT; surf_attribs[i++] = kms_height; surf_attribs[i++] = EGL_NONE; /* create surface */ win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy, win->config, surf_attribs); if (win->native.u.surface == EGL_NO_SURFACE) _eglutFatal("eglCreateScreenSurfaceMESA failed\n"); if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen, win->native.u.surface, kms_mode)) _eglutFatal("eglShowScreenSurfaceMESA failed\n"); win->native.width = kms_width; win->native.height = kms_height; }
/** * Conformance test #2 in the EGL_EXT_client_extensions spec: * * 2. Obtain a display with eglGetDisplay but do not initialize it. Verify * that passing the uninitialized display to `eglQueryString(dpy, * EGL_EXTENSIONS)` returns NULL and generates EGL_NOT_INITIALIZED. */ static void test_2(void) { enum piglit_result result = PIGLIT_PASS; EGLDisplay dpy; const char *display_extensions; dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (!dpy) { printf("Failed to get default display. Skipping.n"); piglit_report_result(PIGLIT_SKIP); } printf("Calling eglQueryString(dpy, EGL_EXTENSIONS) with an " "uninitialized display...\n"); display_extensions = eglQueryString(dpy, EGL_EXTENSIONS); if (display_extensions == NULL) { printf("Correctly returned null extension string\n"); } else { printf("Did not return null extension string\n"); result = PIGLIT_FAIL; } if (!piglit_check_egl_error(EGL_NOT_INITIALIZED)) { result = PIGLIT_FAIL; } piglit_report_result(result); }
void SetUp() override { ANGLETest::SetUp(); const char *extensionString = static_cast<const char*>(eglQueryString(getEGLWindow()->getDisplay(), EGL_EXTENSIONS)); if (strstr(extensionString, "EGL_EXT_device_query")) { mQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)eglGetProcAddress("eglQueryDisplayAttribEXT"); mQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)eglGetProcAddress("eglQueryDeviceAttribEXT"); mQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)eglGetProcAddress("eglQueryDeviceStringEXT"); } if (!mQueryDeviceStringEXT) { FAIL() << "ANGLE extension EGL_EXT_device_query export eglQueryDeviceStringEXT was not found"; } if (!mQueryDisplayAttribEXT) { FAIL() << "ANGLE extension EGL_EXT_device_query export eglQueryDisplayAttribEXT was not found"; } if (!mQueryDeviceAttribEXT) { FAIL() << "ANGLE extension EGL_EXT_device_query export eglQueryDeviceAttribEXT was not found"; } EGLAttrib angleDevice = 0; EXPECT_EQ(EGL_TRUE, mQueryDisplayAttribEXT(getEGLWindow()->getDisplay(), EGL_DEVICE_EXT, &angleDevice)); extensionString = static_cast<const char*>(mQueryDeviceStringEXT(reinterpret_cast<EGLDeviceEXT>(angleDevice), EGL_EXTENSIONS)); if (strstr(extensionString, "EGL_ANGLE_device_d3d") == NULL) { FAIL() << "ANGLE extension EGL_ANGLE_device_d3d was not found"; } }
EGLStreamConvenience::EGLStreamConvenience() : initialized(false), has_egl_platform_device(false), has_egl_device_base(false), has_egl_stream(false), has_egl_stream_producer_eglsurface(false), has_egl_stream_consumer_egloutput(false), has_egl_output_drm(false), has_egl_output_base(false), has_egl_stream_cross_process_fd(false), has_egl_stream_consumer_gltexture(false) { const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); if (!extensions) { qCWarning(lcEglConvenience, "Failed to query EGL extensions"); return; } query_devices = reinterpret_cast<PFNEGLQUERYDEVICESEXTPROC>(eglGetProcAddress("eglQueryDevicesEXT")); query_device_string = reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(eglGetProcAddress("eglQueryDeviceStringEXT")); get_platform_display = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")); has_egl_device_base = strstr(extensions, "EGL_EXT_device_base"); has_egl_platform_device = strstr(extensions, "EGL_EXT_platform_device"); }
bool IsExtensionSupported(const char* extension) override { const char *extList = eglQueryString(mDisplay, EGL_EXTENSIONS); const char *start; const char *where, *terminator; /* Extension names should not have spaces. */ where = std::strchr(extension, ' '); if (where || *extension == '\0') return false; size_t extlen = std::strlen(extension); /* It takes a bit of care to be fool-proof about parsing the OpenGL extensions string. Don't be fooled by sub-strings, etc. */ for (start=extList;;) { where = std::strstr(start, extension); if (!where) break; terminator = where + extlen; if ( where == start || *(where - 1) == ' ' ) if ( *terminator == ' ' || *terminator == '\0' ) return true; start = terminator; } return false; }
bool QXcbEglIntegration::initialize(QXcbConnection *connection) { m_connection = connection; const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) { QEGLStreamConvenience streamFuncs; m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR, xlib_display(), nullptr); } if (!m_egl_display) m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display())); EGLint major, minor; bool success = eglInitialize(m_egl_display, &major, &minor); if (!success) { m_egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); qCDebug(lcQpaGl) << "Xcb EGL gl-integration retrying with display" << m_egl_display; success = eglInitialize(m_egl_display, &major, &minor); } m_native_interface_handler.reset(new QXcbEglNativeInterfaceHandler(connection->nativeInterface())); qCDebug(lcQpaGl) << "Xcb EGL gl-integration successfully initialized"; return success; }
static void gl_extn_veto(Render_Engine *re) { const char *str = NULL; str = eglQueryString(eng_get_ob(re)->egl.disp, EGL_EXTENSIONS); if (str) { const char *s = NULL; if (getenv("EVAS_GL_INFO")) printf("EGL EXTN:\n%s\n", str); // Disable Partial Rendering s = getenv("EVAS_GL_PARTIAL_DISABLE"); if ((s) && (atoi(s))) { _extn_have_buffer_age = 0; glsym_eglSwapBuffersWithDamage = NULL; } if (!strstr(str, "EGL_EXT_buffer_age")) _extn_have_buffer_age = 0; if (!strstr(str, "EGL_EXT_swap_buffers_with_damage")) glsym_eglSwapBuffersWithDamage = NULL; } else { if (getenv("EVAS_GL_INFO")) printf("NO EGL EXTN!\n"); _extn_have_buffer_age = 0; } }
void DrmEglServerBufferIntegration::initialize(QWaylandDisplay *display) { m_egl_display = eglGetDisplay((EGLNativeDisplayType) display->wl_display()); if (EGL_NO_DISPLAY) { qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display."); return; } const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS); if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) { qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_KHR_image extension.\n"); return; } m_egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR")); m_egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR")); if (!m_egl_create_image || !m_egl_destroy_image) { qWarning("Failed to initialize drm egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR"); return; } m_gl_egl_image_target_texture = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES")); if (!m_gl_egl_image_target_texture) { qWarning("Failed to initialize drm egl server buffer integration. Could not resolve glEGLImageTargetTexture2DOES"); return; } QtWayland::wl_registry::init(wl_display_get_registry(display->wl_display())); }
bool q_hasEglExtension(EGLDisplay display, const char* extensionName) { QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *> (eglQueryString(display, EGL_EXTENSIONS))).split(' '); return extensions.contains(extensionName); }
int main(int argc, char **argv) { bool pass = true; EGLContext egl_ctx; EGLDisplay *dpy = get_egl_display_or_skip(); const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS); char *first_space; char *an_extension; /* We don't have any extensions guaranteed by the ABI, so for the * touch test we just check if the first one is reported to be there. */ first_space = strstr(extensions, " "); if (first_space) { an_extension = strndup(extensions, first_space - extensions); } else { an_extension = strdup(extensions); } if (!epoxy_extension_in_string(extensions, an_extension)) errx(1, "Implementation reported absence of %s", an_extension); free(an_extension); init_egl(dpy, &egl_ctx); pass = make_egl_current_and_test(dpy, egl_ctx); return pass != true; }
int Java_org_yabause_android_YabauseRunnable_initViewport() { int error; char * buf; g_Display = eglGetCurrentDisplay(); g_Surface = eglGetCurrentSurface(EGL_READ); g_Context = eglGetCurrentContext(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0, 320, 224, 0, 1, 0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glDisable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); yprintf(glGetString(GL_VENDOR)); yprintf(glGetString(GL_RENDERER)); yprintf(glGetString(GL_VERSION)); yprintf(glGetString(GL_EXTENSIONS)); yprintf(eglQueryString(g_Display,EGL_EXTENSIONS)); eglSwapInterval(g_Display,0); eglMakeCurrent(g_Display,EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); return 0; }
void CGLContextEGL::QueryExtensions() { std::string extensions = eglQueryString(m_eglDisplay, EGL_EXTENSIONS); m_extensions = std::string(" ") + extensions + " "; CLog::Log(LOGDEBUG, "EGL_EXTENSIONS:%s", m_extensions.c_str()); }
static int extension_supported(EGLDisplay edpy, const char *ext) { const char *exts = eglQueryString(edpy, EGL_EXTENSIONS); return extension_in_list(ext, exts); }