Re: [PATCH] ephyr: Add -resizeable option
On Tue, Dec 11, 2012 at 05:23:55PM +0100, Daniel Martin wrote: > From: Daniel Martin > > 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 Acked-by: Peter Hutterer Cheers, Peter > --- > 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("-verbositySet 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 157ac36..54cd2af 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; > @@ -1011,19 +1013,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.7.9.5 > > ___ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel >
[PATCH 3/3] Xi: if a MD is removed, send a barrier leave event (if applicable)
Signed-off-by: Peter Hutterer --- Xi/xibarriers.c | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 1714634..7b7b83f 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -714,12 +714,41 @@ static void remove_master_func(pointer res, XID id, pointer devid) struct PointerBarrierDevice *pbd; struct PointerBarrierClient *barrier; struct PointerBarrier *b; +DeviceIntPtr dev; int *deviceid = devid; +int rc; +Time ms = GetTimeInMillis(); + +rc = dixLookupDevice(&dev, *deviceid, serverClient, DixSendAccess); +if (rc != Success) +return; b = res; barrier = container_of(b, struct PointerBarrierClient, barrier); pbd = GetBarrierDevice(barrier, *deviceid); + +if (pbd->hit) { +BarrierEvent ev = { +.header = ET_Internal, +.type =ET_BarrierLeave, +.length = sizeof (BarrierEvent), +.time = ms, +.deviceid = *deviceid, +.sourceid = 0, +.dx = 0, +.dy = 0, +.root = barrier->screen->root->drawable.id, +.window = barrier->window, +.dt = ms - pbd->last_timestamp, +.flags = XIBarrierPointerReleased, +.event_id = pbd->barrier_event_id, +.barrierid = barrier->id, +}; + +mieqEnqueue(dev, (InternalEvent *) &ev); +} + xorg_list_del(&pbd->entry); free(pbd); } @@ -731,7 +760,6 @@ void XIBarrierNewMasterDevice(ClientPtr client, int deviceid) void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid) { -/* FIXME: send LeaveNotify */ FindClientResourcesByType(client, PointerBarrierType, remove_master_func, &deviceid); } -- 1.8.0.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/3] Xi: don't store the window pointer in barriers, store the window ID
When a client shuts down and resources are being freed, the window may have been freed already, so accessing it to get the window ID is bad. Plus, we never care about the window anyway other than for stuffing it into the event. Signed-off-by: Peter Hutterer --- Xi/xibarriers.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 7e8b2e6..1714634 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -80,7 +80,7 @@ struct PointerBarrierDevice { struct PointerBarrierClient { XID id; ScreenPtr screen; -WindowPtr window; +Window window; struct PointerBarrier barrier; struct xorg_list entry; /* num_devices/device_ids are devices the barrier applies to */ @@ -467,7 +467,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, ev.barrierid = c->id; ev.dt = ms - pbd->last_timestamp; -ev.window = c->window->drawable.id; +ev.window = c->window; pbd->last_timestamp = ms; /* root x/y is filled in later */ @@ -501,7 +501,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, ev.barrierid = c->id; ev.dt = ms - pbd->last_timestamp; -ev.window = c->window->drawable.id; +ev.window = c->window; pbd->last_timestamp = ms; /* root x/y is filled in later */ @@ -566,7 +566,7 @@ CreatePointerBarrierClient(ClientPtr client, cs = GetBarrierScreen(screen); ret->screen = screen; -ret->window = pWin; +ret->window = stuff->window; ret->num_devices = stuff->num_devices; if (ret->num_devices > 0) ret->device_ids = (int*)&ret[1]; @@ -656,7 +656,7 @@ BarrierFreeBarrier(void *data, XID id) /* .deviceid */ .sourceid = 0, .barrierid = c->id, -.window = c->window->drawable.id, +.window = c->window, .root = screen->root->drawable.id, .dx = 0, .dy = 0, -- 1.8.0.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 1/3] Xi: fix per-device barrier handling
Signed-off-by: Peter Hutterer --- Xi/xibarriers.c| 235 ++--- Xi/xibarriers.h| 3 + Xi/xichangehierarchy.c | 6 ++ 3 files changed, 195 insertions(+), 49 deletions(-) diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 048af62..7e8b2e6 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -67,19 +67,28 @@ static DevPrivateKeyRec BarrierScreenPrivateKeyRec; typedef struct PointerBarrierClient *PointerBarrierClientPtr; +struct PointerBarrierDevice { +struct xorg_list entry; +int deviceid; +Time last_timestamp; +int barrier_event_id; +int release_event_id; +Bool hit; +Bool seen; +}; + struct PointerBarrierClient { XID id; ScreenPtr screen; WindowPtr window; struct PointerBarrier barrier; struct xorg_list entry; +/* num_devices/device_ids are devices the barrier applies to */ int num_devices; int *device_ids; /* num_devices */ -Time last_timestamp; -int barrier_event_id; -int release_event_id; -Bool hit; -Bool seen; + +/* per_device keeps track of devices actually blocked by barriers */ +struct xorg_list per_device; }; typedef struct _BarrierScreen { @@ -90,6 +99,47 @@ typedef struct _BarrierScreen { #define GetBarrierScreenIfSet(s) GetBarrierScreen(s) #define SetBarrierScreen(s,p) dixSetPrivate(&(s)->devPrivates, BarrierScreenPrivateKey, p) +static struct PointerBarrierDevice *AllocBarrierDevice(void) +{ +struct PointerBarrierDevice *pbd = NULL; + +pbd = malloc(sizeof(struct PointerBarrierDevice)); +if (!pbd) +return NULL; + +pbd->deviceid = -1; /* must be set by caller */ +pbd->barrier_event_id = 1; +pbd->release_event_id = 0; +pbd->hit = FALSE; +pbd->seen = FALSE; +xorg_list_init(&pbd->entry); + +return pbd; +} + +static void FreePointerBarrierClient(struct PointerBarrierClient *c) +{ +struct PointerBarrierDevice *pbd = NULL, *tmp = NULL; + +xorg_list_for_each_entry_safe(pbd, tmp, &c->per_device, entry) { +free(pbd); +} +free(c); +} + +static struct PointerBarrierDevice *GetBarrierDevice(struct PointerBarrierClient *c, int deviceid) +{ +struct PointerBarrierDevice *pbd = NULL; + +xorg_list_for_each_entry(pbd, &c->per_device, entry) { +if (pbd->deviceid == deviceid) +break; +} + +BUG_WARN(!pbd); +return pbd; +} + static BOOL barrier_is_horizontal(const struct PointerBarrier *barrier) { @@ -283,9 +333,11 @@ barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev, xorg_list_for_each_entry(c, &cs->barriers, entry) { struct PointerBarrier *b = &c->barrier; +struct PointerBarrierDevice *pbd; double distance; -if (c->seen) +pbd = GetBarrierDevice(c, dev->id); +if (pbd->seen) continue; if (!barrier_is_blocking_direction(b, dir)) @@ -358,6 +410,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, .root = screen->root->drawable.id, }; InternalEvent *barrier_events = events; +DeviceIntPtr master; if (nevents) *nevents = 0; @@ -365,6 +418,13 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, if (xorg_list_is_empty(&cs->barriers) || IsFloating(dev)) goto out; +/** + * This function is only called for slave devices, but pointer-barriers + * are for master-devices only. Flip the device to the master here, + * continue with that. + */ +master = GetMaster(dev, MASTER_POINTER); + /* How this works: * Given the origin and the movement vector, get the nearest barrier * to the origin that is blocking the movement. @@ -375,16 +435,19 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, dir = barrier_get_direction(current_x, current_y, x, y); while (dir != 0) { -c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y); +struct PointerBarrierDevice *pbd; + +c = barrier_find_nearest(cs, master, dir, current_x, current_y, x, y); if (!c) break; nearest = &c->barrier; -c->seen = TRUE; -c->hit = TRUE; +pbd = GetBarrierDevice(c, master->id); +pbd->seen = TRUE; +pbd->hit = TRUE; -if (c->barrier_event_id == c->release_event_id) +if (pbd->barrier_event_id == pbd->release_event_id) continue; ev.type = ET_BarrierHit; @@ -400,12 +463,12 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, } ev.flags = 0; -ev.event_id = c->barrier_event_id; +ev.event_id = pbd->barrier_event_id; ev.barrierid = c->id; -ev.dt = ms - c->last_timestamp; +ev.dt = ms - pbd->last_timestamp; ev.window = c->window->drawable.id; -c->last_timestamp = ms; +pbd->last_timestamp = ms; /* root x/y is filled in lat
[PATCH 0/3] per-device pointer barrier event handling
These are the promised fixes for pointer-barrier events if there is more than master pointer, plus a fix to avoid accessing recently-freed memory (if a event is sent after a barrier is destroyed) Yesterday's series plus these three should conclude the pointer barrier event/release support. Cheers, Peter ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
xserver 1.13.1-rcs any issues?
Hi all, Tomorrow is scheduled the maintenance release of xserver 1.13.1. Has anyone found any issues with any of the RCs? thanks, Matt ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH] Xi: don't use devices after removing them
RemoveDevice() frees the DeviceIntPtr, we shouldn't use the pointer after that Signed-off-by: Peter Hutterer --- Xi/xichangehierarchy.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index a2cb832..0184eb2 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -309,15 +309,15 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES]) flags[keybd->id] |= XIDeviceDisabled; flags[ptr->id] |= XIDeviceDisabled; -RemoveDevice(XTestptr, FALSE); -RemoveDevice(XTestkeybd, FALSE); -RemoveDevice(keybd, FALSE); -RemoveDevice(ptr, FALSE); flags[XTestptr->id] |= XISlaveRemoved; flags[XTestkeybd->id] |= XISlaveRemoved; flags[keybd->id] |= XIMasterRemoved; flags[ptr->id] |= XIMasterRemoved; +RemoveDevice(XTestptr, FALSE); +RemoveDevice(XTestkeybd, FALSE); +RemoveDevice(keybd, FALSE); +RemoveDevice(ptr, FALSE); unwind: return rc; -- 1.8.0.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] xfree86: print message to the log when zapping the server
Peter reminded me that this is not called from a signal handler. Reviewed-by: Aaron Plattner -- Aaron On 12/11/2012 05:02 PM, Peter Hutterer wrote: Signed-off-by: Peter Hutterer --- hw/xfree86/common/xf86Events.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 9dabf10..d8d4fad 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -180,6 +180,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) switch (action) { case ACTION_TERMINATE: if (!xf86Info.dontZap) { +xf86Msg(X_INFO, "Server zapped. Shutting down.\n"); #ifdef XFreeXDGA DGAShutdown(); #endif ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] linux: Prefer ioctl(KDSKBMUTE, 1) over ioctl(KDSKBMODE, K_OFF)
Setting the KDSKBMODE on a VT which X is running is never a good idea. This is an issue that needs resolution in systemd. The thought behind reusing KDSKBMODE for disabling keyboard input is that it doesn't break xf86-input-kbd and SysRq-R still functions. -Art ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] xfree86/hotplug: cleanup properly if the screen fails to initialise
On 12/11/2012 08:14 PM, Dave Airlie wrote: From: Dave Airlie Due to another bug, the modesetting/udl driver would fail to init properly on hotplug, when it did the code didn't clean up properly, and on removing the device the server could crash. Found in F18 testing. Signed-off-by: Dave Airlie Seems reasonable, so Reviewed-by: Aaron Plattner Should InitOutput make its calls to AddGPUScreen similarly non-fatal? Also, should the !xf86GPUScreens[i]->configured failure path also call xf86UnclaimPlatformSlot? -- Aaron --- hw/xfree86/common/xf86platformBus.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 0525e39..5866333 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -438,7 +438,12 @@ xf86platformAddDevice(int index) } scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL); - + if (scr_index == -1) { + xf86DeleteScreen(xf86GPUScreens[i]); + xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); + xf86NumGPUScreens = old_screens; + return -1; + } dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates, xf86ScreenKey, xf86GPUScreens[i]); ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libpciaccess] PCI: set correct mask value when matching for bridges.
On Wed, 2012-12-05 at 12:30:11 -0500, Egbert Eich wrote: > The mask must not be zero otherwise the matching condition will never > be true: ((val & mask) == set). > > Signed-off-by: Egbert Eich > --- > src/common_bridge.c |4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/src/common_bridge.c b/src/common_bridge.c > index 4a067b9..82a13fd 100644 > --- a/src/common_bridge.c > +++ b/src/common_bridge.c > @@ -321,6 +321,8 @@ pci_device_get_bridge_buses(struct pci_device * dev, int > *primary_bus, > > #define PCI_CLASS_BRIDGE 0x06 > #define PCI_SUBCLASS_BRIDGE_PCI 0x04 > +#define PCI_CLASS_MASK 0xFF > +#define PCI_SUBCLASS_MASK 0xFF > > struct pci_device * > pci_device_get_parent_bridge(struct pci_device *dev) > @@ -328,7 +330,7 @@ pci_device_get_parent_bridge(struct pci_device *dev) > struct pci_id_match bridge_match = { > PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, > (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8), > -0 > +(PCI_CLASS_MASK << 16) | (PCI_SUBCLASS_MASK << 8) > }; > > struct pci_device *bridge; Reviewed-by: Guillem Jover Regards, Guillem ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel