[xorg-x11-server] Add -resizeable option to Xephyr (#962572)
Peter Hutterer
whot at fedoraproject.org
Tue May 14 06:10:10 UTC 2013
commit be419c191b63cb673ccbd345ded671dc65986bec
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue May 14 08:45:17 2013 +1000
Add -resizeable option to Xephyr (#962572)
Fix crash on 24bpp host server (#518960)
0001-ephyr-Add-resizeable-option.patch | 124 ++++++++++++++++++++
...ephyr-Fix-crash-on-24bpp-host-framebuffer.patch | 78 ++++++++++++
xorg-x11-server.spec | 12 ++-
3 files changed, 213 insertions(+), 1 deletions(-)
---
diff --git a/0001-ephyr-Add-resizeable-option.patch b/0001-ephyr-Add-resizeable-option.patch
new file mode 100644
index 0000000..fd50885
--- /dev/null
+++ b/0001-ephyr-Add-resizeable-option.patch
@@ -0,0 +1,124 @@
+From 3aac7a59dc6ef2d8bbf46ba5d37acdf6013e9450 Mon Sep 17 00:00:00 2001
+From: Daniel Martin <daniel.martin at secunet.com>
+Date: Tue, 11 Dec 2012 17:23:55 +0100
+Subject: [PATCH] ephyr: Add -resizeable option
+
+With this option passed, ephyr windows can be resized like normal
+windows on the fly, without the need of an explicit parent window.
+
+Signed-off-by: Daniel Martin <daniel.martin at secunet.com>
+Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ hw/kdrive/ephyr/ephyr.c | 1 +
+ hw/kdrive/ephyr/ephyrinit.c | 6 ++++++
+ hw/kdrive/ephyr/hostx.c | 34 ++++++++++++++++++++++------------
+ 3 files changed, 29 insertions(+), 12 deletions(-)
+
+diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
+index e6520d0..f32e432 100644
+--- a/hw/kdrive/ephyr/ephyr.c
++++ b/hw/kdrive/ephyr/ephyr.c
+@@ -56,6 +56,7 @@ typedef struct _EphyrInputPrivate {
+ } EphyrKbdPrivate, EphyrPointerPrivate;
+
+ Bool EphyrWantGrayScale = 0;
++Bool EphyrWantResize = 0;
+
+ Bool
+ ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
+diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
+index 5e2eb67..adacac9 100644
+--- a/hw/kdrive/ephyr/ephyrinit.c
++++ b/hw/kdrive/ephyr/ephyrinit.c
+@@ -31,6 +31,7 @@
+
+ extern Window EphyrPreExistingHostWin;
+ extern Bool EphyrWantGrayScale;
++extern Bool EphyrWantResize;
+ extern Bool kdHasPointer;
+ extern Bool kdHasKbd;
+
+@@ -116,6 +117,7 @@ ddxUseMsg(void)
+ ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
+ ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
+ ErrorF("-grayscale Simulate 8bit grayscale\n");
++ ErrorF("-resizeable Make Xephyr windows resizeable\n");
+ ErrorF
+ ("-fakexa Simulate acceleration using software rendering\n");
+ ErrorF("-verbosity <level> Set log verbosity level\n");
+@@ -210,6 +212,10 @@ ddxProcessArgument(int argc, char **argv, int i)
+ EphyrWantGrayScale = 1;
+ return 1;
+ }
++ else if (!strcmp(argv[i], "-resizeable")) {
++ EphyrWantResize = 1;
++ return 1;
++ }
+ else if (!strcmp(argv[i], "-fakexa")) {
+ ephyrFuncs.initAccel = ephyrDrawInit;
+ ephyrFuncs.enableAccel = ephyrDrawEnable;
+diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
+index aed0285..c8642cb 100644
+--- a/hw/kdrive/ephyr/hostx.c
++++ b/hw/kdrive/ephyr/hostx.c
+@@ -117,6 +117,8 @@ extern EphyrKeySyms ephyrKeySyms;
+
+ extern int monitorResolution;
+
++extern Bool EphyrWantResize;
++
+ char *ephyrResName = NULL;
+ int ephyrResNameFromCmd = 0;
+ char *ephyrTitle = NULL;
+@@ -697,7 +699,7 @@ hostx_screen_init(EphyrScreenInfo screen,
+ XResizeWindow(HostX.dpy, host_screen->win, width, height);
+
+ /* Ask the WM to keep our size static */
+- if (host_screen->win_pre_existing == None) {
++ if (host_screen->win_pre_existing == None && !EphyrWantResize) {
+ size_hints = XAllocSizeHints();
+ size_hints->max_width = size_hints->min_width = width;
+ size_hints->max_height = size_hints->min_height = height;
+@@ -1012,19 +1014,27 @@ hostx_get_event(EphyrHostXEvent * ev)
+
+ case ConfigureNotify:
+ {
+- struct EphyrHostScreen *host_screen =
+- host_screen_from_window(xev.xconfigure.window);
+-
+- if (host_screen && host_screen->win_pre_existing != None) {
+- ev->type = EPHYR_EV_CONFIGURE;
+- ev->data.configure.width = xev.xconfigure.width;
+- ev->data.configure.height = xev.xconfigure.height;
+- ev->data.configure.window = xev.xconfigure.window;
+- ev->data.configure.screen = host_screen->mynum;
+- return 1;
++ struct EphyrHostScreen *host_screen;
++
++ /* event compression as for Expose events, cause
++ * we don't want to resize the framebuffer for
++ * every single change */
++ while (XCheckTypedWindowEvent(HostX.dpy, xev.xconfigure.window,
++ ConfigureNotify, &xev));
++ host_screen = host_screen_from_window(xev.xconfigure.window);
++
++ if (!host_screen ||
++ (host_screen->win_pre_existing == None && !EphyrWantResize)) {
++ return 0;
+ }
+
+- return 0;
++ ev->type = EPHYR_EV_CONFIGURE;
++ ev->data.configure.width = xev.xconfigure.width;
++ ev->data.configure.height = xev.xconfigure.height;
++ ev->data.configure.window = xev.xconfigure.window;
++ ev->data.configure.screen = host_screen->mynum;
++
++ return 1;
+ }
+ default:
+ break;
+--
+1.8.1.4
+
diff --git a/0001-ephyr-Fix-crash-on-24bpp-host-framebuffer.patch b/0001-ephyr-Fix-crash-on-24bpp-host-framebuffer.patch
new file mode 100644
index 0000000..43297bf
--- /dev/null
+++ b/0001-ephyr-Fix-crash-on-24bpp-host-framebuffer.patch
@@ -0,0 +1,78 @@
+From bd58ebe4cf3b0ce60f87fb26a3715f774dabd349 Mon Sep 17 00:00:00 2001
+From: Daniel Martin <consume.noise at gmail.com>
+Date: Thu, 20 Dec 2012 13:50:17 +0100
+Subject: [PATCH] ephyr: Fix crash on 24bpp host framebuffer
+
+Use bytes_per_line and bits_per_pixel from the created XImage to fix
+ https://bugzilla.redhat.com/show_bug.cgi?id=518960
+
+Signed-off-by: Daniel Martin <consume.noise at gmail.com>
+Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ hw/kdrive/ephyr/ephyr.c | 6 ++----
+ hw/kdrive/ephyr/hostx.c | 6 +++++-
+ hw/kdrive/ephyr/hostx.h | 3 ++-
+ 3 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
+index f32e432..02d4970 100644
+--- a/hw/kdrive/ephyr/ephyr.c
++++ b/hw/kdrive/ephyr/ephyr.c
+@@ -238,13 +238,11 @@ ephyrMapFramebuffer(KdScreenInfo * screen)
+ KdComputePointerMatrix(&m, ephyrRandr, screen->width, screen->height);
+ KdSetPointerMatrix(&m);
+
+- priv->bytes_per_line =
+- ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
+-
+ buffer_height = ephyrBufferHeight(screen);
+
+ priv->base =
+- hostx_screen_init(screen, screen->width, screen->height, buffer_height);
++ hostx_screen_init(screen, screen->width, screen->height, buffer_height,
++ &priv->bytes_per_line, &screen->fb.bitsPerPixel);
+
+ if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) {
+ scrpriv->shadow = FALSE;
+diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
+index c8642cb..f2b458d 100644
+--- a/hw/kdrive/ephyr/hostx.c
++++ b/hw/kdrive/ephyr/hostx.c
+@@ -619,7 +619,8 @@ hostx_set_cmap_entry(unsigned char idx,
+ */
+ void *
+ hostx_screen_init(EphyrScreenInfo screen,
+- int width, int height, int buffer_height)
++ int width, int height, int buffer_height,
++ int *bytes_per_line, int *bits_per_pixel)
+ {
+ int bitmap_pad;
+ Bool shm_success = False;
+@@ -696,6 +697,9 @@ hostx_screen_init(EphyrScreenInfo screen,
+ malloc(host_screen->ximg->bytes_per_line * buffer_height);
+ }
+
++ *bytes_per_line = host_screen->ximg->bytes_per_line;
++ *bits_per_pixel = host_screen->ximg->bits_per_pixel;
++
+ XResizeWindow(HostX.dpy, host_screen->win, width, height);
+
+ /* Ask the WM to keep our size static */
+diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
+index 31c4053..38b7b37 100644
+--- a/hw/kdrive/ephyr/hostx.h
++++ b/hw/kdrive/ephyr/hostx.h
+@@ -193,7 +193,8 @@ hostx_set_cmap_entry(unsigned char idx,
+ unsigned char r, unsigned char g, unsigned char b);
+
+ void *hostx_screen_init(EphyrScreenInfo screen,
+- int width, int height, int buffer_height);
++ int width, int height, int buffer_height,
++ int *bytes_per_line, int *bits_per_pixel);
+
+ void
+
+--
+1.8.1.4
+
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 80c61c7..d456331 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -42,7 +42,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.14.1
-Release: 1%{?gitdate:.%{gitdate}}%{dist}
+Release: 2%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@@ -109,6 +109,12 @@ Patch7052: 0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch
# mustard: make the default queue length bigger to calm abrt down
Patch7064: 0001-mieq-Bump-default-queue-size-to-512.patch
+# Bug 962572 - X-sandboxes are not resizeable
+# enabled by default until sandbox -X uses the option
+Patch7065: 0001-ephyr-Add-resizeable-option.patch
+# Bug 518960 - Xephyr crashes in 24bpp
+Patch7067: 0001-ephyr-Fix-crash-on-24bpp-host-framebuffer.patch
+
# upstream in -next for 1.15, e21e183059df5975e7086850d1931edb2c1bbd06
%if !0%{?rhel}
Patch7071: 0001-os-use-libunwind-to-generate-backtraces.patch
@@ -586,6 +592,10 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
+* Tue May 14 2013 Peter Hutterer <peter.hutterer at redhat.com> 1.14.1-2
+- Add -resizeable option to Xephyr, enable by default (#962572)
+- Fix crash on 24bpp host server (#518960)
+
* Mon May 06 2013 Dave Airlie <airlied at redhat.com> 1.14.1-1
- upstream rebase
- reorganise the randr/gpu screen patches + backports
More information about the scm-commits
mailing list