summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvery2022-11-04 20:30:04 +0800
committerAvery2022-11-04 20:30:04 +0800
commit6b16b62b491a29be7f76be3fd5c6b5371376c3c4 (patch)
treef3bddc2dc5b575107f1d36d06c16378f22229d56
parent959a302919bd471515789cac960b104c809c1e4c (diff)
downloadaur-6b16b62b491a29be7f76be3fd5c6b5371376c3c4.tar.gz
feature: add native-res RandR mode
-rw-r--r--.SRCINFO4
-rw-r--r--0002_Add_unscaled_output_mode.patch135
-rw-r--r--PKGBUILD9
3 files changed, 144 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 75ab491a8e6f..917a4a44a752 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = xorg-xwayland-hidpi-xprop-git
pkgdesc = run X clients under wayland, with !733 HiDPI patch
- pkgver = 22.1.4.r138.g459e28557
+ pkgver = 22.1.5.r138.g459e28557
pkgrel = 1
url = https://xorg.freedesktop.org
arch = x86_64
@@ -34,8 +34,10 @@ pkgbase = xorg-xwayland-hidpi-xprop-git
source = git+https://gitlab.freedesktop.org/xorg/xserver.git
source = 0000_Multi_DPI_support_via_global_factor_rescaling.patch::https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733.patch
source = 0001_Remove_scale_atom_access_control.patch
+ source = 0002_Add_unscaled_output_mode.patch
sha512sums = SKIP
sha512sums = ab927b1e038346f967723a3d45a405a0a8339759e15901d0913a55d1348683831e0d058c76c6f7cb2e264a5cef781a507fb290d139ac0f2806a62bd20d84147d
sha512sums = f16cb5455a1caf26c586cca2d1ec6f4708804721b7d6a8d8bd1e4a7b47b97e8b822d3455fce0da3c74bb14baf6a3980574d85019cf242d6a033a578587f74b14
+ sha512sums = fdaa9f489bb722c70e674271fe19bac7d7c7facc38ed305923077487f3e971d31ee0102cbd52770b35fa270744182a154ced7e039b26ef5952147357d889990d
pkgname = xorg-xwayland-hidpi-xprop-git
diff --git a/0002_Add_unscaled_output_mode.patch b/0002_Add_unscaled_output_mode.patch
new file mode 100644
index 000000000000..4bb40215fe10
--- /dev/null
+++ b/0002_Add_unscaled_output_mode.patch
@@ -0,0 +1,135 @@
+Port of !861; add both native (and unscaled) resolution modes for
+fullscreen games to optionally use
+diff --color --unified --recursive --text a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
+--- a/hw/xwayland/xwayland-output.c 2022-11-04 18:03:48.829975351 +0800
++++ b/hw/xwayland/xwayland-output.c 2022-11-04 20:14:56.556451921 +0800
+@@ -117,6 +117,8 @@
+ xwl_output->width = width;
+ xwl_output->height = height;
+ }
++ xwl_output->mode_width = width;
++ xwl_output->mode_height = height;
+ xwl_output->refresh = refresh;
+ }
+
+@@ -345,37 +347,74 @@
+ */
+ static RRModePtr *
+ output_get_rr_modes(struct xwl_output *xwl_output,
+- int32_t width, int32_t height,
+- int *count)
++ int32_t width, int32_t height, int scale,
++ int *count, RRModePtr **preferred_mode)
+ {
+ struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+ RRModePtr *rr_modes;
++ int sw = width;
++ int sh = height;
++ float refresh;
+ int i;
+
+- rr_modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
++ rr_modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 3, sizeof(RRModePtr));
+ if (!rr_modes)
+ goto err;
+
+- /* Add actual output mode */
+- rr_modes[0] = xwayland_cvt(width, height, xwl_output->refresh / 1000.0, 0, 0);
+- if (!rr_modes[0])
++ /* Add actual output modes */
++ refresh = xwl_output->refresh / 1000.0;
++ *count = 0;
++
++ if (width != xwl_output->mode_width ||
++ height != xwl_output->mode_height) {
++ rr_modes[*count] = xwayland_cvt(xwl_output->mode_width, xwl_output->mode_height, refresh, 0, 0);
++ if (!rr_modes[*count])
++ goto err;
++
++ (*count)++;
++ }
++
++ if (scale != 1) {
++ sw *= scale;
++ sh *= scale;
++ *preferred_mode = rr_modes[*count] = xwayland_cvt(sw, sh, refresh, 0, 0);
++ if (!rr_modes[*count])
++ goto err;
++
++ (*count)++;
++ }
++
++ rr_modes[*count] = xwayland_cvt(width, height, refresh, 0, 0);
++ if (!rr_modes[*count])
+ goto err;
+
+- *count = 1;
++ if (scale == 1) {
++ *preferred_mode = rr_modes[*count];
++ }
++
++ (*count)++;
+
+ if (!xwl_screen_has_resolution_change_emulation(xwl_screen) && !xwl_screen->force_xrandr_emulation)
+ return rr_modes;
+
+ /* Add fake modes */
+ for (i = 0; i < ARRAY_SIZE(xwl_output_fake_modes); i++) {
+- /* Skip actual output mode, already added */
++ /* Skip actual output modes, already added */
++ if (xwl_output_fake_modes[i][0] == sw &&
++ xwl_output_fake_modes[i][1] == sh)
++ continue;
++
+ if (xwl_output_fake_modes[i][0] == width &&
+ xwl_output_fake_modes[i][1] == height)
+ continue;
+
++ if (xwl_output_fake_modes[i][0] == xwl_output->mode_width &&
++ xwl_output_fake_modes[i][1] == xwl_output->mode_height)
++ continue;
++
+ /* Skip modes which are too big, avoid downscaling */
+- if (xwl_output_fake_modes[i][0] > width ||
+- xwl_output_fake_modes[i][1] > height)
++ if (xwl_output_fake_modes[i][0] > sw ||
++ xwl_output_fake_modes[i][1] > sh)
+ continue;
+
+ rr_modes[*count] = xwayland_cvt(xwl_output_fake_modes[i][0],
+@@ -604,7 +643,7 @@
+ struct xwl_output *it;
+ int mode_width, mode_height, count;
+ int width = 0, height = 0, has_this_output = 0;
+- RRModePtr *randr_modes;
++ RRModePtr *randr_modes, *preferred_mode;
+ int32_t scale = xwl_screen->global_output_scale;
+
+ /* Clear out the "done" received flags */
+@@ -624,9 +663,12 @@
+ }
+ if (xwl_output->randr_output) {
+ /* Build a fresh modes array using the current refresh rate */
+- randr_modes = output_get_rr_modes(xwl_output, mode_width * scale, mode_height * scale, &count);
++ randr_modes = output_get_rr_modes(xwl_output,
++ mode_width, mode_height,
++ scale,
++ &count, &preferred_mode);
+ RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
+- RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
++ RRCrtcNotify(xwl_output->randr_crtc, preferred_mode,
+ xwl_output->x * scale, xwl_output->y * scale,
+ xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+ /* RROutputSetModes takes ownership of the passed in modes, so we only
+diff --color --unified --recursive --text a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h
+--- a/hw/xwayland/xwayland-output.h 2022-11-04 18:03:48.829975351 +0800
++++ b/hw/xwayland/xwayland-output.h 2022-11-04 19:35:55.563174939 +0800
+@@ -53,7 +53,7 @@
+ struct wl_output *output;
+ struct zxdg_output_v1 *xdg_output;
+ uint32_t server_output_id;
+- int32_t x, y, width, height, scale, refresh;
++ int32_t x, y, width, height, mode_width, mode_height, scale, refresh;
+ Rotation rotation;
+ Bool wl_output_done;
+ Bool xdg_output_done;
diff --git a/PKGBUILD b/PKGBUILD
index fb6eb8cda1a3..b2caebce6178 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@
# Contributor: AndyRTR <andyrtr@archlinux.org>
pkgname=xorg-xwayland-hidpi-xprop-git
-pkgver=22.1.4.r138.g459e28557
+pkgver=22.1.5.r138.g459e28557
pkgrel=1
arch=('x86_64')
license=('custom')
@@ -22,10 +22,12 @@ makedepends=('meson' 'xorgproto-git' 'xtrans' 'libxkbfile' 'dbus'
)
source=(git+https://gitlab.freedesktop.org/xorg/xserver.git
0000_Multi_DPI_support_via_global_factor_rescaling.patch::https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733.patch
- 0001_Remove_scale_atom_access_control.patch)
+ 0001_Remove_scale_atom_access_control.patch
+ 0002_Add_unscaled_output_mode.patch)
sha512sums=('SKIP'
'ab927b1e038346f967723a3d45a405a0a8339759e15901d0913a55d1348683831e0d058c76c6f7cb2e264a5cef781a507fb290d139ac0f2806a62bd20d84147d'
- 'f16cb5455a1caf26c586cca2d1ec6f4708804721b7d6a8d8bd1e4a7b47b97e8b822d3455fce0da3c74bb14baf6a3980574d85019cf242d6a033a578587f74b14')
+ 'f16cb5455a1caf26c586cca2d1ec6f4708804721b7d6a8d8bd1e4a7b47b97e8b822d3455fce0da3c74bb14baf6a3980574d85019cf242d6a033a578587f74b14'
+ 'fdaa9f489bb722c70e674271fe19bac7d7c7facc38ed305923077487f3e971d31ee0102cbd52770b35fa270744182a154ced7e039b26ef5952147357d889990d')
provides=('xorg-server-xwayland' 'xorg-xwayland')
conflicts=('xorg-server-xwayland' 'xorg-xwayland')
replaces=('xorg-server-xwayland')
@@ -44,6 +46,7 @@ prepare() {
cd xserver
patch -Np1 -i "${srcdir}/0000_Multi_DPI_support_via_global_factor_rescaling.patch"
patch -Np1 -i "${srcdir}/0001_Remove_scale_atom_access_control.patch"
+ patch -Np1 -i "${srcdir}/0002_Add_unscaled_output_mode.patch"
}
build() {