diff mbox

[v5,07/15] xdriver_xf86-video-imx-viv: new package

Message ID 1418132813-32642-8-git-send-email-jezz@sysmic.org
State Superseded
Headers show

Commit Message

Jérôme Pouiller Dec. 9, 2014, 1:46 p.m. UTC
Xorg driver for imx6. Inspired from Yocto project.

I did not find any problem, but notice Yocto project force Xorg xserver
1.14.4 while we use 1.16.

Notice Vivante driver should be able to provide Desktop OpenGL implementation.
However, this feature seems broken for a while[1]. Yocto use Mesa3D/swraster
to provide Desktop OpenGL API[2].

[1] http://comments.gmane.org/gmane.linux.embedded.yocto.meta-freescale/8253
[2] See recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.10.17-1.0.1.bb
    in meta-fsl-arm layer

Tested with:
    subsequent qt5base and libdrm fixes +
    QMX6 board +
    BR2_ARM_EABIHF= both tested
    BR2_ARM_ENABLE_NEON=y
    BR2_ARM_FPU_NEON=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
    BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
    BR2_LINUX_KERNEL=y
    BR2_LINUX_KERNEL_CUSTOM_GIT=y
    BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://git.congatec.com/arm/qmx6_kernel.git"
    BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="9bafbcba67f7bb2a48a5e05998cecb1165aa444f"
    BR2_LINUX_KERNEL_DEFCONFIG="qmx6"
    BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x10008000"
    BR2_LINUX_KERNEL_DTS_SUPPORT=y
    BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-qmx6"
    BR2_PACKAGE_QT5=y
    BR2_PACKAGE_QT5BASE_LICENSE_APPROVED=y
    BR2_PACKAGE_QT5BASE_EXAMPLES=y
    BR2_PACKAGE_QT5BASE_OPENGL_ES2=y
    BR2_PACKAGE_QT5BASE_OPENGL_LIB=y
    BR2_PACKAGE_QT5BASE_XCB=y
    BR2_PACKAGE_QT5BASE_DEFAULT_QPA="xcb"
    BR2_PACKAGE_QT5BASE_GIF=y
    BR2_PACKAGE_QT5BASE_JPEG=y
    BR2_PACKAGE_QT5BASE_PNG=y
    BR2_PACKAGE_QT5QUICKCONTROLS=y
    BR2_PACKAGE_XORG7=y
    BR2_PACKAGE_XSERVER_XORG_SERVER=y
    BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR=y
    BR2_PACKAGE_XDRIVER_XF86_INPUT_EVDEV=y
    BR2_PACKAGE_XDRIVER_XF86_VIDEO_IMX_VIV=y
    BR2_PACKAGE_FREESCALE_IMX=y
    BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q=y
    BR2_PACKAGE_GPU_VIV_BIN_MX6Q=y
    BR2_PACKAGE_GPU_VIV_BIN_MX6Q_EXAMPLES=y

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
---
 package/x11r7/Config.in                            |  1 +
 .../0001-Fix-LoadExtenions.patch                   | 15 ++++++++++
 package/x11r7/xdriver_xf86-video-imx-viv/Config.in | 31 +++++++++++++++++++++
 .../xdriver_xf86-video-imx-viv.mk                  | 32 ++++++++++++++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 package/x11r7/xdriver_xf86-video-imx-viv/0001-Fix-LoadExtenions.patch
 create mode 100644 package/x11r7/xdriver_xf86-video-imx-viv/Config.in
 create mode 100644 package/x11r7/xdriver_xf86-video-imx-viv/xdriver_xf86-video-imx-viv.mk

Comments

Thomas Petazzoni Dec. 27, 2014, 8:43 p.m. UTC | #1
Dear Jérôme Pouiller,

On Tue,  9 Dec 2014 14:46:45 +0100, Jérôme Pouiller wrote:

> diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/Config.in b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
> new file mode 100644
> index 0000000..d91ba79
> --- /dev/null
> +++ b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
> @@ -0,0 +1,31 @@
> +

Unneeded empty line.

> +config BR2_PACKAGE_XDRIVER_XF86_VIDEO_IMX_VIV
> +	bool "xf86-video-imx-viv"
> +	depends on BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11
> +	select BR2_PACKAGE_MESA3D # Needed in order to compile xorg with glx/dri
> +	select BR2_PACKAGE_MESA3D_DRI_DRIVER

The world of OpenGL stuff will always surprise me. Why on earth does a
X.org driver that uses a proprietary OpenGL implementation needs
Mesa3D ?!?

> +	  Notice EGL and GLes2 APIs are correctly supported. This driver should
> +	  also be able to provide Desktop OpenGL implementation but, this 
> +	  feature seems broken for a while.

"for a while" -> "since quite some time".

> +	  Don't forget to load galcore.ko and create /dev/galcore before to
> +	  use this driver (else, Xorg will exit with an obscur message

"to use" -> using.

obscur -> obscure.

> +	  like "Segmentation fault at address 0xc").
> +
> +comment "xf86-video-imx-viv depends on gpu-viv-bin-mx6q with X11 output"
> +	depends on BR2_arm
> +	depends on (!BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11)

Unneeded parenthesis.

> +XDRIVER_XF86_VIDEO_IMX_VIV_INSTALL_STAGING = YES
> +XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD = $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D)/EXA/src -f makefile.linux
> +
> +define XDRIVER_XF86_VIDEO_IMX_VIV_BUILD_CMDS
> +	$(XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD) sysroot=$(STAGING_DIR) \
> +		BUSID_HAS_NUMBER=1 BUILD_IN_YOCTO=1 XSERVER_GREATER_THAN_13=1 \
> +		CFLAGS+="$(TARGET_CFLAGS) -I$(@D)/DRI_1.10.4/src"

Why += here? I don't think it has any effect.

Also, can you add _LICENSE and _LICENSE_FILES information?

Care to fixup those minor issues and resend?

Thanks!

Thomas
Jérôme Pouiller Jan. 16, 2015, 4:04 p.m. UTC | #2
Hello Thomas,

On Saturday 27 December 2014 21:43:25 Thomas Petazzoni wrote:
> Dear Jérôme Pouiller,
> 
> On Tue,  9 Dec 2014 14:46:45 +0100, Jérôme Pouiller wrote:
> 
> > diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/Config.in 
b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
> > new file mode 100644
> > index 0000000..d91ba79
> > --- /dev/null
> > +++ b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
> > @@ -0,0 +1,31 @@
> > +
> 
> Unneeded empty line.
> 
> > +config BR2_PACKAGE_XDRIVER_XF86_VIDEO_IMX_VIV
> > +	bool "xf86-video-imx-viv"
> > +	depends on BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11
> > +	select BR2_PACKAGE_MESA3D # Needed in order to compile xorg with 
glx/dri
> > +	select BR2_PACKAGE_MESA3D_DRI_DRIVER
> 
> The world of OpenGL stuff will always surprise me. Why on earth does a
> X.org driver that uses a proprietary OpenGL implementation needs
> Mesa3D ?!?

In fact, xf86-video-imx-viv does not depends directly on mesa3d. However, it 
depend on xorg server compiled with --enable-dri --enable-glx. But, these 
options are enabled only if BR2_PACKAGE_MESA3D_DRI_DRIVER is enabled.



Else, I am going to send an updated version of this patch this evening.
Thomas Petazzoni Jan. 16, 2015, 4:15 p.m. UTC | #3
Dear Jérôme Pouiller,

On Fri, 16 Jan 2015 17:04:20 +0100, Jérôme Pouiller wrote:

> > The world of OpenGL stuff will always surprise me. Why on earth does a
> > X.org driver that uses a proprietary OpenGL implementation needs
> > Mesa3D ?!?
> 
> In fact, xf86-video-imx-viv does not depends directly on mesa3d. However, it 
> depend on xorg server compiled with --enable-dri --enable-glx. But, these 
> options are enabled only if BR2_PACKAGE_MESA3D_DRI_DRIVER is enabled.

Maybe this should be changed, so that other drivers can enable it,
without referencing Mesa related options, no?

Also, the code in the xserver package does:

ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
XSERVER_XORG_SERVER_CONF_OPTS += --enable-dri --enable-glx
XSERVER_XORG_SERVER_DEPENDENCIES += mesa3d xproto_xf86driproto
else
XSERVER_XORG_SERVER_CONF_OPTS += --disable-dri --disable-glx
endif

So it really builds mesa as well. Is this needed ?

Can you clarify this, maybe talking with Bernd?

Thanks,

Thomas
Jérôme Pouiller Jan. 17, 2015, 12:11 a.m. UTC | #4
On Friday 16 January 2015 17:15:33 Thomas Petazzoni wrote:
> Dear Jérôme Pouiller,
> 
> On Fri, 16 Jan 2015 17:04:20 +0100, Jérôme Pouiller wrote:
> 
> > > The world of OpenGL stuff will always surprise me. Why on earth does a
> > > X.org driver that uses a proprietary OpenGL implementation needs
> > > Mesa3D ?!?
> > 
> > In fact, xf86-video-imx-viv does not depends directly on mesa3d. However, it 
> > depend on xorg server compiled with --enable-dri --enable-glx. But, these 
> > options are enabled only if BR2_PACKAGE_MESA3D_DRI_DRIVER is enabled.
> 
> Maybe this should be changed, so that other drivers can enable it,
> without referencing Mesa related options, no?
> 
> Also, the code in the xserver package does:
> 
> ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
> XSERVER_XORG_SERVER_CONF_OPTS += --enable-dri --enable-glx
> XSERVER_XORG_SERVER_DEPENDENCIES += mesa3d xproto_xf86driproto
> else
> XSERVER_XORG_SERVER_CONF_OPTS += --disable-dri --disable-glx
> endif
> 
> So it really builds mesa as well. Is this needed ?
We cannot use gpu-viv-bin-mx6q to compile Xorg with DRI and GLX since 
it does not provide all necessary files. Especially, OpenGL headers 
(GL/gl.h, GL/glx.h, ...) are missing[1]. We may solve this issue using
"opengl-registry" posted by Yann a few months ago. It may be 
sufficient.

Note that the current implementation is same than the one used in Yocto
and it is officially supported by Freescale. (I do not say it is the
right way, but it is a sufficient justification for many users)


[1] https://community.freescale.com/thread/312546
Yann E. MORIN Jan. 19, 2015, 10:20 p.m. UTC | #5
Jérôme, All,

On 2015-01-17 01:11 +0100, Jérôme Pouiller spake thusly:
> On Friday 16 January 2015 17:15:33 Thomas Petazzoni wrote:
> > Dear Jérôme Pouiller,
> > 
> > On Fri, 16 Jan 2015 17:04:20 +0100, Jérôme Pouiller wrote:
> > 
> > > > The world of OpenGL stuff will always surprise me. Why on earth does a
> > > > X.org driver that uses a proprietary OpenGL implementation needs
> > > > Mesa3D ?!?
> > > 
> > > In fact, xf86-video-imx-viv does not depends directly on mesa3d. However, it 
> > > depend on xorg server compiled with --enable-dri --enable-glx. But, these 
> > > options are enabled only if BR2_PACKAGE_MESA3D_DRI_DRIVER is enabled.
> > 
> > Maybe this should be changed, so that other drivers can enable it,
> > without referencing Mesa related options, no?
> > 
> > Also, the code in the xserver package does:
> > 
> > ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
> > XSERVER_XORG_SERVER_CONF_OPTS += --enable-dri --enable-glx
> > XSERVER_XORG_SERVER_DEPENDENCIES += mesa3d xproto_xf86driproto
> > else
> > XSERVER_XORG_SERVER_CONF_OPTS += --disable-dri --disable-glx
> > endif
> > 
> > So it really builds mesa as well. Is this needed ?
> We cannot use gpu-viv-bin-mx6q to compile Xorg with DRI and GLX since 
> it does not provide all necessary files. Especially, OpenGL headers 
> (GL/gl.h, GL/glx.h, ...) are missing[1]. We may solve this issue using
> "opengl-registry" posted by Yann a few months ago. It may be 
> sufficient.

For the records, I've posted an updated series:
    http://lists.busybox.net/pipermail/buildroot/2015-January/117642.html

Care to see if it is posible to update your series to use the Khronos
registry/ies? If so, it would great if you could review/ack the patches
so they get applied soon, so you can in turn repost an updated series of
yours! ;-)

/me is trying to get some reviewers interested! Muhahaha! ;-)

Regards,
Yann E. MORIN.

> Note that the current implementation is same than the one used in Yocto
> and it is officially supported by Freescale. (I do not say it is the
> right way, but it is a sufficient justification for many users)
> 
> 
> [1] https://community.freescale.com/thread/312546
> 
> -- 
> Jérôme Pouiller, Sysmic
> Embedded Linux specialist
> http://www.sysmic.fr
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Jérôme Pouiller Jan. 21, 2015, 8:41 a.m. UTC | #6
Hello All,

