Commit Graph

204 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Adam Jackson 6975807945 dix: Remove WindowRec::backStorage
This is only being set, never read.
2019-04-12 21:53:03 +00:00
Adam Jackson 0f477cc68b dix, composite: Optimize setting window backing store state
We hide CWBackingStore from the screen hook if nothing's actually
changing, which means compChangeWindowAttributes no longer needs to
compare the requested state with the present one.
2019-04-12 21:53:03 +00:00
Adam Jackson 3904216b01 dix: Outdent Unmap{Window,Subwindows} a bit
No functional change, just folding some conditionals together.
2019-03-11 17:02:28 +00:00
Michal Srb fbdd4d679a dix/window: Use ConfigureWindow instead of MoveWindow
The screensaver can regularly move its window to random offsets. It should
use the ConfigureWindow function instead of calling the Screen's MoveWindow
directly. Some MoveWindow implementations, such as compMoveWindow, rely on
Screen's ConfigNotify being called first as it happens in ConfigureWindow.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-11-13 11:02:41 -05:00
Adam Jackson 53d32c94f3 dix: Remove the magic WhenMapped backing store hack
Automatic compositing exists, if that's what you want then use it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-23 18:37:46 +00:00
Giuseppe Bilotta 2dafa1bdaf dix/window: fix typos
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-11-06 16:46:32 -05:00
Daniel Stone e957a2e5dd dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug
handler when running rootless (e.g. as a part of Weston/Mutter), since
the root window has no storage, so generating exposures will result in
writes to invalid memory.

Unfortunately, preventing the segfault also breaks sprite confinement.
SetRootClip updates winSize and borderSize for the root window, which
when combined with RRScreenSizeChanged calling ScreenRestructured,
generates a new sprite-confinment area to update it to the whole screen.

Removing this call results in the window geometry being reported
correctly, but winSize/borderSize never changing from their values at
startup, i.e. out of sync with the root window geometry / screen
information in the connection info / XRandR.

This patch introduces a hybrid mode, where we update winSize and
borderSize for the root window, enabling sprite confinement to work
correctly, but keep the clip emptied so exposures are never generated.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22 13:26:31 -05:00
Michael Stapelberg a6cddb8c04 Also dump passive grabs on XF86LogGrabInfo
Signed-off-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-10 15:12:21 +10:00
Jeremy Huddleston 0a5d54f721 dix: Silence -Wunused-variable warning by moving window.c off of legacy region defines
window.c:223:15: warning: unused variable 'pScreen' [-Wunused-variable,Unused Entity Issue]
    ScreenPtr pScreen = pWin->drawable.pScreen;
              ^

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-19 11:52:03 -04:00
Adam Jackson cbd3cfbad3 dix: Restore PaintWindow screen hook
Removes the last cpp conditional on ROOTLESS from dix code.

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:41:28 -04:00
Adam Jackson 6f3332b9f4 dix: unifdef pWin->rootlessUnhittable
No reason to vary the dix ABI over this.

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:41:28 -04:00
Peter Hutterer 732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Peter Hutterer 96143d6dc3 dix: silence compiler warning comparing CARD32 to -1
window.c:3246:36: warning: comparison of constant -1 with expression of type
'CARD32' (aka 'unsigned int') is always true
[-Wtautological-constant-out-of-range-compare]
    if (optional->backingBitPlanes != ~0L)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2014-11-12 10:25:00 +10:00
Adam Jackson 5ecd7866f7 misc: Fold together some redundant conditionals
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:19:06 +02:00
Adam Jackson 939ca767c7 dix: Remove an obfuscatory macro
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Adam Jackson d138d9ccc6 dix: Remove some pointless casting of NULL
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Adam Jackson 277330075b dix: Remove an empty if
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Adam Jackson 81d76a835b dix: Lower backStorage to a bit instead of a pointer
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Adam Jackson 322ba42c23 dix: Remove DIXsaveUnder bit from the Window
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Adam Jackson 0d30d44a8c dix: Drop the third argument from WindowExposuresProcPtr
A careful read shows that it was always NULL.  It hasn't always been; as
the DDX spec indicates, it was the "occluded region that has backing
store", but since that backing store code is long gone, we can nuke it.

mi{,Overlay}WindowExposures get slightly simpler here, and will get even
simpler in just a moment.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:44 +02:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Keith Packard d89b42bda4 Clean up warnings in DIX
As usual, mostly const char changes. However, filter_device_events had
a potentially uninitialized value, 'raw', which I added a bunch of
checks for. I suspect most of those are 'can't happen', but it's hard
to see that inside the function.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Adam Jackson e0cac00560 bs: Set the screen's bs support level to WhenMapped
Since we're using RedirectAutomatic to do this, we don't actually
preserve contents when unmapped.

