comment "img-gpu-powervr needs a glibc toolchain"
	depends on BR2_riscv
	depends on !BR2_TOOLCHAIN_USES_GLIBC

config BR2_PACKAGE_IMG_GPU_POWERVR
	bool "img-gpu-powervr"
	# Pre-built binaries only available for RISCV
	depends on BR2_riscv
	# Library binaries are linked against libc.so.6
	depends on BR2_TOOLCHAIN_USES_GLIBC
	# Library binaries are linked against libdrm.so.2, except framebuffer
	# output on RISCV
	select BR2_PACKAGE_LIBDRM if !(BR2_riscv && BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_FB)
	select BR2_PACKAGE_HAS_LIBEGL
	select BR2_PACKAGE_HAS_LIBGLES
	select BR2_PACKAGE_HAS_LIBOPENCL
	select BR2_PACKAGE_HAS_LIBVULKAN
	select BR2_PACKAGE_MESA3D
	select BR2_PACKAGE_MESA3D_OPENGL_EGL
	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PVR
	help
	  Userspace libraries for Imagination PowerGPU GPU on StarFive platforms

	  It contains libraries and headers for GLES, OpenCL, and
	  Vulkan. It also contains a DRI plugin for X11. It also
	  contains a plugin for DirectFB-1.4.0.

	  This library is provided by StarFive as-is and doesn't have
	  an upstream.

if BR2_PACKAGE_IMG_GPU_POWERVR

choice
	prompt "Output option"
	help
	  There are two versions of this library: one for
	  direct framebuffer access, one for X11 rendering.
	  Choose here which version to install.

config BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_X11
	bool "X11"
	depends on BR2_PACKAGE_XORG7
	# The i.MX8 blob doesn't support X11 output
	depends on !BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
	select BR2_PACKAGE_XLIB_LIBXDAMAGE
	select BR2_PACKAGE_XLIB_LIBXEXT
	select BR2_PACKAGE_XLIB_LIBXFIXES

comment "X11 backend needs Xorg package"
	depends on !BR2_PACKAGE_XORG7

config BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_FB
	bool "Framebuffer"

config BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_WL
	bool "Wayland"
	select BR2_PACKAGE_WAYLAND
	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND

endchoice

config BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT
	string
	default "x11" if BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_X11
	default "fb" if BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_FB
	default "wayland" if BR2_PACKAGE_IMG_GPU_POWERVR_OUTPUT_WL

config BR2_PACKAGE_PROVIDES_LIBEGL
	default "img-gpu-powervr"

config BR2_PACKAGE_PROVIDES_LIBGLES
	default "img-gpu-powervr"

config BR2_PACKAGE_PROVIDES_LIBOPENCL
	default "img-gpu-powervr"

config BR2_PACKAGE_PROVIDES_LIBVULKAN
	default "img-gpu-powervr"

config BR2_PACKAGE_IMG_GPU_POWERVR_EXAMPLES
	bool "install examples"
	depends on BR2_INSTALL_LIBSTDCPP
	help
	  Copy the PowerVR examples to the target.

	  Warning: examples take approximately 150 MB of disk space.

comment "img-gpu-powervr-examples need a toolchain w/ C++ support"
	depends on !BR2_INSTALL_LIBSTDCPP

config BR2_PACKAGE_IMG_GPU_POWERVR_GMEM_INFO
	bool "install gmem_info tool"
	help
	  Copy the gmem_info tool to the target which provides
	  information about GPU memory consumption.

endif