On Monday 19 January 2015 23:20:43 Yann E. MORIN wrote:
> Jérôme, All,
> 
> On 2015-01-17 01:11 +0100, Jérôme Pouiller spake thusly:
> > On Friday 16 January 2015 17:15:33 Thomas Petazzoni wrote:
> > > Dear Jérôme Pouiller,
> > > 
> > > On Fri, 16 Jan 2015 17:04:20 +0100, Jérôme Pouiller wrote:
> > > 
> > > > > The world of OpenGL stuff will always surprise me. Why on earth does a
> > > > > X.org driver that uses a proprietary OpenGL implementation needs
> > > > > Mesa3D ?!?
> > > > 
> > > > In fact, xf86-video-imx-viv does not depends directly on mesa3d. However, it 
> > > > depend on xorg server compiled with --enable-dri --enable-glx. But, these 
> > > > options are enabled only if BR2_PACKAGE_MESA3D_DRI_DRIVER is enabled.
> > > 
> > > Maybe this should be changed, so that other drivers can enable it,
> > > without referencing Mesa related options, no?
> > > 
> > > Also, the code in the xserver package does:
> > > 
> > > ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
> > > XSERVER_XORG_SERVER_CONF_OPTS += --enable-dri --enable-glx
> > > XSERVER_XORG_SERVER_DEPENDENCIES += mesa3d xproto_xf86driproto
> > > else
> > > XSERVER_XORG_SERVER_CONF_OPTS += --disable-dri --disable-glx
> > > endif
> > > 
> > > So it really builds mesa as well. Is this needed ?
> > We cannot use gpu-viv-bin-mx6q to compile Xorg with DRI and GLX since 
> > it does not provide all necessary files. Especially, OpenGL headers 
> > (GL/gl.h, GL/glx.h, ...) are missing[1]. We may solve this issue using
> > "opengl-registry" posted by Yann a few months ago. It may be 
> > sufficient.
> 
> For the records, I've posted an updated series:
>     http://lists.busybox.net/pipermail/buildroot/2015-January/117642.html
> 
> Care to see if it is posible to update your series to use the Khronos
> registry/ies? If so, it would great if you could review/ack the patches
> so they get applied soon, so you can in turn repost an updated series of
> yours! ;-)

I am able to build xorg-xserver w/ --enable-dri --enable-glx and 
without mesa3d. Instead of mesa3d, I built opengl-registry and a libGL
provider (I used gpu-viv-bin-mx6q, but it should also work with 
nvidia-driver).

In add, I need to manually add gl.pc, dri.pc and GL/internal/dri_interface.h
(picked from mesa3d)

I will try to generate a cleaner patch in order to begin a discussion 
about this issue.

However, I think this work is an improvement of dri/glx support and is
not really related to "Xorg support for iMX6" series.

[...]
diff mbox

Patch

diff --git a/package/x11r7/Config.in b/package/x11r7/Config.in
index 357d4b4..987f979 100644
--- a/package/x11r7/Config.in
+++ b/package/x11r7/Config.in
@@ -160,6 +160,7 @@  if BR2_PACKAGE_XORG7
 		source package/x11r7/xdriver_xf86-video-glide/Config.in
 		source package/x11r7/xdriver_xf86-video-glint/Config.in
 		source package/x11r7/xdriver_xf86-video-i128/Config.in
+		source package/x11r7/xdriver_xf86-video-imx-viv/Config.in
 		source package/x11r7/xdriver_xf86-video-intel/Config.in
 		source package/x11r7/xdriver_xf86-video-mach64/Config.in
 		source package/x11r7/xdriver_xf86-video-mga/Config.in
diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/0001-Fix-LoadExtenions.patch b/package/x11r7/xdriver_xf86-video-imx-viv/0001-Fix-LoadExtenions.patch
new file mode 100644
index 0000000..3e2d47c
--- /dev/null
+++ b/package/x11r7/xdriver_xf86-video-imx-viv/0001-Fix-LoadExtenions.patch
@@ -0,0 +1,15 @@ 
+Fix compilation with Xorg xserver 1.16.
+
+Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
+
+--- a/EXA/src/vivante_fbdev/vivante_fbdev_driver.c	2014-07-25 15:38:24.000000000 +0200
++++ b/EXA/src/vivante_fbdev/vivante_fbdev_driver.c	2014-10-02 21:00:58.755409342 +0200
+@@ -261,7 +261,7 @@
+         setupDone = TRUE;
+         xf86AddDriver(&FBDEV, module, HaveDriverFuncs);
+         if(gVivFb)
+-            LoadExtension(&VIVExt, FALSE);
++            LoadExtensionList(&VIVExt, 1, FALSE);
+ 		return (pointer)1;
+     } else {
+         if (errmaj) *errmaj = LDR_ONCEONLY;
diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/Config.in b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
new file mode 100644
index 0000000..d91ba79
--- /dev/null
+++ b/package/x11r7/xdriver_xf86-video-imx-viv/Config.in
@@ -0,0 +1,31 @@ 
+
+config BR2_PACKAGE_XDRIVER_XF86_VIDEO_IMX_VIV
+	bool "xf86-video-imx-viv"
+	depends on BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11
+	select BR2_PACKAGE_MESA3D # Needed in order to compile xorg with glx/dri
+	select BR2_PACKAGE_MESA3D_DRI_DRIVER
+	select BR2_PACKAGE_XPROTO_XPROTO
+	select BR2_PACKAGE_XPROTO_XF86DRIPROTO
+	help
+	  X.Org driver for iMX6 GPU (Vivante)
+
+	  Notice EGL and GLes2 APIs are correctly supported. This driver should
+	  also be able to provide Desktop OpenGL implementation but, this 
+	  feature seems broken for a while.
+
+	  To use this driver, add correct configuration to your
+	  /etc/X11/xorg.conf:
+
+	  Section "Device"
+	    [...]
+	    Driver          "vivante"
+	    Option          "vivante_fbdev" "/dev/fbX"
+	  EndSection
+
+	  Don't forget to load galcore.ko and create /dev/galcore before to
+	  use this driver (else, Xorg will exit with an obscur message
+	  like "Segmentation fault at address 0xc").
+
+comment "xf86-video-imx-viv depends on gpu-viv-bin-mx6q with X11 output"
+	depends on BR2_arm
+	depends on (!BR2_PACKAGE_GPU_VIV_BIN_MX6Q_OUTPUT_X11)
diff --git a/package/x11r7/xdriver_xf86-video-imx-viv/xdriver_xf86-video-imx-viv.mk b/package/x11r7/xdriver_xf86-video-imx-viv/xdriver_xf86-video-imx-viv.mk
new file mode 100644
index 0000000..0a62110
--- /dev/null
+++ b/package/x11r7/xdriver_xf86-video-imx-viv/xdriver_xf86-video-imx-viv.mk
@@ -0,0 +1,32 @@ 
+################################################################################
+#
+# xdriver_xf86-video-imx-viv
+#
+################################################################################
+
+XDRIVER_XF86_VIDEO_IMX_VIV_VERSION = $(FREESCALE_IMX_VERSION)
+XDRIVER_XF86_VIDEO_IMX_VIV_SITE = $(FREESCALE_IMX_SITE)
+XDRIVER_XF86_VIDEO_IMX_VIV_SOURCE = xserver-xorg-video-imx-viv-$(XDRIVER_XF86_VIDEO_IMX_VIV_VERSION).tar.gz
+XDRIVER_XF86_VIDEO_IMX_VIV_DEPENDENCIES = gpu-viv-bin-mx6q xserver_xorg-server \
+	xproto_xproto xproto_xf86driproto
+XDRIVER_XF86_VIDEO_IMX_VIV_INSTALL_STAGING = YES
+XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD = $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D)/EXA/src -f makefile.linux
+
+define XDRIVER_XF86_VIDEO_IMX_VIV_BUILD_CMDS
+	$(XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD) sysroot=$(STAGING_DIR) \
+		BUSID_HAS_NUMBER=1 BUILD_IN_YOCTO=1 XSERVER_GREATER_THAN_13=1 \
+		CFLAGS+="$(TARGET_CFLAGS) -I$(@D)/DRI_1.10.4/src"
+endef
+
+define XDRIVER_XF86_VIDEO_IMX_VIV_INSTALL_STAGING_CMDS
+	$(XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD) prefix=$(STAGING_DIR)/usr install
+	$(INSTALL) -m 644 $(@D)/EXA/src/vivante_gal/vivante_priv.h $(STAGING_DIR)/usr/include
+	$(INSTALL) -m 644 $(@D)/EXA/src/vivante_gal/vivante_gal.h $(STAGING_DIR)/usr/include
+endef
+
+define XDRIVER_XF86_VIDEO_IMX_VIV_INSTALL_TARGET_CMDS
+	$(XDRIVER_XF86_VIDEO_IMX_VIV_MAKE_CMD) prefix=$(TARGET_DIR)/usr install
+endef
+
+$(eval $(generic-package))
+