diff mbox

[v2,1/3] package/sdl2: enable opengl support

Message ID 20170225133600.15637-1-romain.naour@gmail.com
State Superseded
Headers show

Commit Message

Romain Naour Feb. 25, 2017, 1:35 p.m. UTC
OpenGl support mean GLX so it require X11 support.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
v2: no change
---
 package/sdl2/Config.in | 8 ++++++++
 package/sdl2/sdl2.mk   | 8 +++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Feb. 26, 2017, 1:57 p.m. UTC | #1
Hello,

On Sat, 25 Feb 2017 14:35:58 +0100, Romain Naour wrote:

> +config BR2_PACKAGE_SDL2_OPENGL
> +	bool "OpenGL (GLX)"
> +	depends on BR2_PACKAGE_HAS_LIBGL
> +	depends on BR2_PACKAGE_XORG7

Are you sure this doesn't need BR2_PACKAGE_SDL2_X11 ? I.e what happens
if you build SDL2 with BR2_PACKAGE_SDL2_OPENGL=y but
BR2_PACKAGE_SDL2_X11 disabled ?

> +ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y)
> +SDL2_CONF_OPTS += --enable-video-opengl
> +SDL2_DEPENDENCIES += libgl

Also, is libgl sufficient here? What happens if you select
nvidia-driver as the OpenGL provider for example? It doesn't depend on
any X.org package, so are you sure by the time SDL2 runs its configure
script, enough things have been built?

Can you verify by enabling nvidia-driver, and then running "make sdl2" ?

Thanks,

Thomas
Romain Naour Feb. 26, 2017, 3:32 p.m. UTC | #2
Hi Thomas, All,

Le 26/02/2017 à 14:57, Thomas Petazzoni a écrit :
> Hello,
> 
> On Sat, 25 Feb 2017 14:35:58 +0100, Romain Naour wrote:
> 
>> +config BR2_PACKAGE_SDL2_OPENGL
>> +	bool "OpenGL (GLX)"
>> +	depends on BR2_PACKAGE_HAS_LIBGL
>> +	depends on BR2_PACKAGE_XORG7
> 
> Are you sure this doesn't need BR2_PACKAGE_SDL2_X11 ? I.e what happens
> if you build SDL2 with BR2_PACKAGE_SDL2_OPENGL=y but
> BR2_PACKAGE_SDL2_X11 disabled ?

OpenGL (GLX) option only check for the following headers:
#include <GL/gl.h>
#include <GL/glx.h>

So, SDL2 build fine even without BR2_PACKAGE_SDL2_X11.
However you're probably right since GLX mean OpenGL with X11 support and
selecting BR2_PACKAGE_SDL2_X11 allow to enable additional X11 libraries support.
I'll add a select BR2_PACKAGE_SDL2_X11 since it was enabled for my runtime test.

> 
>> +ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y)
>> +SDL2_CONF_OPTS += --enable-video-opengl
>> +SDL2_DEPENDENCIES += libgl
> 
> Also, is libgl sufficient here? What happens if you select
> nvidia-driver as the OpenGL provider for example? It doesn't depend on
> any X.org package, so are you sure by the time SDL2 runs its configure
> script, enough things have been built?

nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y,
so the libgl provider select a minimal set of X11 libraries that are already
build when sdl2 build start.
This is also the case when mesa3d is used as libgl provider.

> 
> Can you verify by enabling nvidia-driver, and then running "make sdl2" ?

I tried with this deconfig fragment a sdl2 build fine.

BR2_PACKAGE_SDL2=y
BR2_PACKAGE_SDL2_OPENGL=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XSERVER_XORG_SERVER=y
BR2_PACKAGE_NVIDIA_DRIVER=y

Best regards,
Romain

> 
> Thanks,
> 
> Thomas
>
Thomas Petazzoni Feb. 26, 2017, 3:54 p.m. UTC | #3
Hello,

On Sun, 26 Feb 2017 16:32:40 +0100, Romain Naour wrote:

> So, SDL2 build fine even without BR2_PACKAGE_SDL2_X11.
> However you're probably right since GLX mean OpenGL with X11 support and
> selecting BR2_PACKAGE_SDL2_X11 allow to enable additional X11 libraries support.
> I'll add a select BR2_PACKAGE_SDL2_X11 since it was enabled for my runtime test.

OK.

> > Also, is libgl sufficient here? What happens if you select
> > nvidia-driver as the OpenGL provider for example? It doesn't depend on
> > any X.org package, so are you sure by the time SDL2 runs its configure
> > script, enough things have been built?  
> 
> nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y,
> so the libgl provider select a minimal set of X11 libraries that are already
> build when sdl2 build start.

Selects yes, but it doesn't not have a <pkg>_DEPENDENCIES on them, so
you are not guaranteed they are available before sdl2 is built.

Obvisouly, if BR2_PACKAGE_SDL2_X11 is now selected by
BR2_PACKAGE_SDL2_OPENGL, then you're sure the X11 libs will be built
before sdl2.

Thanks!

Thomas
Romain Naour Feb. 26, 2017, 4:29 p.m. UTC | #4
Hi Thomas, All,

Le 26/02/2017 à 16:54, Thomas Petazzoni a écrit :
> Hello,
> 
> On Sun, 26 Feb 2017 16:32:40 +0100, Romain Naour wrote:
> 
>> So, SDL2 build fine even without BR2_PACKAGE_SDL2_X11.
>> However you're probably right since GLX mean OpenGL with X11 support and
>> selecting BR2_PACKAGE_SDL2_X11 allow to enable additional X11 libraries support.
>> I'll add a select BR2_PACKAGE_SDL2_X11 since it was enabled for my runtime test.
> 
> OK.
> 
>>> Also, is libgl sufficient here? What happens if you select
>>> nvidia-driver as the OpenGL provider for example? It doesn't depend on
>>> any X.org package, so are you sure by the time SDL2 runs its configure
>>> script, enough things have been built?  
>>
>> nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y,
>> so the libgl provider select a minimal set of X11 libraries that are already
>> build when sdl2 build start.
> 
> Selects yes, but it doesn't not have a <pkg>_DEPENDENCIES on them, so
> you are not guaranteed they are available before sdl2 is built.

Haa indeed...

For mesa3d case, we can this minimal set of x11 libraries ...

MESA3D_DEPENDENCIES += \
	xproto_xf86driproto \
	xproto_dri2proto \
	xproto_glproto \
	xlib_libX11 \
	xlib_libXext \
	xlib_libXdamage \
	xlib_libXfixes \
	libxcb

... but for nvidia there is none.
However, it doesn't seems to be a problem for sdl2 (at least at build time).

I'll resend the series.

Best regards,
Romain

> 
> Obvisouly, if BR2_PACKAGE_SDL2_X11 is now selected by
> BR2_PACKAGE_SDL2_OPENGL, then you're sure the X11 libs will be built
> before sdl2.
> 
> Thanks!
> 
> Thomas
>
diff mbox

Patch

diff --git a/package/sdl2/Config.in b/package/sdl2/Config.in
index 8fc14ee..25704f3 100644
--- a/package/sdl2/Config.in
+++ b/package/sdl2/Config.in
@@ -29,6 +29,14 @@  comment "X11 video driver needs X.org"
 	depends on !BR2_PACKAGE_XORG7
 	depends on BR2_USE_MMU
 
+config BR2_PACKAGE_SDL2_OPENGL
+	bool "OpenGL (GLX)"
+	depends on BR2_PACKAGE_HAS_LIBGL
+	depends on BR2_PACKAGE_XORG7
+
+comment "OpenGL support needs X11 and an OpenGL provider"
+	depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_XORG7
+
 endif
 
 comment "sdl2 needs a toolchain w/ dynamic library"
diff --git a/package/sdl2/sdl2.mk b/package/sdl2/sdl2.mk
index 2ec12e6..3f210f8 100644
--- a/package/sdl2/sdl2.mk
+++ b/package/sdl2/sdl2.mk
@@ -18,7 +18,6 @@  SDL2_CONF_OPTS += \
 	--disable-esd \
 	--disable-dbus \
 	--disable-pulseaudio \
-	--disable-video-opengl \
 	--disable-video-opengles \
 	--disable-video-wayland
 
@@ -99,6 +98,13 @@  else
 SDL2_CONF_OPTS += --disable-video-x11 --without-x
 endif
 
+ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y)
+SDL2_CONF_OPTS += --enable-video-opengl
+SDL2_DEPENDENCIES += libgl
+else
+SDL2_CONF_OPTS += --disable-video-opengl
+endif
+
 ifeq ($(BR2_PACKAGE_TSLIB),y)
 SDL2_DEPENDENCIES += tslib
 SDL2_CONF_OPTS += --enable-input-tslib