2362N/A * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * This is a globally shared context used when creating textures. When any 0N/A * new contexts are created, they specify this context as the "share list" 0N/A * context, which means any texture objects created when this shared context 0N/A * is current will be available to any other context. 0N/A * Attempts to initialize GLX and the core OpenGL library. For this method 0N/A * to return JNI_TRUE, the following must be true: 0N/A * - libGL must be loaded successfully (via dlopen) 0N/A * - all function symbols from libGL must be available and loaded properly 0N/A * - the GLX extension must be available through X11 0N/A * - client GLX version must be >= 1.3 0N/A * If any of these requirements are not met, this method will return 0N/A * JNI_FALSE, indicating there is no hope of using GLX/OpenGL for any 0N/A * GraphicsConfig in the environment. 0N/A "GLXGC_InitGLX: GLX extension is not present");
0N/A "GLXGC_InitGLX: could not query GLX version");
0N/A // we now only verify that the client GLX version is >= 1.3 (if the 0N/A // server does not support GLX 1.3, then we will find that out later 0N/A // when we attempt to create a GLXFBConfig) 0N/A "GLXGC_InitGLX: invalid GLX version; 1.3 is required");
0N/A * Returns JNI_TRUE if GLX is available for the current display. Note that 0N/A * this method will attempt to initialize GLX (and all the necessary function 0N/A * symbols) if it has not been already. The AWT_LOCK must be acquired before 0N/A * calling this method. 0N/A * Disposes all memory and resources allocated for the given OGLContext. 0N/A "GLXGC_DestroyOGLContext: context is null");
0N/A // at this point, this context will be current to its scratch surface 0N/A // so the following GL/GLX operations should be safe... 0N/A // release the current context before we continue 0N/A * Disposes all memory and resources associated with the given 0N/A * GLXGraphicsConfigInfo (including its native OGLContext data). 0N/A "OGLGC_DestroyOGLGraphicsConfig: info is null");
0N/A * Attempts to create a new GLXFBConfig for the requested screen and visual. 0N/A * If visualid is 0, this method will iterate through all GLXFBConfigs (if 0N/A * any) that match the requested attributes and will attempt to find an 0N/A * fbconfig with a minimal combined depth+stencil buffer. Note that we 0N/A * currently only need depth capabilities (for shape clipping purposes), but 0N/A * glXChooseFBConfig() will often return a list of fbconfigs with the largest 0N/A * depth buffer (and stencil) sizes at the top of the list. Therefore, we 0N/A * scan through the whole list to find the most VRAM-efficient fbconfig. 0N/A * If visualid is non-zero, the GLXFBConfig associated with the given visual 0N/A * is chosen (assuming it meets the requested attributes). If there are no 0N/A * valid GLXFBConfigs available, this method returns 0. 0N/A // this is the initial minimum value for the combined depth+stencil size 0N/A // (we initialize it to some absurdly high value; realistic values will 0N/A // be much less than this number) 0N/A // find all fbconfigs for this screen with the provided attributes 0N/A "GLXGC_InitFBConfig: could not find any valid fbconfigs");
0N/A // iterate through the list of fbconfigs, looking for the one that matches 0N/A // the requested VisualID and supports RGBA rendering as well as the 0N/A // creation of windows and pbuffers 0N/A // get VisualID from GLXFBConfig 0N/A // get GLX-specific attributes from GLXFBConfig 0N/A // these attributes don't affect our decision, but they are 0N/A // interesting for trace logs, so we will query them anyway 0N/A "[V] id=0x%x db=%d alpha=%d depth=%d stencil=%d valid=",
0N/A * Sun's OpenGL implementation will always 0N/A * return at least two GLXFBConfigs (visuals) from 0N/A * glXChooseFBConfig(). The first will be a linear (gamma 0N/A * corrected) visual; the second will have the same capabilities 0N/A * as the first, except it will be a non-linear (non-gamma 0N/A * corrected) visual, which is the one we want, otherwise 0N/A * everything will look "washed out". So we will reject any 0N/A * visuals that have gamma values other than 1.0 (the value 0N/A * returned by glXGetFBConfigAttrib() will be scaled 0N/A * by 100, so 100 corresponds to a gamma value of 1.0, 220 0N/A * corresponds to 2.2, and so on). 0N/A // when visualid == 0, we loop through all configs 0N/A // looking for an fbconfig that has the smallest combined 0N/A // depth+stencil size (this keeps VRAM usage to a minimum) 0N/A "false (large depth)\n");
0N/A // in this case, visualid == fbvisualid, which means 0N/A // we've found a valid fbconfig corresponding to the 0N/A // requested VisualID, so break out of the loop 0N/A // free the list of fbconfigs 0N/A "GLXGC_InitFBConfig: could not find an appropriate fbconfig");
0N/A * Returns the X11 VisualID that corresponds to the best GLXFBConfig for the 0N/A * given screen. If no valid visual could be found, this method returns zero. 0N/A * Note that this method will attempt to initialize GLX (and all the 0N/A * necessary function symbols) if it has not been already. The AWT_LOCK 0N/A * must be acquired before calling this method. 0N/A "GLXGC_FindBestVisual: could not initialize GLX");
0N/A "GLXGC_FindBestVisual: could not find best visual");
0N/A "GLXGC_FindBestVisual: could not get visual for fbconfig");
0N/A "GLXGC_FindBestVisual: chose 0x%x as the best visual for screen %d",
0N/A * Creates a scratch pbuffer, which can be used to make a context current 0N/A * for extension queries, etc. 0N/A * Initializes a new OGLContext, which includes the native GLXContext handle 0N/A * and some other important information such as the associated GLXFBConfig. 0N/A "GLXGC_InitOGLContext: could not allocate memory for oglc");
0N/A "GLXGC_InitOGLContext: could not allocate memory for ctxinfo");
0N/A#
endif /* !HEADLESS */ 0N/A * Determines whether the GLX pipeline can be used for a given GraphicsConfig 0N/A * provided its screen number and visual ID. If the minimum requirements are 0N/A * met, the native GLXGraphicsConfigInfo structure is initialized for this 0N/A * GraphicsConfig with the necessary information (GLXFBConfig, etc.) 0N/A * and a pointer to this structure is returned as a jlong. If 0N/A * initialization fails at any point, zero is returned, indicating that GLX 0N/A * cannot be used for this GraphicsConfig (we should fallback on the existing 0N/A // when Xinerama is enabled, the screen ID needs to be 0 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not create fbconfig");
0N/A // create the one shared context 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not create shared context");
0N/A // create the GLXContext for this GLXGraphicsConfig 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not create GLX context");
0N/A // this is pretty sketchy, but it seems to be the easiest way to create 0N/A // some form of GLXDrawable using only the display and a GLXFBConfig 0N/A // (in order to make the context current for checking the version, 0N/A // extensions, etc)... 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not create scratch pbuffer");
0N/A // the context must be made current before we can query the 0N/A // version and extension strings 0N/A * 6438225: The software rasterizer used by Sun's OpenGL libraries 0N/A * for certain boards has quality issues, and besides, performance 0N/A * of these boards is not high enough to justify the use of the 0N/A * OpenGL-based Java 2D pipeline. If we detect one of the following 0N/A * boards via the GL_RENDERER string, just give up: 0N/A * - FFB[2[+]] ("Creator[3D]") 0N/A * - PGX-series ("m64") 0N/A "GLXGraphicsConfig_getGLXConfigInfo: detected renderer (%s)",
0N/A "GLXGraphicsConfig_getGLXConfigInfo: unsupported board (%s)",
0N/A // destroy the temporary resources 0N/A "GLXGraphicsConfig_getGLXConfigInfo: OpenGL version=%s",
0N/A "GLXGraphicsConfig_getGLXConfigInfo: OpenGL 1.2 is required");
0N/A // get config-specific capabilities 0N/A // initialize the OGLContext, which wraps the GLXFBConfig and GLXContext 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not create oglc");
0N/A "GLXGraphicsConfig_getGLXConfigInfo: finished checking dependencies");
0N/A // create the GLXGraphicsConfigInfo record for this config 0N/A "GLXGraphicsConfig_getGLXConfigInfo: could not allocate memory for glxinfo");
0N/A#
endif /* !HEADLESS */ 0N/A "GLXGraphicsConfigInfo data missing");
0N/A#
endif /* !HEADLESS */ 0N/A#
endif /* !HEADLESS */