From 2694701ad828f7857ba5cfdd9560a7976841d50d Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 2 Jan 2019 03:48:39 +0000 Subject: user/xf86-video-freedreno: new package --- user/xf86-video-freedreno/APKBUILD | 42 +++++ user/xf86-video-freedreno/api-23.patch | 256 ++++++++++++++++++++++++++++ user/xf86-video-freedreno/secure-atom.patch | 33 ++++ 3 files changed, 331 insertions(+) create mode 100644 user/xf86-video-freedreno/APKBUILD create mode 100644 user/xf86-video-freedreno/api-23.patch create mode 100644 user/xf86-video-freedreno/secure-atom.patch diff --git a/user/xf86-video-freedreno/APKBUILD b/user/xf86-video-freedreno/APKBUILD new file mode 100644 index 000000000..d46d2b23a --- /dev/null +++ b/user/xf86-video-freedreno/APKBUILD @@ -0,0 +1,42 @@ +# Contributor: A. Wilcox +# Maintainer: A. Wilcox +pkgname=xf86-video-freedreno +pkgver=1.4.0 +pkgrel=0 +pkgdesc="Libre Adreno video driver for X11" +url="https://www.X.Org/" +arch="all" +license="X11 AND BSD-3-Clause" +depends="" +makedepends="eudev-dev libdrm-dev util-macros xorgproto-dev xorg-server-dev" +subpackages="$pkgname-doc" +source="https://www.x.org/releases/individual/driver/xf86-video-freedreno-$pkgver.tar.bz2 + api-23.patch + secure-atom.patch + " + +build() { + cd "$builddir" + CFLAGS="$CFLAGS -Wno-error=deprecated-declarations" ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var + make +} + +check() { + cd "$builddir" + make check +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install +} + +sha512sums="5bc7c35bd79e8ff90d8da5360413b03c497ba3dec9399c78fc85e8f1d2bf8955c27c6b225dfbbcdb73a16a4b539cfa131e309866e42289cb577d0e9bfc15b6ca xf86-video-freedreno-1.4.0.tar.bz2 +6e940ecb5b784b8e8854af47c0f01becf2a3453cc0d81b905612920d78ce8a89f99eac7b5e0c8d4755ec64755b482a6d4c1f369c96ee0c26e2402bd0b5c1f4d5 api-23.patch +5cac3b356339652d5447505ddb5851bdf492341d6f4e04cdda5372f1a74e47fcecfffc18af50bdf6ccaef9a894c6e5a208552add5f9dbe0bbb09805b7794448c secure-atom.patch" diff --git a/user/xf86-video-freedreno/api-23.patch b/user/xf86-video-freedreno/api-23.patch new file mode 100644 index 000000000..fbe8c48a7 --- /dev/null +++ b/user/xf86-video-freedreno/api-23.patch @@ -0,0 +1,256 @@ +From 5c82dc7874b6eaff39dc8c8575e72e5a40f13ea6 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 19 Jul 2016 10:03:56 -0400 +Subject: Adapt Block/WakeupHandler signature for ABI 23 + +Signed-off-by: Adam Jackson +--- + src/compat-api.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/compat-api.h b/src/compat-api.h +index 4f7b9ea..15b92fe 100644 +--- a/src/compat-api.h ++++ b/src/compat-api.h +@@ -76,8 +76,13 @@ + + #define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv + ++#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0) ++#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout ++#define BLOCKHANDLER_ARGS arg, pTimeout ++#else + #define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask + #define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask ++#endif + + #define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen + #define CLOSE_SCREEN_ARGS pScreen +-- +cgit v1.1 + +From 5f60ca4fe99199183dced955de0206acb5a5ebe9 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Tue, 19 Jul 2016 08:33:51 -0700 +Subject: Use NotifyFd for drm and udev fds + +NotifyFd is available after API 22, and must be used after API 23. + +Signed-off-by: Keith Packard +--- + src/compat-api.h | 4 ++++ + src/drmmode_display.c | 21 +++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/src/compat-api.h b/src/compat-api.h +index 15b92fe..80dabc1 100644 +--- a/src/compat-api.h ++++ b/src/compat-api.h +@@ -76,6 +76,10 @@ + + #define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv + ++#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0) ++#define HAVE_NOTIFY_FD 1 ++#endif ++ + #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0) + #define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout + #define BLOCKHANDLER_ARGS arg, pTimeout +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 0d94bb5..53ae677 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -1462,6 +1462,18 @@ drmmode_flip_handler(int fd, unsigned int frame, unsigned int tv_sec, + free(flipdata); + } + ++#if HAVE_NOTIFY_FD ++ ++static void ++drmmode_notify_fd(int fd, int notify, void *data) ++{ ++ ScrnInfoPtr scrn = data; ++ drmmode_ptr drmmode = drmmode_from_scrn(scrn); ++ drmHandleEvent(drmmode->fd, &drmmode->event_context); ++} ++ ++#else ++ + static void + drmmode_wakeup_handler(pointer data, int err, pointer p) + { +@@ -1480,6 +1492,7 @@ drmmode_wakeup_handler(pointer data, int err, pointer p) + drmmode_handle_uevents(scrn); + #endif + } ++#endif /* HAVE_NOTIFY_FD */ + + void + drmmode_wait_for_event(ScrnInfoPtr pScrn) +@@ -1517,11 +1530,15 @@ drmmode_screen_init(ScreenPtr pScreen) + drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION; + drmmode->event_context.page_flip_handler = drmmode_flip_handler; + ++#if HAVE_NOTIFY_FD ++ SetNotifyFd(drmmode->fd, drmmode_notify_fd, X_NOTIFY_READ, pScrn); ++#else + AddGeneralSocket(drmmode->fd); + + /* Register a wakeup handler to get informed on DRM events */ + RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, + drmmode_wakeup_handler, pScrn); ++#endif + + return TRUE; + } +@@ -1535,10 +1552,14 @@ drmmode_screen_fini(ScreenPtr pScreen) + + drmmode_uevent_fini(pScrn); + ++#if HAVE_NOTIFY_FD ++ RemoveNotifyFd(drmmode->fd); ++#else + /* Register a wakeup handler to get informed on DRM events */ + RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, + drmmode_wakeup_handler, pScrn); + RemoveGeneralSocket(drmmode->fd); ++#endif + + drmmode_remove_fb(pScrn); + fd_bo_del(pMsm->scanout); +-- +cgit v1.1 + +From 6c8e21c686578f22d973a243a09c838943ddbadd Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Wed, 7 Dec 2016 17:59:09 -0500 +Subject: Use NotifyFd more completely + +previous commit missed some. + +Signed-off-by: Rob Clark +--- + src/Makefile.am | 1 - + src/compat-api.h | 19 +++++++++++++++++++ + src/drmmode_display.c | 18 ++++++++++++++++++ + 3 files changed, 37 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index d4c1289..f7d5dd1 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -2,7 +2,6 @@ AM_CFLAGS = \ + @XORG_CFLAGS@ \ + @XATRACKER_CFLAGS@ \ + -Wall \ +- -Werror \ + -I$(top_srcdir)/system-includes/ \ + -I$(top_builddir)/ + +diff --git a/src/compat-api.h b/src/compat-api.h +index 80dabc1..af1b922 100644 +--- a/src/compat-api.h ++++ b/src/compat-api.h +@@ -28,6 +28,11 @@ + #ifndef COMPAT_API_H + #define COMPAT_API_H + ++#include ++#include ++#include ++ ++#include + #ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR + #define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] + #define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p +@@ -35,7 +40,13 @@ + + #ifndef XF86_HAS_SCRN_CONV + #define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] ++#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,1,0,0,0) + #define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] ++#else ++#define xf86ScrnToScreen(s) ((s)->pScreen) ++#endif ++#else ++#define xf86ScrnToScreen(s) ((s)->pScreen) + #endif + + #ifndef XF86_SCRN_INTERFACE +@@ -51,12 +62,17 @@ + #define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask + #define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask + ++#define WAKEUPHANDLER_ARGS_DECL int arg, pointer wakeupData, unsigned long result, pointer read_mask ++#define WAKEUPHANDLER_ARGS arg, wakeupData, result, read_mask ++ + #define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen + #define CLOSE_SCREEN_ARGS scrnIndex, pScreen + + #define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags ++#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0 + + #define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags ++#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0 + + #define FREE_SCREEN_ARGS_DECL int arg, int flags + #define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0 +@@ -88,6 +104,9 @@ + #define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask + #endif + ++#define WAKEUPHANDLER_ARGS_DECL ScreenPtr arg, unsigned long result, pointer read_mask ++#define WAKEUPHANDLER_ARGS arg, result, read_mask ++ + #define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen + #define CLOSE_SCREEN_ARGS pScreen + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 53ae677..c3a55e6 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -1381,6 +1381,15 @@ drmmode_handle_uevents(ScrnInfoPtr scrn) + } + #endif + ++#if HAVE_NOTIFY_FD ++static void ++drmmode_udev_notify(int fd, int notify, void *data) ++{ ++ ScrnInfoPtr scrn = data; ++ drmmode_handle_uevents(scrn); ++} ++#endif ++ + static void + drmmode_uevent_init(ScrnInfoPtr scrn) + { +@@ -1407,7 +1416,12 @@ drmmode_uevent_init(ScrnInfoPtr scrn) + return; + } + ++#if HAVE_NOTIFY_FD ++ SetNotifyFd(udev_monitor_get_fd(mon), drmmode_udev_notify, X_NOTIFY_READ, scrn); ++#else + AddGeneralSocket(udev_monitor_get_fd(mon)); ++#endif ++ + drmmode->uevent_monitor = mon; + #endif + } +@@ -1421,7 +1435,11 @@ drmmode_uevent_fini(ScrnInfoPtr scrn) + if (drmmode->uevent_monitor) { + struct udev *u = udev_monitor_get_udev(drmmode->uevent_monitor); + ++#if HAVE_NOTIFY_FD ++ RemoveNotifyFd(udev_monitor_get_fd(drmmode->uevent_monitor)); ++#else + RemoveGeneralSocket(udev_monitor_get_fd(drmmode->uevent_monitor)); ++#endif + udev_monitor_unref(drmmode->uevent_monitor); + udev_unref(u); + } +-- +cgit v1.1 + diff --git a/user/xf86-video-freedreno/secure-atom.patch b/user/xf86-video-freedreno/secure-atom.patch new file mode 100644 index 000000000..17101fb57 --- /dev/null +++ b/user/xf86-video-freedreno/secure-atom.patch @@ -0,0 +1,33 @@ +From ccba8f89995de7d5e1b216e580b789c4cda05035 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 13 Jun 2017 09:26:28 -0400 +Subject: modesetting: Validate the atom for enum properties + +The client could have said anything here, and if what they said doesn't +actually name an atom NameForAtom() will return NULL, and strcmp() will +be unhappy about that. + +[copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc] + +Signed-off-by: Adam Jackson +--- + src/drmmode_display.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index c3a55e6..83f323d 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -898,7 +898,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property, + if (value->type != XA_ATOM || value->format != 32 || value->size != 1) + return FALSE; + memcpy(&atom, value->data, 4); +- name = NameForAtom(atom); ++ if (!(name = NameForAtom(atom))) ++ return FALSE; + + /* search for matching name string, then set its value down */ + for (j = 0; j < p->mode_prop->count_enums; j++) { +-- +cgit v1.1 + -- cgit v1.2.3-70-g09d2