@@ -, +, @@ - Fix SNA for drm-v4.11 or later by disabling I915_USERPTR_UNSYNCHRONIZED - Fix MIT-SHM detection - Drop SNA/UXA options in favor of xorg.conf(5) - Add hyphen to output names for consistency with modesetting(4x) - Add UDEV option - Add "make test" support - Switch to upstream versioning scheme - Document all patches - Simplify and deprecate _WITH_GETLINE - Fix most style warnings --- x11-drivers/xf86-video-intel/Makefile | 38 ++--- x11-drivers/xf86-video-intel/distinfo | 6 +- .../files/patch-benchmarks_dri3-swap.c | 25 ++++ .../xf86-video-intel/files/patch-hyphen | 24 ++++ .../files/patch-src_intel__device.c | 17 +-- .../files/patch-src_intel__list.h | 133 ++++++++++++++++-- .../files/patch-src_sna_kgem.c | 24 ++-- .../files/patch-src_sna_sna__threads.c | 12 -- .../files/patch-src_sna_sna__video.c | 19 --- .../files/patch-test_present-speed.c | 99 +++++++++++++ 10 files changed, 312 insertions(+), 85 deletions(-) create mode 100644 x11-drivers/xf86-video-intel/files/patch-benchmarks_dri3-swap.c create mode 100644 x11-drivers/xf86-video-intel/files/patch-hyphen delete mode 100644 x11-drivers/xf86-video-intel/files/patch-src_sna_sna__threads.c delete mode 100644 x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c create mode 100644 x11-drivers/xf86-video-intel/files/patch-test_present-speed.c --- b/x11-drivers/xf86-video-intel/Makefile +++ b/x11-drivers/xf86-video-intel/Makefile @@ -2,41 +2,47 @@ # $FreeBSD$ PORTNAME= xf86-video-intel -PORTVERSION= 2.99.917.20181203 +DISTVERSION= 2.99.917-892 +PORTEPOCH= 1 CATEGORIES= x11-drivers MAINTAINER= x11@FreeBSD.org -COMMENT= Driver for Intel integrated graphics chipsets +COMMENT= X.Org legacy driver for Intel integrated graphics chipsets LICENSE= MIT # various LICENSE_FILE= ${WRKSRC}/COPYING ONLY_FOR_ARCHS= amd64 i386 -ONLY_FOR_ARCHS_REASON= Intel integrated GPU only exists in Intel x86 processors/chipsets +ONLY_FOR_ARCHS_REASON= Only Intel integrated GPUs on x86 are supported LIB_DEPENDS= libxcb-util.so:x11/xcb-util \ libdrm.so:graphics/libdrm -USES= cpe xorg xorg-cat:driver +USES= cpe gl localbase xorg xorg-cat:driver +CPE_VENDOR= x USE_GITLAB= yes -GL_COMMIT= e5ff8e1828f97891c819c919d7115c6e18b2eb1f +GL_COMMIT= c6cb1b199598c572484fb4e30e1026be9d4ccc31 USE_GL= gl USE_XORG= pciaccess pixman x11 xcb xext xrender xv xvmc USE_LDCONFIG= yes +CONFIGURE_ARGS= --with-builderstring="${DISTVERSIONFULL}" +TEST_TARGET= check -CPE_VENDOR= x - -OPTIONS_SINGLE= ACCEL -OPTIONS_SINGLE_ACCEL= SNA UXA -OPTIONS_DEFAULT= UXA +# XXX bug 214593: SNA crashes on pre-SandyBridge hardware +CONFIGURE_ARGS+=--with-default-accel=uxa +# XXX Remove after FreeBSD 11 EOL +CPPFLAGS+= -D_WITH_GETLINE -ACCEL_DESC= Default AccelMethod (if not specified in xorg.conf) -SNA_DESC= SandyBridge's New Acceleration -UXA_DESC= Unified Acceleration Architecture +OPTIONS_DEFINE= UDEV +OPTIONS_DEFAULT=UDEV -CONFIGURE_ARGS+= --disable-udev +UDEV_DESC= udev-based monitor hotplug detection +UDEV_LIB_DEPENDS= libudev.so:devel/libudev-devd +UDEV_CONFIGURE_ENABLE= udev -SNA_CONFIGURE_ON= --with-default-accel=sna -UXA_CONFIGURE_ON= --with-default-accel=uxa +post-patch: +.if ${CONFIGURE_ARGS:M--with-default-accel=uxa} + @${REINPLACE_CMD} '/^Default/s/SNA/UXA/' ${WRKSRC}/man/intel.man +.endif .include --- b/x11-drivers/xf86-video-intel/distinfo +++ b/x11-drivers/xf86-video-intel/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1561472772 -SHA256 (xorg/driver/driver-xf86-video-intel-e5ff8e1828f97891c819c919d7115c6e18b2eb1f_GL0.tar.gz) = cbb6a10695b9e8b41fef1bafe5c4d9ddf710acb1ccba8e141378493bacda982e -SIZE (xorg/driver/driver-xf86-video-intel-e5ff8e1828f97891c819c919d7115c6e18b2eb1f_GL0.tar.gz) = 1693563 +TIMESTAMP = 1569613053 +SHA256 (xorg/driver/driver-xf86-video-intel-c6cb1b199598c572484fb4e30e1026be9d4ccc31_GL0.tar.gz) = 25f357574889937b9f541537436c01291fc52b43a24c577c1d844b5c044f7a12 +SIZE (xorg/driver/driver-xf86-video-intel-c6cb1b199598c572484fb4e30e1026be9d4ccc31_GL0.tar.gz) = 1694966 --- /dev/null +++ b/x11-drivers/xf86-video-intel/files/patch-benchmarks_dri3-swap.c @@ -0,0 +1,25 @@ +dri3-swap.c:237:24: error: variable 'tmp' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(tmp, &mru, link) { + ^~~ +dri3-swap.c:117:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +dri3-swap.c:114:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +dri3-swap.c:236:22: note: initialize the variable 'tmp' to silence this warning + struct buffer *tmp, *b = NULL; + ^ + = NULL + +--- benchmarks/dri3-swap.c.orig 2019-02-21 22:26:50 UTC ++++ benchmarks/dri3-swap.c +@@ -233,7 +233,7 @@ static void run(Display *dpy, Window win) + clock_gettime(CLOCK_MONOTONIC, &start); + do { + for (n = 0; n < 1000; n++) { +- struct buffer *tmp, *b = NULL; ++ struct buffer *tmp = NULL, *b = NULL; + list_for_each_entry(tmp, &mru, link) { + if (!tmp->busy) { + b = tmp; --- /dev/null +++ b/x11-drivers/xf86-video-intel/files/patch-hyphen @@ -0,0 +1,24 @@ +Add hyphen to RANDR output names for consistency with modesetting(4x) + +--- src/sna/sna_display.c.orig 2018-12-03 09:01:25 UTC ++++ src/sna/sna_display.c +@@ -5126,7 +5126,7 @@ sna_output_add(struct sna *sna, unsigned id, unsigned + output_name = output_names[compat_conn.conn.connector_type]; + else + output_name = "UNKNOWN"; +- len = snprintf(name, 32, "%s%d", output_name, compat_conn.conn.connector_type_id); ++ len = snprintf(name, 32, "%s-%d", output_name, compat_conn.conn.connector_type_id); + if (output_ignored(scrn, name)) + return 0; + +--- src/uxa/intel_display.c.orig 2018-12-03 09:01:25 UTC ++++ src/uxa/intel_display.c +@@ -1484,7 +1484,7 @@ drmmode_create_name(ScrnInfoPtr pScrn, drmModeConnecto + else + output_name = "UNKNOWN"; + +- snprintf(name, 32, "%s%d", ++ snprintf(name, 32, "%s-%d", + output_name, koutput->connector_type_id); + } + } --- b/x11-drivers/xf86-video-intel/files/patch-src_intel__device.c +++ b/x11-drivers/xf86-video-intel/files/patch-src_intel__device.c @@ -1,16 +1,9 @@ ---- src/intel_device.c.orig 2017-02-28 20:52:19 UTC +i915 requires KMS, so FreeBSD uses suffix to distinguish drm1 and drm2 drivers. +drm-kmod kept the same name at the cost of conflict with in-base drm2. + +--- src/intel_device.c.orig 2019-02-21 22:26:50 UTC +++ src/intel_device.c -@@ -28,6 +28,9 @@ - #include "config.h" - #endif - -+#define _WITH_GETLINE /* to expose getline() in stdio.h on FreeBSD */ -+#include /* for getline() */ -+ - #include - #include - #include -@@ -204,6 +207,7 @@ static inline struct intel_device *intel +@@ -204,6 +204,7 @@ static inline struct intel_device *intel_device(ScrnIn } static const char *kernel_module_names[] ={ --- b/x11-drivers/xf86-video-intel/files/patch-src_intel__list.h +++ b/x11-drivers/xf86-video-intel/files/patch-src_intel__list.h @@ -1,15 +1,124 @@ ---- src/intel_list.h.orig 2017-02-28 20:52:19 UTC +kgem.c:2864:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(bo, &kgem->snoop, list) { + ^~ +../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:2849:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo, *first = NULL; + ^ + = NULL +kgem.c:3118:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry_safe(bo, next, &kgem->flushing, request) { + ^~ +../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe' + for (pos = __container_of((head)->next, pos, member), \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:3115:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo, *next; + ^ + = NULL +kgem.c:3429:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry_safe(bo, next, &rq->buffers, request) { + ^~ +../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe' + for (pos = __container_of((head)->next, pos, member), \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:3425:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo, *next; + ^ + = NULL +kgem.c:3541:27: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry_safe(bo, next, &kgem->batch_buffers, base.list) { + ^~ +../../src/intel_list.h:345:45: note: expanded from macro 'list_for_each_entry_safe' + for (pos = __container_of((head)->next, pos, member), \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:3539:24: note: initialize the variable 'bo' to silence this warning + struct kgem_buffer *bo, *next; + ^ + = NULL +kgem.c:3930:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(bo, list, list) { + ^~ +../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:3928:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo; + ^ + = NULL +kgem.c:4670:23: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(bo, cache, vma) { + ^~ +../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:4576:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo, *first = NULL; + ^ + = NULL +kgem.c:5411:31: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry_reverse(bo, &kgem->scanout, list) { + ^~ +../../src/intel_list.h:333:45: note: expanded from macro 'list_for_each_entry_reverse' + for (pos = __container_of((head)->prev, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:5380:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo; + ^ + = NULL +kgem.c:7225:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(bo, buffers, request) { + ^~ +../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:7223:20: note: initialize the variable 'bo' to silence this warning + struct kgem_bo *bo; + ^ + = NULL +kgem.c:7517:22: error: variable 'bo' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(bo, &kgem->batch_buffers, base.list) { + ^~ +../../src/intel_list.h:328:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +../../src/intel_list.h:309:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +kgem.c:7503:24: note: initialize the variable 'bo' to silence this warning + struct kgem_buffer *bo; + ^ + = NULL + +--- src/intel_list.h.orig 2019-02-21 22:26:50 UTC +++ src/intel_list.h -@@ -305,8 +305,6 @@ list_is_empty(const struct list *head) - #define list_last_entry(ptr, type, member) \ - list_entry((ptr)->prev, type, member) - --#define __container_of(ptr, sample, member) \ -- (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) - /** - * Loop through the list given by head and set pos to struct in the list. - * -@@ -325,12 +323,12 @@ list_is_empty(const struct list *head) +@@ -325,12 +325,12 @@ list_is_empty(const struct list *head) * */ #define list_for_each_entry(pos, head, member) \ @@ -25,7 +134,7 @@ &pos->member != (head); \ pos = __container_of(pos->member.prev, pos, member)) -@@ -342,7 +340,7 @@ list_is_empty(const struct list *head) +@@ -342,7 +342,7 @@ list_is_empty(const struct list *head) * See list_for_each_entry for more details. */ #define list_for_each_entry_safe(pos, tmp, head, member) \ --- b/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c +++ b/x11-drivers/xf86-video-intel/files/patch-src_sna_kgem.c @@ -1,12 +1,14 @@ ---- src/sna/kgem.c.orig 2017-02-28 20:52:19 UTC +I915_USERPTR_UNSYNCHRONIZED is broken since drm-v4.11 +https://github.com/FreeBSDDesktop/kms-drm/issues/32 + +--- src/sna/kgem.c.orig 2019-02-21 22:26:50 UTC +++ src/sna/kgem.c -@@ -29,6 +29,9 @@ - #include "config.h" - #endif - -+#define _WITH_GETLINE /* to expose getline() in stdio.h on FreeBSD */ -+#include /* for getline() */ -+ - #include "sna.h" - #include "sna_reg.h" - +@@ -69,7 +69,7 @@ search_snoop_cache(struct kgem *kgem, unsigned int num + #define DBG_NO_CPU 0 + #define DBG_NO_CREATE2 0 + #define DBG_NO_USERPTR 0 +-#define DBG_NO_UNSYNCHRONIZED_USERPTR 0 ++#define DBG_NO_UNSYNCHRONIZED_USERPTR 1 + #define DBG_NO_COHERENT_MMAP_GTT 0 + #define DBG_NO_LLC 0 + #define DBG_NO_SEMAPHORES 0 --- a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__threads.c +++ /dev/null @@ -1,12 +0,0 @@ ---- src/sna/sna_threads.c.orig 2017-02-28 20:52:19 UTC -+++ src/sna/sna_threads.c -@@ -29,6 +29,9 @@ - #include "config.h" - #endif - -+#define _WITH_GETLINE /* to expose getline() in stdio.h on FreeBSD */ -+#include /* for getline() */ -+ - #include "sna.h" - - #include --- a/x11-drivers/xf86-video-intel/files/patch-src_sna_sna__video.c +++ /dev/null @@ -1,19 +0,0 @@ -sna_video.c:62:10: fatal error: 'byteswap.h' file not found -#include - ^~~~~~~~~~~~ - ---- src/sna/sna_video.c.orig 2018-12-03 09:01:25 UTC -+++ src/sna/sna_video.c -@@ -59,7 +59,12 @@ - #include "intel_options.h" - - #include -+#if defined(__linux__) || defined(__GLIBC__) - #include -+#else -+#include -+#define bswap_32 bswap32 -+#endif - - #ifdef SNA_XVMC - #define _SNA_XVMC_SERVER_ --- /dev/null +++ b/x11-drivers/xf86-video-intel/files/patch-test_present-speed.c @@ -0,0 +1,99 @@ +present-speed.c:317:23: error: variable 'b' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(b, &mru, link) + ^ +present-speed.c:115:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +present-speed.c:112:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +present-speed.c:297:19: note: initialize the variable 'b' to silence this warning + struct buffer *b; + ^ + = NULL +present-speed.c:229:19: error: variable 'tmp' is used uninitialized whenever its declaration is reached + [-Werror,-Wsometimes-uninitialized] + struct buffer *tmp, *b = NULL; + ~~~~~~~~~~~~~~~^~~ +present-speed.c:231:24: note: uninitialized use occurs here + list_for_each_entry(tmp, &mru, link) { + ^~~ +present-speed.c:115:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +present-speed.c:112:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +present-speed.c:229:22: note: initialize the variable 'tmp' to silence this warning + struct buffer *tmp, *b = NULL; + ^ + = NULL +present-speed.c:557:24: error: variable 'b' is uninitialized when used here [-Werror,-Wuninitialized] + list_for_each_entry(b, &pp[i].mru, link) + ^ +present-speed.c:115:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +present-speed.c:112:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +present-speed.c:537:20: note: initialize the variable 'b' to silence this warning + struct buffer *b; + ^ + = NULL +present-speed.c:467:19: error: variable 'tmp' is used uninitialized whenever its declaration is reached + [-Werror,-Wsometimes-uninitialized] + struct buffer *tmp, *b = NULL; + ~~~~~~~~~~~~~~~^~~ +present-speed.c:469:24: note: uninitialized use occurs here + list_for_each_entry(tmp, &pp[i].mru, link) { + ^~~ +present-speed.c:115:45: note: expanded from macro 'list_for_each_entry' + for (pos = __container_of((head)->next, pos, member); \ + ^~~ +present-speed.c:112:41: note: expanded from macro '__container_of' + (void *)((char *)(ptr) - ((char *)&(sample)->member - (char *)(sample))) + ^~~~~~ +present-speed.c:467:22: note: initialize the variable 'tmp' to silence this warning + struct buffer *tmp, *b = NULL; + ^ + = NULL + +--- test/present-speed.c.orig 2019-02-21 22:26:50 UTC ++++ test/present-speed.c +@@ -226,7 +226,7 @@ static void run(Display *dpy, Window win, const char * + clock_gettime(CLOCK_MONOTONIC, &start); + do { + for (n = 0; n < 1000; n++) { +- struct buffer *tmp, *b = NULL; ++ struct buffer *tmp = NULL, *b = NULL; + retry: + list_for_each_entry(tmp, &mru, link) { + if (tmp->fence.xid) +@@ -294,7 +294,7 @@ retry: + } while (end.tv_sec < start.tv_sec + 10); + + if (options & DRI3) { +- struct buffer *b; ++ struct buffer *b = NULL; + XID pixmap; + + pixmap = xcb_generate_id(c); +@@ -464,7 +464,7 @@ static void perpixel(Display *dpy, + clock_gettime(CLOCK_MONOTONIC, &start); + do { + for (i = 0; i < sz; i++) { +- struct buffer *tmp, *b = NULL; ++ struct buffer *tmp = NULL, *b = NULL; + retry: + list_for_each_entry(tmp, &pp[i].mru, link) { + if (tmp->fence.xid) +@@ -534,7 +534,7 @@ retry: + for (i = 0; i < sz; i++) { + if (options & DRI3) { + int depth = DefaultDepth(dpy, DefaultScreen(dpy)); +- struct buffer *b; ++ struct buffer *b = NULL; + XID pixmap; + + pixmap = xcb_generate_id(c);