v2: Don't say WhenMapped if Composite didn't initialize [vsyrjala]

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-09 13:20:36 -05:00
Peter Hutterer efc1035ca9 dix: provide accessor methods for the last device event time
And now that we have the accessors, localize it. No functional changes, just
preparing for a future change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:44:32 +10:00
Adam Jackson abbd85742a dix: FIXES is not optional
It's already not optional at configure time, this just makes it so at
build time too.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-09-10 13:28:24 -04:00
Julien Cristau fe7463b8ce dix: add missing include for DeleteWindowFromAnySelections
Fixes build error with XACE disabled:
window.c:886:5: error: implicit declaration of function 'DeleteWindowFromAnySelections' [-Werror=implicit-function-declaration]
     DeleteWindowFromAnySelections(pWin);
     ^

Debian bug#701372

Reported-by: Matthias Klose <doko@debian.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-08-18 02:39:44 +02:00
Peter Hutterer 9a5ad65330 Abstract cursor refcounting
Too many callers relied on the refcnt being handled correctly. Use a simple
wrapper to handle that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-15 19:17:57 +10:00
Peter Hutterer c100211034 dix: only show the cursor if a window defines one (#58398)
e02f864fdf "Suppress cursor display until the first XDefineCursor() request"
disabled cursor display a priori unless -retro is given.

On a plain server, caling XFixesHideCursor() and XFixesShowCursor() would
show the default root cursor, despite no client actually defining a cursor.

Change the logic, disable CursorVisible by default and only enable it from
the window's CWCursor logic. If no window ever defines a cursor, said cursor
stays invisible.

X.Org Bug 58398 <http://bugs.freedesktop.org/show_bug.cgi?id=58398>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2013-03-06 08:56:23 +10:00
Yaakov Selkowitz ea1d76d1b6 Fix formatting of address operators
The formatter confused address operators preceded by casts with
bitwise-and expressions, placing spaces on either side of both.
That syntax isn't used by ordinary address operators, however,
so fix them for consistency.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05 18:09:48 -06:00
Peter Hutterer 2dc6d92284 When resetting device idle time, reset XIAll(Master)Devices too (#56649)
When the screen saver is forcibly deactivated, the idle time counter is
reset for all devices but not for the fake XIAllDevices and
XIAllMasterDevices. XScreenSaverQueryInfo uses XIAlldevices to fill the
"idle" field, thus returning the wrong value.

Regression introduced in
commit 6aef209ebc
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Mar 12 13:51:02 2012 +1000

    Change lastDeviceIdleTime to be per-device

X.Org Bug 56649 <http://bugs.freedesktop.org/show_bug.cgi?id=56649>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Giacomo Perale <ghepeu@virgilio.it>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-11-29 14:48:54 +10:00
Adam Jackson ad0156c369 dix: Remove MapUnmapEventsEnabled and friends
This hack was added to suppress events generated by Composite's internal
unmap/map cycle on redirection state change.  Since that cycle was
removed in 193ecc8b4, these can go.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Ville Syrjälä <syrjala@sci.fi>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:54 -07:00
Adam Jackson 387b1ac33c dix: Factor out DeliverUnmapNotify
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:41 -07:00
Adam Jackson d20cc0fca4 dix: Factor out DeliverMapNotify
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:26 -07:00
Adam Jackson 63843cb700 dix: Factor out MaybeDeliverMapRequest
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:40:38 -07:00
Adam Jackson dab7a1ec7f dix: Fix some indentation
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:40:08 -07:00
Alan Coopersmith 0af79b124e Use C99 designated initializers in dix Events
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 22:52:30 -07:00
Keith Packard 9d457f9c55 Add screen-specific privates.
Screen-specific privates areas are only allocated for objects related
to the target screen; objects allocated for other screens will not
have the private space reserved. This saves memory in these objects
while also allowing hot-plug screens to have additional private
allocation space beyond what the core screens are using.

Drivers are encouraged to switch to this mechanism as it will reduce
memory usage in multi-GPU environments, but it is only required for
drivers which will be loaded after the server starts, like
modesetting.

Objects providing screen-specific privates *must* be managed by the
screen-specific private API when allocating or initializing privates
so that the per-screen area can be initialized properly.

The objects which support screen-specific privates are:

	Windows
	Pixmaps
	GCs
	Pictures

Extending this list to include Colormaps would be possible, but
require slightly more work as the default colormap is created before
all colormap privates are allocated during server startup, and hence
gets a bunch of special treatment.

Of particular note, glyphs are *not* capable of supporting
screen-specific privates as they are global objects, not allocated on
a screen-specific basis, and so each driver must be able to see their
privates within the glyph.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05 13:39:50 -07:00
Dave Airlie 957bf959fb dix/render: consolidate window format matching code.
This code existed in 3 different forms, perhaps it should be
consolidated.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:43:35 -07:00
Peter Hutterer 6aef209ebc Change lastDeviceIdleTime to be per-device
Preparation work for per-device idle counters.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
2012-03-22 13:12:56 +10:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Daniel Stone 8e58ce73c8 dix: when a window disappears, remove it from the touch sprite trace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Daniel Stone c177a5bcaa Fix non-Composite builds in PrintWindowTree
The previous patch accidentally introduced a hard dependency on
Composite.  Sorry, OS X.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-15 15:44:06 +10:00
Daniel Stone ddf735fd4e DIX: Make PrintWindowTree actually useful
Rewrite PrintWindowTree to make it actually tell you what you want to
know.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-01 08:46:15 +10:00
Marko Macek c5b72fd350 DIX: Set backgroundState correctly for root window
When we change the root window's background to None, and we've run with
-wr or -br for a forced solid background, make sure we also change the
background state to BackgroundPixel, so we don't try to lookup either
pScreen->whitePixel or pScreen->blackPixel as a pixmap.

Signed-off-by: Marko Macek <Marko.Macek@gmx.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-06-01 18:42:23 -07:00
Dave Airlie eb9266c717 consolidate SetRootClip (v2)
each DDX has its own copy, I've taken the darwin one,
though I'm not sure why it needs the pOldClip piece that nobody
else has and the commit msg is like an "Updates from magic land"
type message.

This removes the main uses of pWin->winSize from the DDXen.

v2: drop old clip like ajax suggests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-03-28 10:06:32 +10:00
Dave Airlie 0bccfcc97b panoramiX: convert 0->panoramiXNumScreens loops to macro (v3)
This just uses the FOR_NSCREENS macro instead.

v2: remove some of the 1->x loops.
v3: drop the 1->0 loop, will rework later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-03-10 11:01:09 +10:00
Ville Syrjälä f3480286ae composite: Support updating an arbitrary subtree
Rename compUpdateWindow to compPaintWindowToParent and split the child
walk to compPaintChildrenToWindow. Calling compPaintChildrenToWindow
allows an arbitrary subtree to be updated, instead of having to update
all the windows. This will be used to make sure all the descendants are
copied to the parent when the parent window contents need to be accessed
in IncludeInferios sub-window mode.

WindowRec has a new member 'damagedDescendants' that is used to keep
track of which subtrees need updating. When a window is damaged,
'damagedDescendants' will be set for all the ancestors, and when a
subtree is updated, the tree walk can be stopped early if no damaged
descendants are present.

CompScreenRec no longer needs the 'damaged' member since the root
window's 'damagedDescendants' provides the same information.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-01-05 11:57:31 -08:00
Tiago Vignatti da66119593 dix: fix root window background behaviour for protocol calls
Instead always paint root tiled (-retro like), protocol calls
(XSetWindowBackgroundPixmap and related) should behave accordingly when None
and ParentRelative is set as background pixmap.

It follow what the protocol states: "changing the background of a root window
to None or ParentRelative restores the default background pixmap".

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
2010-11-11 23:25:06 +02:00
Tiago Vignatti 8976e9766e dix: adds support for none root window background
It lets the driver notify the server whether it can draw a background when
'-background none' option is used by the system platform. Use cases for that
could be video drivers performing mode-setting in kernel time, before X is up,
so a seamless transition would happen until X clients start to show up.

If the driver can copy the framebuffer cleanly then it can set the flag
(canDoBGNoneRoot), otherwise the server will fallback to the normal behaviour.
The system must explicit indicates willingness of doing so through
'-background none'. We could do this option as default; in such case,
malicious users would be able to steal the framebuffer with a bit of tricks.

For instance, I can see the content of my nVidia Quadro FX 580 framebuffer
old X session modifying a bit nv driver:

     xf86DPMSInit(pScreen, xf86DPMSSet, 0);

-    /* Clear the screen */
-    if(pNv->xaa) {
-        /* Use the acceleration engine */
-        pNv->xaa->SetupForSolidFill(pScrn, 0, GXcopy, ~0);
-        pNv->xaa->SubsequentSolidFillRect(pScrn,
-            0, 0, pScrn->displayWidth, pNv->offscreenHeight);
-        G80DmaKickoff(pNv);
-    } else {
-        /* Use a slow software clear path */
-        memset(pNv->mem, 0, pitch * pNv->offscreenHeight);
-    }
+    pScreen->canDoBGNoneRoot = TRUE;

The commit is originally based on discussions happened on xorg-devel:
http://lists.freedesktop.org/archives/xorg-devel/2010-June/009755.html

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Acked-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-11-11 23:24:43 +02:00