static jfieldID getExecServiceField (JNIEnv* env, jobject obj)
{
	jclass cls = env->GetObjectClass(obj);
	TCU_CHECK_INTERNAL(cls);

	jfieldID fid = env->GetFieldID(cls, "m_server", "J");
	TCU_CHECK_INTERNAL(fid);

	return fid;
}
DE_BEGIN_EXTERN_C

JNIEXPORT void JNICALL Java_com_drawelements_deqp_execserver_ExecService_onCreateNative (JNIEnv* env, jobject obj)
{
	tcu::Android::ExecService*	service		= DE_NULL;
	JavaVM*						vm			= DE_NULL;

	try
	{
		DE_ASSERT(!getExecService(env, obj));

		env->GetJavaVM(&vm);
		TCU_CHECK_INTERNAL(vm);

		service = new tcu::Android::ExecService(vm, obj);
		service->start();

		setExecService(env, obj, service);
	}
	catch (const std::exception& e)
	{
		logException(e);
		delete service;
		tcu::die("ExecService.onCreateNative() failed");
	}
}
Ejemplo n.º 3
0
Window::Window (Display& display, int width, int height, ::Visual* visual)
	: m_display		(display)
	, m_colormap	(None)
	, m_window		(None)
	, m_visible		(false)
{
	XSetWindowAttributes	swa;
	::Display* const		dpy					= m_display.getXDisplay();
	::Window				root				= DefaultRootWindow(dpy);
	unsigned long			mask				= CWBorderPixel | CWEventMask;

	// If redirect is enabled, window size can't be guaranteed and it is up to
	// the window manager to decide whether to honor sizing requests. However,
	// overriding that causes window to appear as an overlay, which causes
	// other issues, so this is disabled by default.
	const bool				overrideRedirect	= false;

	if (overrideRedirect)
	{
		mask |= CWOverrideRedirect;
		swa.override_redirect = true;
	}

	if (visual == DE_NULL)
		visual = CopyFromParent;
	else
	{
		XVisualInfo	info	= XVisualInfo();
		bool		succ	= display.getVisualInfo(XVisualIDFromVisual(visual), info);

		TCU_CHECK_INTERNAL(succ);

		root				= RootWindow(dpy, info.screen);
		m_colormap			= XCreateColormap(dpy, root, visual, AllocNone);
		swa.colormap		= m_colormap;
		mask |= CWColormap;
	}

	swa.border_pixel	= 0;
	swa.event_mask		= ExposureMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask;

	if (width == glu::RenderConfig::DONT_CARE)
		width = DEFAULT_WINDOW_WIDTH;
	if (height == glu::RenderConfig::DONT_CARE)
		height = DEFAULT_WINDOW_HEIGHT;

	m_window = XCreateWindow(dpy, root, 0, 0, width, height, 0,
							 CopyFromParent, InputOutput, visual, mask, &swa);
	TCU_CHECK(m_window);

	Atom deleteAtom = m_display.getDeleteAtom();
	XSetWMProtocols(dpy, m_window, &deleteAtom, 1);
}
Window::Window (Display& display, int width, int height, ::Visual* visual)
	: m_display		(display)
	, m_colormap	(None)
	, m_window		(None)
	, m_visible		(false)
{
	XSetWindowAttributes	swa;
	::Display*				dpy	= m_display.getXDisplay();
	::Window				root = DefaultRootWindow(dpy);
	unsigned long			mask = CWBorderPixel | CWEventMask;

	if (visual == DE_NULL)
		visual = CopyFromParent;
	else
	{
		XVisualInfo	info	= XVisualInfo();
		bool		succ	= display.getVisualInfo(XVisualIDFromVisual(visual), info);

		TCU_CHECK_INTERNAL(succ);

		root				= RootWindow(dpy, info.screen);
		m_colormap			= XCreateColormap(dpy, root, visual, AllocNone);
		swa.colormap		= m_colormap;
		mask |= CWColormap;
	}

	swa.border_pixel	= 0;
	swa.event_mask		= ExposureMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask;

	mask |= CWOverrideRedirect;
	swa.override_redirect = true;

	if (width == glu::RenderConfig::DONT_CARE)
		width = DEFAULT_WINDOW_WIDTH;
	if (height == glu::RenderConfig::DONT_CARE)
		height = DEFAULT_WINDOW_HEIGHT;

	m_window = XCreateWindow(dpy, root, 0, 0, width, height, 0,
							 CopyFromParent, InputOutput, visual, mask, &swa);
	TCU_CHECK(m_window);

	Atom deleteAtom = m_display.getDeleteAtom();
	XSetWMProtocols(dpy, m_window, &deleteAtom, 1);

}
JNIEXPORT void JNICALL Java_com_drawelements_deqp_execserver_ExecService_onDestroyNative (JNIEnv* env, jobject obj)
{
	try
	{
		tcu::Android::ExecService* service = getExecService(env, obj);
		TCU_CHECK_INTERNAL(service);

		service->stop();
		delete service;

		setExecService(env, obj, DE_NULL);
	}
	catch (const std::exception& e)
	{
		logException(e);
		tcu::die("ExecService.onDestroyNative() failed");
	}
}
void* NativeDisplay::getPlatformNative (void)
{
	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetPlatformDisplay()", DE_NULL, __FILE__, __LINE__);
}
EGLNativeDisplayType NativeDisplay::getLegacyNative (void)
{
	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_LEGACY) == 0);
	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetDisplay()", DE_NULL, __FILE__, __LINE__);
}
void NativePixmap::readPixels (tcu::TextureLevel*)
{
	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_READ_PIXELS) == 0);
	throw tcu::NotSupportedError("eglu::NativePixmap doesn't support readPixels", DE_NULL, __FILE__, __LINE__);
}
void* NativePixmap::getPlatformNative (void)
{
	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0);
	throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePlatformPixmapSurface()", DE_NULL, __FILE__, __LINE__);
}
EGLNativePixmapType NativePixmap::getLegacyNative (void)
{
	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_LEGACY) == 0);
	throw tcu::NotSupportedError("eglu::NativePixmap doesn't support eglCreatePixmapSurface()", DE_NULL, __FILE__, __LINE__);
}