aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-01-20 17:47:31 +0100
committermarha <marha@users.sourceforge.net>2014-01-20 17:47:31 +0100
commit78d84bd03c744b0ed420c450dd2807904ccaef21 (patch)
tree5047a42b383693eed77091fb86950c6248681ad9 /mesalib
parent1917325d5254a9ca33dae8ee5817dfdb7be5a24a (diff)
parent775780ea274e6602c2d64de33a98ee35979cc330 (diff)
downloadvcxsrv-78d84bd03c744b0ed420c450dd2807904ccaef21.tar.gz
vcxsrv-78d84bd03c744b0ed420c450dd2807904ccaef21.tar.bz2
vcxsrv-78d84bd03c744b0ed420c450dd2807904ccaef21.zip
Merge remote-tracking branch 'origin/released'
* origin/released: ligXext mesa git update 20 Jan 2014 fontconfig mesa git update 19 Jan 2013 Conflicts: mesalib/src/loader/Android.mk mesalib/src/loader/Makefile.am mesalib/src/loader/SConscript mesalib/src/loader/loader.c tools/mhmake/config.guess
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/configure.ac1
-rwxr-xr-x[-rw-r--r--]mesalib/src/loader/Android.mk2
-rwxr-xr-x[-rw-r--r--]mesalib/src/loader/Makefile.am13
-rwxr-xr-x[-rw-r--r--]mesalib/src/loader/SConscript5
-rwxr-xr-x[-rw-r--r--]mesalib/src/loader/loader.c34
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c10
6 files changed, 40 insertions, 25 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 9ca6704a3..d9e18968c 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1935,6 +1935,7 @@ AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
AC_SUBST([ELF_LIB])
AM_CONDITIONAL(DRICOMMON_NEED_LIBDRM, test "x$DRICOMMON_NEED_LIBDRM" = xyes)
+AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
diff --git a/mesalib/src/loader/Android.mk b/mesalib/src/loader/Android.mk
index 01699dcc5..6890af473 100644..100755
--- a/mesalib/src/loader/Android.mk
+++ b/mesalib/src/loader/Android.mk
@@ -35,7 +35,7 @@ LOCAL_SRC_FILES := \
# swrast only
ifeq ($(MESA_GPU_DRIVERS),swrast)
- LOCAL_CFLAGS += -D_EGL_NO_DRM
+ LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
else
LOCAL_C_INCLUDES += \
$(DRM_TOP)/include/drm \
diff --git a/mesalib/src/loader/Makefile.am b/mesalib/src/loader/Makefile.am
index a118fef1d..371dd575c 100644..100755
--- a/mesalib/src/loader/Makefile.am
+++ b/mesalib/src/loader/Makefile.am
@@ -27,11 +27,20 @@ libloader_la_CPPFLAGS = \
$(DEFINES) \
-I$(top_srcdir)/include \
$(VISIBILITY_CFLAGS) \
- $(LIBDRM_CFLAGS) \
$(LIBUDEV_CFLAGS)
libloader_la_LIBADD = \
- $(LIBDRM_LIBS) \
$(LIBUDEV_LIBS)
+if !HAVE_LIBDRM
+libloader_la_CPPFLAGS += \
+ -D__NOT_HAVE_DRM_H
+else
+libloader_la_CPPFLAGS += \
+ $(LIBDRM_CFLAGS)
+
+libloader_la_LIBADD += \
+ $(LIBDRM_LIBS)
+endif
+
libloader_la_SOURCES = $(LOADER_C_FILES)
diff --git a/mesalib/src/loader/SConscript b/mesalib/src/loader/SConscript
index 76b087100..359fc1850 100644..100755
--- a/mesalib/src/loader/SConscript
+++ b/mesalib/src/loader/SConscript
@@ -1,15 +1,12 @@
Import('*')
-if not env['drm']:
- Return()
-
env = env.Clone()
env.Prepend(CPPPATH = [
'#include'
])
-env.PkgUseModules('DRM')
+env.Append(CPPDEFINES = ['__NOT_HAVE_DRM_H'])
if env['udev']:
env.PkgUseModules('UDEV')
diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c
index 108e44402..a5bd7692e 100644..100755
--- a/mesalib/src/loader/loader.c
+++ b/mesalib/src/loader/loader.c
@@ -69,7 +69,9 @@
#include <string.h>
#include "loader.h"
+#ifndef __NOT_HAVE_DRM_H
#include <xf86drm.h>
+#endif
#define __IS_LOADER
#include "pci_ids/pci_id_driver_map.h"
@@ -85,7 +87,7 @@ static void default_logger(int level, const char *fmt, ...)
}
}
-static void (*log)(int level, const char *fmt, ...) = default_logger;
+static void (*log_)(int level, const char *fmt, ...) = default_logger;
#ifdef HAVE_LIBUDEV
#include <libudev.h>
@@ -97,13 +99,13 @@ udev_device_new_from_fd(struct udev *udev, int fd)
struct stat buf;
if (fstat(fd, &buf) < 0) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d", fd);
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d", fd);
return NULL;
}
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
if (device == NULL) {
- log(_LOADER_WARNING,
+ log_(_LOADER_WARNING,
"MESA-LOADER: could not create udev device for fd %d", fd);
return NULL;
}
@@ -116,7 +118,6 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
{
struct udev *udev = NULL;
struct udev_device *device = NULL, *parent;
- struct stat buf;
const char *pci_id;
*chip_id = -1;
@@ -128,14 +129,14 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
parent = udev_device_get_parent(device);
if (parent == NULL) {
- log(_LOADER_WARNING, "MESA-LOADER: could not get parent device");
+ log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device");
goto out;
}
pci_id = udev_device_get_property_value(parent, "PCI_ID");
if (pci_id == NULL ||
sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) {
- log(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID");
+ log_(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID");
*chip_id = -1;
goto out;
}
@@ -149,7 +150,7 @@ out:
return (*chip_id >= 0);
}
-#elif defined(ANDROID) && !defined(_EGL_NO_DRM)
+#elif defined(ANDROID) && !defined(__NOT_HAVE_DRM_H)
/* for i915 */
#include <i915_drm.h>
@@ -165,11 +166,11 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
version = drmGetVersion(fd);
if (!version) {
- log(_LOADER_WARNING, "MESA-LOADER: invalid drm fd");
+ log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd");
return FALSE;
}
if (!version->name) {
- log(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name");
+ log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name");
drmFreeVersion(version);
return FALSE;
}
@@ -185,7 +186,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
gp.value = chip_id;
ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915");
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915");
*chip_id = -1;
}
}
@@ -200,7 +201,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
info.value = (unsigned long) chip_id;
ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (ret) {
- log(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon");
+ log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon");
*chip_id = -1;
}
}
@@ -267,18 +268,21 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
driver_types = _LOADER_GALLIUM | _LOADER_DRI;
if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
+
+#ifndef __NOT_HAVE_DRM_H
/* fallback to drmGetVersion(): */
drmVersionPtr version = drmGetVersion(fd);
if (!version) {
- log(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
+ log_(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
return NULL;
}
driver = strndup(version->name, version->name_len);
- log(_LOADER_INFO, "using driver %s for %d", driver, fd);
+ log_(_LOADER_INFO, "using driver %s for %d", driver, fd);
drmFreeVersion(version);
+#endif
return driver;
}
@@ -303,7 +307,7 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
}
out:
- log(driver ? _LOADER_INFO : _LOADER_WARNING,
+ log_(driver ? _LOADER_INFO : _LOADER_WARNING,
"pci id for fd %d: %04x:%04x, driver %s",
fd, vendor_id, chip_id, driver);
return driver;
@@ -312,5 +316,5 @@ out:
void
loader_set_logger(void (*logger)(int level, const char *fmt, ...))
{
- log = logger;
+ log_ = logger;
}
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index e3f33de7d..a19d02ac0 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -659,8 +659,10 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
}
for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
- map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
- find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
+ if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
+ map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+ find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
+ }
}
}
@@ -688,6 +690,8 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx)
}
for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
- unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+ if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
+ unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+ }
}
}