pkgsrc/graphics/MesaLib/patches/patch-src_loader_loader.c
tnn 7fc9f783fd Update to mesa-11.0.0 (2015-09-12)
Tested on:
- NetBSD 7.0/i386 EeePC 1001PXD with i915 (Pineview)
- NetBSD 7.99.21/amd64 with Radeon HD 5450 (Evergreen/Cedar)

pkgsrc changes:
- make i386 & x86_64 glx-tls dispatch assembly stubs aware of that the
  dispatch table pointer may be NULL due to TLS implementation limitations
- work around run time loader issue on NetBSD (#50277)
- TLS dispatch support is now enabled again on NetBSD
- llvm option now requires libLLVM 3.7.0 with AMDGPU target
- build xatracker library on x86, useful for xf86-video-vmware acceleration
- always use shared glapi
- always include dri3 support (it will still use dri2 if dri3 not supported)

New in Mesa 11:
- New hardware support for AMD GCN 1.2 GPUs: Tonga, Iceland, Carrizo, Fiji
- OpenGL 4.1 on radeonsi, nvc0
- OpenGL ES 3.0 on freedreno (a3xx, a4xx)
- GL_AMD_vertex_shader_viewport_index on radeonsi
- GL_ARB_conditional_render_inverted on r600, radeonsi
- GL_ARB_depth_buffer_float on a4xx
- GL_ARB_derivative_control on radeonsi
- GL_ARB_draw_buffers, GL_ARB_draw_buffers_blend on a4xx
- GL_ARB_fragment_layer_viewport on radeonsi
- GL_ARB_framebuffer_no_attachments on i965
- GL_ARB_get_texture_sub_image for all drivers
- GL_ARB_gpu_shader5 on radeonsi
- GL_ARB_gpu_shader_fp64 on llvmpipe, radeonsi
- GL_ARB_shader_image_load_store on i965
- GL_ARB_shader_precision on radeonsi, nvc0
- GL_ARB_shader_image_size on i965
- GL_ARB_shader_stencil_export on llvmpipe
- GL_ARB_shader_subroutine on core profile all drivers
- GL_ARB_tessellation_shader on nvc0, radeonsi
- GL_ARB_transform_feedback2, GL_ARB_transform_feedback_instanced,
  GL_EXT_transform_feedback on a3xx, a4xx
- GL_ARB_vertex_attrib_64bit on llvmpipe, radeonsi
- GL_ARB_viewport_array on radeonsi
- GL_EXT_depth_bounds_test on radeonsi, nv30, nv50, nvc0
- GL_EXT_texture_compression_s3tc on freedreno (a3xx)
- GL_NV_read_depth (GLES) on all drivers
- GL_NV_read_depth_stencil (GLES) on all drivers
- GL_NV_read_stencil (GLES) on all drivers
- GL_OES_texture_float on all r300, r600, radeonsi, nv30, nv50, nvc0, softpipe,
  llvmpipe
- GL_OES_texture_half_float on all r300, r600, radeonsi, nv30, nv50, nvc0,
  softpipe, llvmpipe
- GL_OES_texture_float_linear on all r300, r600, radeonsi, nv30, nv50, nvc0,
  softpipe, llvmpipe
- GL_OES_texture_half_float_linear on all r300, r600, radeonsi, nv30, nv50,
  nvc0, softpipe, llvmpipe
- GL_EXT_draw_buffers2 on a4xx
- GLX_ARB_create_context_robustness on r600, radeonsi
- EGL_EXT_create_context_robustness on r600, radeonsi
- EGL_KHR_gl_colorspace on r600, radeonsi, nv50, nvc0
- EGL_KHR_gl_texture_3D_image on r600, radeonsi, nv50, nvc0
- EGL 1.5 on r600, radeonsi, nv50, nvc0
2015-09-26 08:45:02 +00:00

82 lines
1.9 KiB
C

$NetBSD: patch-src_loader_loader.c,v 1.2 2015/09/26 08:45:02 tnn Exp $
FreeBSD & DragonFly support for libdevq. From FreeBSD ports(?)
--- src/loader/loader.c.orig 2015-09-10 18:07:21.000000000 +0000
+++ src/loader/loader.c
@@ -70,7 +70,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_LIBUDEV
+#if defined(HAVE_LIBUDEV) || defined(HAVE_LIBDEVQ)
#include <assert.h>
#include <dlfcn.h>
#include <unistd.h>
@@ -505,6 +505,53 @@ sysfs_get_pci_id_for_fd(int fd, int *ven
}
#endif
+#if defined(HAVE_LIBDEVQ)
+#include <libdevq.h>
+
+static void *devq_handle = NULL;
+
+static void *
+devq_dlopen_handle(void)
+{
+ if (!devq_handle) {
+ devq_handle = dlopen("libdevq.so.0", RTLD_LOCAL | RTLD_LAZY);
+ }
+
+ return devq_handle;
+}
+
+static void *
+asserted_dlsym(void *dlopen_handle, const char *name)
+{
+ void *result = dlsym(dlopen_handle, name);
+ assert(result);
+ return result;
+}
+
+#define DEVQ_SYMBOL(ret, name, args) \
+ ret (*name) args = asserted_dlsym(devq_dlopen_handle(), #name);
+
+static int
+devq_get_pci_id_from_fd(int fd, int *vendor_id, int *chip_id)
+{
+ int ret;
+ DEVQ_SYMBOL(int, devq_device_get_pciid_from_fd,
+ (int fd, int *vendor_id, int *chip_id));
+
+ *chip_id = -1;
+
+ ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
+ if (ret < 0) {
+ log_(_LOADER_WARNING, "MESA-LOADER: could not get PCI ID\n");
+ goto out;
+ }
+
+out:
+ return (*chip_id >= 0);
+}
+
+#endif
+
#if defined(HAVE_LIBDRM)
/* for i915 */
#include <i915_drm.h>
@@ -588,6 +635,12 @@ loader_get_pci_id_for_fd(int fd, int *ve
if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
return 1;
#endif
+
+#if HAVE_LIBDEVQ
+ if (devq_get_pci_id_from_fd(fd, vendor_id, chip_id))
+ return 1;
+#endif
+
#if HAVE_LIBDRM
if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
return 1;