Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h index 786caae..a4daa6b 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.h +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -30,6 +30,8 @@ #ifndef __XMLCONFIG_H #define __XMLCONFIG_H +#include GL/gl.h + #define STRING_CONF_MAXLEN 25 Is that required? seemed a bit strange that would be a change in this patch. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
On 16 June 2014 15:55, Dave Airlie airl...@gmail.com wrote: diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h index 786caae..a4daa6b 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.h +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -30,6 +30,8 @@ #ifndef __XMLCONFIG_H #define __XMLCONFIG_H +#include GL/gl.h + #define STRING_CONF_MAXLEN 25 Is that required? seemed a bit strange that would be a change in this patch. Oh I see things don't build without it, strange, but I suppose it makes sense. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
On 27/05/2014 23:46, Michel Dänzer wrote : This breaks the build for me, see below. That's an out-of-tree build FWIW. make[2]: Entering directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/loader' cd ../../.. automake-1.14 --foreign src/loader/Makefile src/loader/Makefile.am:42: warning: source file '$(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c' is in a subdirectory, src/loader/Makefile.am:42: but option 'subdir-objects' is disabled automake-1.14: warning: possible forward-incompatibility. automake-1.14: At least a source file is in a subdirectory, but the 'subdir-objects' automake-1.14: automake option hasn't been enabled. For now, the corresponding output automake-1.14: object file(s) will be placed in the top-level directory. However, automake-1.14: this behaviour will change in future Automake versions: they will automake-1.14: unconditionally cause object files to be placed in the same subdirectory automake-1.14: of the corresponding sources. automake-1.14: You are advised to start using 'subdir-objects' option throughout your automake-1.14: project, to avoid future incompatibilities. cd ../.. /bin/bash ./config.status src/loader/Makefile depfiles config.status: creating src/loader/Makefile config.status: executing depfiles commands CC libloader_la-loader.lo CC libloader_la-xmlconfig.lo In file included from ../../../src/loader/loader.c:79:0: ../../../src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal error: xmlpool/options.h: No such file or directory #include xmlpool/options.h ^ compilation terminated. Makefile:570: recipe for target 'libloader_la-loader.lo' failed make[2]: *** [libloader_la-loader.lo] Error 1 make[2]: Leaving directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/loader' Replacing -I$(top_srcdir)/src/mesa/drivers/dri/common/ \ by -I$(top_builddir)/src/mesa/drivers/dri/common \ in the patch should solve that. I'm going to test that later and will send an updated patch. Thanks for your testing, Axel Davy ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
On 28/05/14 01:55, Axel Davy wrote: Signed-off-by: Axel Davy axel.d...@ens.fr Hi Axel Can you give the scons build a try. I suspect that this patch will leave it in somewhat broken state. --- src/Makefile.am | 4 +++- src/loader/Makefile.am | 21 --- src/loader/loader.c | 27 + src/mesa/drivers/dri/common/xmlconfig.h | 2 ++ src/mesa/drivers/dri/common/xmlpool/t_options.h | 14 + 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9d1580f..d4a7090 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,12 +19,14 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = gtest loader mapi +SUBDIRS = gtest mapi if NEED_OPENGL_COMMON SUBDIRS += glsl mesa endif +SUBDIRS += loader + if HAVE_DRI_GLX SUBDIRS += glx endif diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index bddf7ac..3503a51 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -29,6 +29,23 @@ libloader_la_CPPFLAGS = \ $(VISIBILITY_CFLAGS) \ $(LIBUDEV_CFLAGS) +libloader_la_SOURCES = $(LOADER_C_FILES) +libloader_la_LIBADD = $() + Please drop the $() +if NEED_OPENGL_COMMON +libloader_la_CPPFLAGS += \ + -I$(top_srcdir)/src/mesa/drivers/dri/common/ \ Out of tree builds will fail without -I$(top_builddir)/src/mesa/drivers/dri/common/ \ and possibly similar treatment for the other two + -I$(top_srcdir)/src/mesa/ \ + -I$(top_srcdir)/src/mapi/ \ + -DUSE_DRICONF + +libloader_la_SOURCES += \ + $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c + +libloader_la_LIBADD += \ + -lexpat EXPAT_LIBS might be better. +endif + if !HAVE_LIBDRM libloader_la_CPPFLAGS += \ -D__NOT_HAVE_DRM_H @@ -36,8 +53,6 @@ else libloader_la_CPPFLAGS += \ $(LIBDRM_CFLAGS) -libloader_la_LIBADD = \ +libloader_la_LIBADD += \ $(LIBDRM_LIBS) endif - -libloader_la_SOURCES = $(LOADER_C_FILES) diff --git a/src/loader/loader.c b/src/loader/loader.c index 3d504f7..e9a8c46 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -74,6 +74,10 @@ #include unistd.h #include stdlib.h #include errno.h +#ifdef USE_DRICONF +#include xmlconfig.h +#include xmlpool.h +#endif #endif #include loader.h @@ -310,9 +314,22 @@ drm_open_device(const char *device_name) return fd; } +#ifdef USE_DRICONF +const char __driConfigOptionsLoader[] = +DRI_CONF_BEGIN +DRI_CONF_SECTION_INITIALIZATION +DRI_CONF_DEVICE_ID_PATH_TAG() +DRI_CONF_SECTION_END +DRI_CONF_END; +#endif + int loader_get_user_preferred_fd(int default_fd, int *different_device) { struct udev *udev; +#ifdef USE_DRICONF + driOptionCache defaultInitOptions; + driOptionCache userInitOptions; +#endif const char *dri_prime = getenv(DRI_PRIME); char *prime = NULL; int is_different_device = 0, fd = default_fd; @@ -324,6 +341,16 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device) if (dri_prime) prime = strdup(dri_prime); +#ifdef USE_DRICONF + else { + driParseOptionInfo(defaultInitOptions, __driConfigOptionsLoader); + driParseConfigFiles(userInitOptions, defaultInitOptions, 0, loader); + if (driCheckOption(userInitOptions, device_id, DRI_STRING)) + prime = strdup(driQueryOptionstr(userInitOptions, device_id)); + driDestroyOptionCache(userInitOptions); + driDestroyOptionInfo(defaultInitOptions); + } +#endif if (prime == NULL) { *different_device = 0; diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h index 786caae..a4daa6b 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.h +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -30,6 +30,8 @@ #ifndef __XMLCONFIG_H #define __XMLCONFIG_H +#include GL/gl.h + ^^ This is rather ugly, although the GL* types used throughout kind of mandate it :\ Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
On 28/05/2014 08:40, Emil Velikov wrote : On 28/05/14 01:55, Axel Davy wrote: Signed-off-by: Axel Davy axel.d...@ens.fr Hi Axel Can you give the scons build a try. I suspect that this patch will leave it in somewhat broken state. I'll give a try. --- src/Makefile.am | 4 +++- src/loader/Makefile.am | 21 --- src/loader/loader.c | 27 + src/mesa/drivers/dri/common/xmlconfig.h | 2 ++ src/mesa/drivers/dri/common/xmlpool/t_options.h | 14 + 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9d1580f..d4a7090 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,12 +19,14 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = gtest loader mapi +SUBDIRS = gtest mapi if NEED_OPENGL_COMMON SUBDIRS += glsl mesa endif +SUBDIRS += loader + if HAVE_DRI_GLX SUBDIRS += glx endif diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index bddf7ac..3503a51 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -29,6 +29,23 @@ libloader_la_CPPFLAGS = \ $(VISIBILITY_CFLAGS) \ $(LIBUDEV_CFLAGS) +libloader_la_SOURCES = $(LOADER_C_FILES) +libloader_la_LIBADD = $() + Please drop the $() What could I use instead to enable to use '+=' after ? +if NEED_OPENGL_COMMON +libloader_la_CPPFLAGS += \ + -I$(top_srcdir)/src/mesa/drivers/dri/common/ \ Out of tree builds will fail without -I$(top_builddir)/src/mesa/drivers/dri/common/ \ Yes it should be that. It's what is done for dri-swrast. and possibly similar treatment for the other two + -I$(top_srcdir)/src/mesa/ \ + -I$(top_srcdir)/src/mapi/ \ + -DUSE_DRICONF + +libloader_la_SOURCES += \ + $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c + +libloader_la_LIBADD += \ + -lexpat EXPAT_LIBS might be better. +#include GL/gl.h + ^^ This is rather ugly, although the GL* types used throughout kind of mandate it :\ Yes, this would need a series of cleanups to remove all GL* types used in Mesa when not neccessary. Thanks, Axel Davy ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
On 28/05/14 14:24, Axel Davy wrote: On 28/05/2014 08:40, Emil Velikov wrote : On 28/05/14 01:55, Axel Davy wrote: Signed-off-by: Axel Davy axel.d...@ens.fr Hi Axel Can you give the scons build a try. I suspect that this patch will leave it in somewhat broken state. I'll give a try. --- src/Makefile.am | 4 +++- src/loader/Makefile.am | 21 --- src/loader/loader.c | 27 + src/mesa/drivers/dri/common/xmlconfig.h | 2 ++ src/mesa/drivers/dri/common/xmlpool/t_options.h | 14 + 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9d1580f..d4a7090 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,12 +19,14 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = gtest loader mapi +SUBDIRS = gtest mapi if NEED_OPENGL_COMMON SUBDIRS += glsl mesa endif +SUBDIRS += loader + if HAVE_DRI_GLX SUBDIRS += glx endif diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index bddf7ac..3503a51 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -29,6 +29,23 @@ libloader_la_CPPFLAGS = \ $(VISIBILITY_CFLAGS) \ $(LIBUDEV_CFLAGS) +libloader_la_SOURCES = $(LOADER_C_FILES) +libloader_la_LIBADD = $() + Please drop the $() What could I use instead to enable to use '+=' after ? libloader_la_LIBADD = Pretty much all of mesa uses this approach. +if NEED_OPENGL_COMMON +libloader_la_CPPFLAGS += \ +-I$(top_srcdir)/src/mesa/drivers/dri/common/ \ Out of tree builds will fail without -I$(top_builddir)/src/mesa/drivers/dri/common/ \ Yes it should be that. It's what is done for dri-swrast. Indeed. xmlpool.h pulls in xmlpool/options.h which is generated at buildtime from xmlpool/t_options.h -Emil and possibly similar treatment for the other two +-I$(top_srcdir)/src/mesa/ \ +-I$(top_srcdir)/src/mapi/ \ +-DUSE_DRICONF + +libloader_la_SOURCES += \ +$(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c + +libloader_la_LIBADD += \ +-lexpat EXPAT_LIBS might be better. +#include GL/gl.h + ^^ This is rather ugly, although the GL* types used throughout kind of mandate it :\ Yes, this would need a series of cleanups to remove all GL* types used in Mesa when not neccessary. Thanks, Axel Davy ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
Signed-off-by: Axel Davy axel.d...@ens.fr --- src/Makefile.am | 4 +++- src/loader/Makefile.am | 21 --- src/loader/loader.c | 27 + src/mesa/drivers/dri/common/xmlconfig.h | 2 ++ src/mesa/drivers/dri/common/xmlpool/t_options.h | 14 + 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9d1580f..d4a7090 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,12 +19,14 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = gtest loader mapi +SUBDIRS = gtest mapi if NEED_OPENGL_COMMON SUBDIRS += glsl mesa endif +SUBDIRS += loader + if HAVE_DRI_GLX SUBDIRS += glx endif diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index bddf7ac..3503a51 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -29,6 +29,23 @@ libloader_la_CPPFLAGS = \ $(VISIBILITY_CFLAGS) \ $(LIBUDEV_CFLAGS) +libloader_la_SOURCES = $(LOADER_C_FILES) +libloader_la_LIBADD = $() + +if NEED_OPENGL_COMMON +libloader_la_CPPFLAGS += \ + -I$(top_srcdir)/src/mesa/drivers/dri/common/ \ + -I$(top_srcdir)/src/mesa/ \ + -I$(top_srcdir)/src/mapi/ \ + -DUSE_DRICONF + +libloader_la_SOURCES += \ + $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c + +libloader_la_LIBADD += \ + -lexpat +endif + if !HAVE_LIBDRM libloader_la_CPPFLAGS += \ -D__NOT_HAVE_DRM_H @@ -36,8 +53,6 @@ else libloader_la_CPPFLAGS += \ $(LIBDRM_CFLAGS) -libloader_la_LIBADD = \ +libloader_la_LIBADD += \ $(LIBDRM_LIBS) endif - -libloader_la_SOURCES = $(LOADER_C_FILES) diff --git a/src/loader/loader.c b/src/loader/loader.c index 3d504f7..e9a8c46 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -74,6 +74,10 @@ #include unistd.h #include stdlib.h #include errno.h +#ifdef USE_DRICONF +#include xmlconfig.h +#include xmlpool.h +#endif #endif #include loader.h @@ -310,9 +314,22 @@ drm_open_device(const char *device_name) return fd; } +#ifdef USE_DRICONF +const char __driConfigOptionsLoader[] = +DRI_CONF_BEGIN +DRI_CONF_SECTION_INITIALIZATION +DRI_CONF_DEVICE_ID_PATH_TAG() +DRI_CONF_SECTION_END +DRI_CONF_END; +#endif + int loader_get_user_preferred_fd(int default_fd, int *different_device) { struct udev *udev; +#ifdef USE_DRICONF + driOptionCache defaultInitOptions; + driOptionCache userInitOptions; +#endif const char *dri_prime = getenv(DRI_PRIME); char *prime = NULL; int is_different_device = 0, fd = default_fd; @@ -324,6 +341,16 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device) if (dri_prime) prime = strdup(dri_prime); +#ifdef USE_DRICONF + else { + driParseOptionInfo(defaultInitOptions, __driConfigOptionsLoader); + driParseConfigFiles(userInitOptions, defaultInitOptions, 0, loader); + if (driCheckOption(userInitOptions, device_id, DRI_STRING)) + prime = strdup(driQueryOptionstr(userInitOptions, device_id)); + driDestroyOptionCache(userInitOptions); + driDestroyOptionInfo(defaultInitOptions); + } +#endif if (prime == NULL) { *different_device = 0; diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/mesa/drivers/dri/common/xmlconfig.h index 786caae..a4daa6b 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.h +++ b/src/mesa/drivers/dri/common/xmlconfig.h @@ -30,6 +30,8 @@ #ifndef __XMLCONFIG_H #define __XMLCONFIG_H +#include GL/gl.h + #define STRING_CONF_MAXLEN 25 /** \brief Option data types */ diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index 3bf804a..fc9e104 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -321,3 +321,17 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_OPT_BEGIN_B(always_have_depth_buffer, def) \ DRI_CONF_DESC(en,gettext(Create all visuals with a depth buffer)) \ DRI_CONF_OPT_END + + + +/** + * \brief Initialization configuration options + */ +#define DRI_CONF_SECTION_INITIALIZATION \ +DRI_CONF_SECTION_BEGIN \ +DRI_CONF_DESC(en,gettext(Initialization)) + +#define DRI_CONF_DEVICE_ID_PATH_TAG(def) \ +DRI_CONF_OPT_BEGIN(device_id, string, def) \ +DRI_CONF_DESC(en,gettext(Define the graphic device to use if possible)) \ +DRI_CONF_OPT_END -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME
This breaks the build for me, see below. That's an out-of-tree build FWIW. make[2]: Entering directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/loader' cd ../../.. automake-1.14 --foreign src/loader/Makefile src/loader/Makefile.am:42: warning: source file '$(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c' is in a subdirectory, src/loader/Makefile.am:42: but option 'subdir-objects' is disabled automake-1.14: warning: possible forward-incompatibility. automake-1.14: At least a source file is in a subdirectory, but the 'subdir-objects' automake-1.14: automake option hasn't been enabled. For now, the corresponding output automake-1.14: object file(s) will be placed in the top-level directory. However, automake-1.14: this behaviour will change in future Automake versions: they will automake-1.14: unconditionally cause object files to be placed in the same subdirectory automake-1.14: of the corresponding sources. automake-1.14: You are advised to start using 'subdir-objects' option throughout your automake-1.14: project, to avoid future incompatibilities. cd ../.. /bin/bash ./config.status src/loader/Makefile depfiles config.status: creating src/loader/Makefile config.status: executing depfiles commands CC libloader_la-loader.lo CC libloader_la-xmlconfig.lo In file included from ../../../src/loader/loader.c:79:0: ../../../src/mesa/drivers/dri/common/xmlpool.h:103:29: fatal error: xmlpool/options.h: No such file or directory #include xmlpool/options.h ^ compilation terminated. Makefile:570: recipe for target 'libloader_la-loader.lo' failed make[2]: *** [libloader_la-loader.lo] Error 1 make[2]: Leaving directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/loader' -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev