Exemple #1
0
bool
piglit_is_glx_extension_supported(Display *dpy, const char *name)
{
	int screen = DefaultScreen(dpy);
	const char *const glx_extension_list =
		glXQueryExtensionsString(dpy, screen);

	return piglit_is_extension_in_string(glx_extension_list, name);
}
Exemple #2
0
bool
piglit_cl_is_device_extension_supported(cl_device_id device, const char *name)
{
	char* extensions = piglit_cl_get_device_info(device, CL_DEVICE_EXTENSIONS);
	bool supported = piglit_is_extension_in_string(extensions, name);

	free(extensions);

	return supported;
}
Exemple #3
0
bool
piglit_cl_is_platform_extension_supported(cl_platform_id platform,
                                          const char *name)
{
	char* extensions = piglit_cl_get_platform_info(platform,
	                                               CL_PLATFORM_EXTENSIONS);
	bool supported = piglit_is_extension_in_string(extensions, name);

	free(extensions);

	return supported;
}
/**
 * Conformance test #1 in the EGL_EXT_client_extensions spec:
 *
 *     1. Before any call to eglGetDisplay, call `eglQueryString(EGL_NO_DISPLAY,
 *        EGL_EXTENSIONS)`. Verify that either
 *
 *          a. The call returns NULL and generates EGL_BAD_DISPLAY.
 *          b. The call returns an extension string that contains, at a minimum,
 *             this extension and generates no error.
 */
static void
test_1(void)
{
	enum piglit_result result = PIGLIT_PASS;
	const char *client_extensions;

	printf("Making process's first EGL call, "
	       "eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS) ...\n");
	client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);

	if (client_extensions == NULL) {
		printf("Returned NULL\n");
		if (piglit_check_egl_error(EGL_BAD_DISPLAY)) {
			printf("And correctly emitted EGL_BAD_DISPLAY\n");
		} else {
			printf("But did not emit EGL_BAD_DISPLAY\n");
			result = PIGLIT_FAIL;
		}
	} else {
		printf("Returned a non-null extension string\n");

		if (!piglit_check_egl_error(EGL_SUCCESS)) {
			result = PIGLIT_FAIL;
		}

		if (!piglit_is_extension_in_string(client_extensions,
						   "EGL_EXT_client_extensions")) {
			printf("But it does not contain "
			       "EGL_EXT_client_extensions\n");
			result = PIGLIT_FAIL;
		} else {
			printf("And contains EGL_EXT_client_extensions "
			       "as expected\n");
		}
	}

	piglit_report_result(result);
}
Exemple #5
0
void GLX_EXT_import_context_setup(void)
{
	const char *const names[] = {
		"glXGetCurrentDisplayEXT",
		"glXQueryContextInfoEXT",
		"glXGetContextIDEXT",
		"glXImportContextEXT",
		"glXFreeContextEXT"
	};

	__GLXextFuncPtr *procedures[ARRAY_SIZE(names)] = {
		(__GLXextFuncPtr *) & __piglit_glXGetCurrentDisplayEXT,
		(__GLXextFuncPtr *) & __piglit_glXQueryContextInfoEXT,
		(__GLXextFuncPtr *) & __piglit_glXGetContextIDEXT,
		(__GLXextFuncPtr *) & __piglit_glXImportContextEXT,
		(__GLXextFuncPtr *) & __piglit_glXFreeContextEXT
	};

	const char *vendor;

	dpy = piglit_get_glx_display();

	/* NVIDIA incorrectly only list the extension in the client
	 * extenstions list.  If the extension is available for applications
	 * to use, it is supposed to be included in the list returned by
	 * glXQueryExtensionsString.
	 *
	 * The glXImportContextEXT manual page is somewhat clear on this
	 * topic:
	 *
	 *     "If _glxextstring(EXT_import_context) is included in the string
	 *     returned by glXQueryExtensionsString, when called with argument
	 *     GLX_EXTENSIONS, extension EXT_import_context is supported."
	 *
	 * The text is a little weird because the only parameters to
	 * glXQueryExtensionsString are the display and the screen.
	 */
	vendor = glXGetClientString(dpy, GLX_VENDOR);
	if (strcmp("NVIDIA Corporation", vendor) == 0) {
		const char *const client_extensions =
			glXGetClientString(dpy, GLX_EXTENSIONS);

		if (!piglit_is_extension_in_string(client_extensions,
						   "GLX_EXT_import_context")) {
			fprintf(stderr,
				"Test requires GLX_EXT_import_context.\n");
			piglit_report_result(PIGLIT_SKIP);
		}
	} else {
		piglit_require_glx_extension(dpy, "GLX_EXT_import_context");
	}

	piglit_glx_get_all_proc_addresses(procedures, names, ARRAY_SIZE(names));

	visinfo = piglit_get_glx_visual(dpy);

	directCtx = glXCreateContext(dpy, visinfo, NULL, True);
	if (directCtx == NULL) {
		fprintf(stderr,
			"Could not create initial direct-rendering context.\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	if (!glXIsDirect(dpy, directCtx)) {
		glXDestroyContext(dpy, directCtx);
		directCtx = NULL;
	}

	indirectCtx = glXCreateContext(dpy, visinfo, NULL, False);
	if (indirectCtx == NULL) {
		fprintf(stderr,
			"Could not create initial indirect-rendering "
			"context.\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	piglit_glx_get_error(dpy, NULL);
	old_handler = XSetErrorHandler(x_error_handler);
}
int
main(void)
{
	enum piglit_result result = PIGLIT_PASS;
	EGLint i, numdevs;
	EGLDeviceEXT devs[NDEVS];
	PFNEGLQUERYDEVICESEXTPROC queryDevices;

	const char *client_exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
	bool has_client_ext =
		client_exts &&
		((piglit_is_extension_in_string(client_exts,
			"EGL_EXT_device_query") &&
		  piglit_is_extension_in_string(client_exts,
			"EGL_EXT_device_enumeration")) ||
		 piglit_is_extension_in_string(client_exts,
			"EGL_EXT_device_base"));

	if (!has_client_ext) {
		printf("EGL_EXT_device_enumeration not supported\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	queryDevices = (void *)eglGetProcAddress("eglQueryDevicesEXT");

	if (!queryDevices) {
		printf("No device query entrypoint\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	if (!queryDevices(0, NULL, &numdevs)) {
		printf("Failed to get device count\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	if (numdevs < 1) {
		printf("No devices supported\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	if (numdevs > NDEVS) {
		printf("More than %d devices, please fix this test\n", NDEVS);
		result = PIGLIT_WARN;
		numdevs = NDEVS;
	}

	memset(devs, 0, sizeof devs);
	if (!queryDevices(numdevs, devs, &numdevs)) {
		printf("Failed to enumerate devices\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	for (i = 0; i < numdevs; i++)
	    if (devs[i] == NULL) {
		printf("Enumerated device slot not initialized\n");
		piglit_report_result(PIGLIT_FAIL);
	    }

	for (i = numdevs; i < ARRAY_SIZE(devs); i++)
	    if (devs[i] != NULL) {
		printf("Non-enumerated device slot initialized\n");
		piglit_report_result(PIGLIT_FAIL);
	    }

	queryDevices(0, devs, &numdevs);
	if (!piglit_check_egl_error(EGL_BAD_PARAMETER))
		piglit_report_result(PIGLIT_FAIL);

	queryDevices(-1, devs, &numdevs);
	if (!piglit_check_egl_error(EGL_BAD_PARAMETER))
		piglit_report_result(PIGLIT_FAIL);

	queryDevices(ARRAY_SIZE(devs), devs, NULL);
	if (!piglit_check_egl_error(EGL_BAD_PARAMETER))
		piglit_report_result(PIGLIT_FAIL);

	piglit_report_result(result);
}
Exemple #7
0
/**
 * Generated code calls this function to determine whether a given
 * extension is supported.
 */
static inline bool
check_extension(const char *name)
{
	return piglit_is_extension_in_string(gl_extensions, name);
}