Skip to content
Snippets Groups Projects
Verified Commit e4dba800 authored by Casey's avatar Casey :recycle: Committed by Clayton Craft
Browse files

CHECK: systemd/xorg-server: new aport


Clayton says: this integrates with systemd (logind specificially)

Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 5e629fe8
Branches
No related tags found
No related merge requests found
# Forked from Alpine to adjust dependencies for systemd
pkgname=xorg-server
pkgver=9999
_pkgver=21.1.10
pkgrel=0
pkgdesc="X.Org X servers"
url="https://www.x.org/wiki"
arch="all"
license="MIT"
options="suid"
subpackages="
$pkgname-dbg
$pkgname-dev
$pkgname-doc
xvfb
$pkgname-xephyr
$pkgname-xnest
$pkgname-common::noarch
"
depends="
font-cursor-misc
font-misc-misc
mesa-egl
xinit
xkbcomp
xkeyboard-config
xorg-server-common
"
depends_dev="
libepoxy-dev
libpciaccess-dev
libxfont2-dev
mesa-dev
"
makedepends="
$depends_dev
dbus-dev
libdrm-dev
libx11-dev
libxau-dev
libxcb-dev
libxcvt-dev
libxdmcp-dev
libxext-dev
libxkbfile-dev
libxshmfence-dev
meson
nettle-dev
pixman-dev
udev-dev
wayland-dev
wayland-protocols
xcb-util-dev
xcb-util-image-dev
xcb-util-keysyms-dev
xcb-util-renderutil-dev
xcb-util-wm-dev
xkbcomp-dev
xorgproto
xtrans
xz
"
source="https://www.x.org/releases/individual/xserver/xorg-server-$_pkgver.tar.xz
ms-rotate.patch"
builddir="$srcdir/xorg-server-$_pkgver"
# the modesetting driver is now shipped with xorg server
provides="xf86-video-modesetting=$pkgver-r$pkgrel"
replaces="xf86-video-modesetting"
# secfixes:
# 21.1.7-r0:
# - CVE-2023-0494
# 21.1.5-r0:
# - CVE-2022-4283
# - CVE-2022-46340
# - CVE-2022-46341
# - CVE-2022-46342
# - CVE-2022-46343
# - CVE-2022-46344
# 21.1.4-r0:
# - CVE-2022-2319
# - CVE-2022-2320
# 21.1.2-r0:
# - CVE-2021-4008
# - CVE-2021-4009
# - CVE-2021-4010
# - CVE-2021-4011
# 1.20.10-r5:
# - CVE-2021-3472
# 1.20.10-r0:
# - CVE-2020-14360
# - CVE-2020-25712
# 1.20.9-r0:
# - CVE-2020-14362
# - CVE-2020-14361
# - CVE-2020-14346
# - CVE-2020-14345
# 1.20.8-r4:
# - CVE-2020-14347
# 1.20.3-r0:
# - CVE-2018-14665
# 1.19.5-r0:
# - CVE-2017-12176
# - CVE-2017-12177
# - CVE-2017-12178
# - CVE-2017-12179
# - CVE-2017-12180
# - CVE-2017-12181
# - CVE-2017-12182
# - CVE-2017-12183
# - CVE-2017-12184
# - CVE-2017-12185
# - CVE-2017-12186
# - CVE-2017-12187
# - CVE-2017-13721
# - CVE-2017-13723
prepare() {
default_prepare
sed -i -e 's/termio.h/termios.h/' hw/xfree86/os-support/xf86_OSlib.h
}
build() {
# xorg modules does not work with the -z now and it seems like we
# cannot pass over the linker flag to .so files. so we tweak the
# gcc specs.
export CFLAGS="${CFLAGS/-fno-plt}"
export CXXFLAGS="${CXXFLAGS/-fno-plt}"
export LDFLAGS="$LDFLAGS -Wl,-z,lazy"
_fontroot="/usr/share/fonts"
# 32-bit fails otherwise
export CFLAGS="$CFLAGS -Wno-error=array-bounds"
abuild-meson \
-Db_lto=true \
-Dxorg=true \
-Dxephyr=true \
-Dglamor=true \
-Dxnest=true \
-Dxvfb=true \
-Dxwin=false \
-Ddefault_font_path=$_fontroot/misc,$_fontroot/100dpi:unscaled,$_fontroot/75dpi:unscaled,$_fontroot/TTF,$_fontroot/Type1 \
-Dglx=true \
-Dxdmcp=true \
-Dxdm-auth-1=true \
-Dxcsecurity=true \
-Dsecure-rpc=false \
-Dipv6=true \
-Dxkb_dir=/usr/share/X11/xkb \
-Dxkb_output_dir=/var/lib/xkb \
-Dlisten_tcp=false \
-Dlisten_unix=true \
-Dlisten_local=true \
-Dsuid_wrapper=true \
-Dpciaccess=true \
-Dudev=true \
-Dhal=false \
-Dsystemd_logind=true \
-Ddpms=true \
-Ddri1=true \
-Ddri2=true \
-Ddri3=true \
. output
meson compile -C output
}
check() {
meson test --no-rebuild --print-errorlogs -C output
}
package() {
DESTDIR="$pkgdir" meson install --no-rebuild -C output
chmod u+s "$pkgdir"/usr/libexec/Xorg.wrap
# Don't conflict with xf86-input-evdev
rm -f "$pkgdir"/usr/share/X11/xorg.conf.d/10-evdev.conf
install -Dm0644 xkb/README.compiled -t "$pkgdir"/var/lib/xkb
}
xvfb() {
pkgdesc="Virtual Framebuffer 'fake' X server"
amove usr/bin/Xvfb
}
xephyr() {
pkgdesc="kdrive based X Server which targets a window on a host X Server as its framebuffer"
amove usr/bin/Xephyr
}
xnest() {
pkgdesc="A nested Xorg server"
amove usr/bin/Xnest
}
common() {
depends=""
pkgdesc="Xorg server common files"
amove usr/lib/xorg/protocol.txt
}
sha512sums="
8135d9b7c0c71f427ba0a3b80741fee4f6ae195779399b73261a00858882f3516e367a08e2da1403734b04eacabae9aa231e5375eff23b57a3ff764e9caf8926 xorg-server-21.1.10.tar.xz
9ed9c731a7275a3821476eedd55f453027fdf9bcdfd8f259259a5d053c73e8b9298f048cbb009a4fb05230fb2a9ab7cc38a44d708973f09daa8570fae376236e ms-rotate.patch
"
commit db9e9d45e8ba73510f11eb9e534c176102f6623e
Author: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Date: Wed Jun 9 20:58:59 2021 +0200
modesetting: Fix dirty updates for sw rotation
Rotation is broken for all drm drivers not providing hardware rotation
support. Drivers that give direct access to vram and not needing dirty
updates still work but only by accident. The problem is caused by
modesetting not sending the correct fb_id to drmModeDirtyFB() and
passing the damage rects in the rotated state and not as the crtc
expects them. This patch takes care of both problems.
Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de>
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 535f49d1d..fe3315a9c 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -515,9 +515,41 @@ GetRec(ScrnInfoPtr pScrn)
return TRUE;
}
+static void
+rotate_clip(PixmapPtr pixmap, BoxPtr rect, drmModeClip *clip, Rotation rotation)
+{
+ int w = pixmap->drawable.width;
+ int h = pixmap->drawable.height;
+
+ if (rotation == RR_Rotate_90) {
+ /* Rotate 90 degrees counter clockwise */
+ clip->x1 = rect->y1;
+ clip->x2 = rect->y2;
+ clip->y1 = w - rect->x2;
+ clip->y2 = w - rect->x1;
+ } else if (rotation == RR_Rotate_180) {
+ /* Rotate 180 degrees */
+ clip->x1 = w - rect->x2;
+ clip->x2 = w - rect->x1;
+ clip->y1 = h - rect->y2;
+ clip->y2 = h - rect->y1;
+ } else if (rotation == RR_Rotate_270) {
+ /* Rotate 90 degrees clockwise */
+ clip->x1 = h - rect->y2;
+ clip->x2 = h - rect->y1;
+ clip->y1 = rect->x1;
+ clip->y2 = rect->x2;
+ } else {
+ clip->x1 = rect->x1;
+ clip->x2 = rect->x2;
+ clip->y1 = rect->y1;
+ clip->y2 = rect->y2;
+ }
+}
+
static int
-dispatch_dirty_region(ScrnInfoPtr scrn,
- PixmapPtr pixmap, DamagePtr damage, int fb_id)
+dispatch_dirty_region(ScrnInfoPtr scrn, xf86CrtcPtr crtc,
+ PixmapPtr pixmap, DamagePtr damage, int fb_id)
{
modesettingPtr ms = modesettingPTR(scrn);
RegionPtr dirty = DamageRegion(damage);
@@ -532,13 +564,9 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
if (!clip)
return -ENOMEM;
- /* XXX no need for copy? */
- for (i = 0; i < num_cliprects; i++, rect++) {
- clip[i].x1 = rect->x1;
- clip[i].y1 = rect->y1;
- clip[i].x2 = rect->x2;
- clip[i].y2 = rect->y2;
- }
+ /* Rotate and copy rects into clips */
+ for (i = 0; i < num_cliprects; i++, rect++)
+ rotate_clip(pixmap, rect, &clip[i], crtc->rotation);
/* TODO query connector property to see if this is needed */
ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
@@ -561,20 +589,31 @@ static void
dispatch_dirty(ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
modesettingPtr ms = modesettingPTR(scrn);
PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen);
- int fb_id = ms->drmmode.fb_id;
- int ret;
+ uint32_t fb_id;
+ int ret, c, x, y ;
- ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id);
- if (ret == -EINVAL || ret == -ENOSYS) {
- ms->dirty_enabled = FALSE;
- DamageUnregister(ms->damage);
- DamageDestroy(ms->damage);
- ms->damage = NULL;
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Disabling kernel dirty updates, not required.\n");
- return;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ if (!drmmode_crtc)
+ continue;
+
+ drmmode_crtc_get_fb_id(crtc, &fb_id, &x, &y);
+
+ ret = dispatch_dirty_region(scrn, crtc, pixmap, ms->damage, fb_id);
+ if (ret == -EINVAL || ret == -ENOSYS) {
+ ms->dirty_enabled = FALSE;
+ DamageUnregister(ms->damage);
+ DamageDestroy(ms->damage);
+ ms->damage = NULL;
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Disabling kernel dirty updates, not required.\n");
+ return;
+ }
}
}
@@ -586,7 +625,7 @@ dispatch_dirty_pixmap(ScrnInfoPtr scrn, xf86CrtcPtr crtc, PixmapPtr ppix)
DamagePtr damage = ppriv->secondary_damage;
int fb_id = ppriv->fb_id;
- dispatch_dirty_region(scrn, ppix, damage, fb_id);
+ dispatch_dirty_region(scrn, crtc, ppix, damage, fb_id);
}
static void
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index ab352a451..4ad6170ca 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -627,7 +627,7 @@ drmmode_crtc_can_test_mode(xf86CrtcPtr crtc)
return ms->atomic_modeset;
}
-static Bool
+Bool
drmmode_crtc_get_fb_id(xf86CrtcPtr crtc, uint32_t *fb_id, int *x, int *y)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 29f9b8f7d..2a9a91529 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -311,6 +311,8 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
int drmmode_crtc_flip(xf86CrtcPtr crtc, uint32_t fb_id, uint32_t flags, void *data);
+Bool drmmode_crtc_get_fb_id(xf86CrtcPtr crtc, uint32_t *fb_id, int *x, int *y);
+
void drmmode_set_dpms(ScrnInfoPtr scrn, int PowerManagementMode, int flags);
void drmmode_crtc_set_vrr(xf86CrtcPtr crtc, Bool enabled);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment