# 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
$(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_builddir)/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 += \
+ -lm \
+ $(EXPAT_LIBS)
+endif
+
if !HAVE_LIBDRM
libloader_la_CPPFLAGS += \
-D__NOT_HAVE_DRM_H
libloader_la_CPPFLAGS += \
$(LIBDRM_CFLAGS)
-libloader_la_LIBADD = \
+libloader_la_LIBADD += \
$(LIBDRM_LIBS)
endif
-
-libloader_la_SOURCES = $(LOADER_C_FILES)
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
+#ifdef USE_DRICONF
+#include "xmlconfig.h"
+#include "xmlpool.h"
+#endif
#endif
#ifdef HAVE_SYSFS
#include <sys/stat.h>
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;
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;
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