Commit Graph

62 Commits

Author SHA1 Message Date
Adam Jackson
b51f7f8582 dix: Unexport various implementation details
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:40:57 -04:00
Keith Packard
c1ce807d9f dix: Praise clients which haven't run for a while, rather than idle clients
A client which is ready, but hasn't run for a while, should receive
the same benefit as one which has simply been idle for a while. Use
the smart_stop_tick to see how long it has been since a client has
run instead of smart_check_tick, which got reset each time a client
was ready, even if it didn't get to run.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 10:10:28 -08: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
fc84166e65 Get rid of the rest of the FD passing code when XTRANS_SEND_FDS isn't set
req_fds and SetReqFds in include/dixstruct.h

ReadFdFromClient, WriteFdToClient and the FD flushing in os/io.c

Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-11 15:32:07 -08:00
Keith Packard
9fd35daa31 Add interfaces to get FDs from clients over the socket
This adds two interfaces:

    void SetReqFds(ClientPtr client, int req_fds)

	Marks the number of file descriptors expected for this
	request. Call this before any request processing so that
	any un-retrieved file descriptors will be closed
	automatically.

    int ReadFdFromClient(ClientPtr client)

	Reads the next queued file descriptor from the connection. If
	this request is not expecting any more file descriptors, or
	if there are no more file descriptors available from the
	connection, then this will return -1.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 16:58:25 -07: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
Andreas Müller
d8d3c78b6e dixstruct.h: fix segfaults - char is unsigned for ARM and PowerPC architectures
see ARM related bug reports [1-3]

[1] https://github.com/archlinuxarm/PKGBUILDs/issues/446I
[2] http://www.raspberrypi.org/phpBB3/viewtopic.php?t=38568&p=321673
[3] http://lists.linuxtogo.org/pipermail/openembedded-core/2013-April/037805.html

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-04-23 17:43:31 +10:00
Aaron Plattner
8b328d4ee3 dix: Make small bitfields that store enums unsigned
Commit 31bf81772e changed the clientState field
from a signed int to a signed int 2-bit bitfield.  The ClientState enum that is
expected to be assigned to this field has four values: ClientStateInitial (0),
ClientStateRunning (1), ClientStateRetained (2), and ClientStateGone (3).
However, because this bitfield is signed, ClientStateRetained becomes -2 when
assigned, and ClientStateGone becomes -1.  This causes warnings:

 test.c:54:10: error: case label value exceeds maximum value for type [-Werror]
 test.c:55:10: error: case label value exceeds maximum value for type [-Werror]

The code here is a switch statement:

 53     switch (client->clientState) {
 54     case ClientStateGone:
 55     case ClientStateRetained:
 56         [...]
 57         break;
 58
 59     default:
 60         [...]
 61         break;
 62     }

It also causes bizarre problems like this:

 client->clientState = ClientStateGone;
 assert(client->clientState == ClientStateGone); // this assert fails

Also change the signedness of nearby bitfields to match.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by:  Colin Harrison <colin.harrison at virgin.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-01-08 16:45:22 -08:00
Adam Jackson
31bf81772e dix: Repack ClientRec
Pick smaller types where possible, including bitfielding some Bools and
small enums, then shuffle the result to be hole-free.  192 -> 128 bytes
on LP64, 144 -> 96 bytes on ILP32.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20 14:36:50 -04:00
Adam Jackson
ff8e3ad807 dix: Pull client-is-local flag up to the ClientRec
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20 14:36:39 -04: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
Keith Packard
11331305d4 Revert "dix: Repack ClientRec"
This reverts commit f702372822.

ABI change pended for 1.13
2012-01-12 12:10:03 -08:00
Keith Packard
d9eeede52f Revert "dix: Pull client-is-local flag up to the ClientRec"
This reverts commit 49d38b75c8.

ABI change pended for 1.13
2012-01-12 12:09:59 -08:00
Adam Jackson
49d38b75c8 dix: Pull client-is-local flag up to the ClientRec
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:53 -05:00
Adam Jackson
f702372822 dix: Repack ClientRec
sizeof(ClientRec)   ILP32   LP64
before                120    184
after                 104    136

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:53 -05:00
Keith Packard
fb22a408c6 Save major/minor opcodes in ClientRec for RecordAReply
The record extension needs the major and minor opcodes in the reply
hook, but the request buffer may have been freed by the time the hook
is invoked. Saving the request major and minor codes as the request is
executed avoids fetching from the defunct request buffer.

This patch also eliminates the public MinorOpcodeOfRequest function,
inlining it into Dispatch. Usages of that function have been replaced
with direct access to the new ClientRec field.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-12-01 15:11:20 +00:00
Alan Coopersmith
1526f1caf3 Remove unused ClientStateAuthenticating
Appears to be leftover from the Kerberos code deleted in 2007
(commit dfbe32b5b8).
Nothing left ever set clientState to ClientStateAuthenticating

Skipped over 1 to preserve existing enum numbering.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-09-20 07:41:11 -07:00
Alan Coopersmith
13ac1ba480 Remove unused ClientStateCheckingSecurity & ClientStateCheckedSecurity
Appear to be leftovers from the XC-QUERY-SECURITY code deleted in 2007
(commit 375864cb74).
Nothing left ever set clientState to ClientStateCheckingSecurity.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-09-19 15:35:10 -07:00
Rami Ylimäki
1e933665be os: Add facilities for client ID tracking.
An interface is provided for figuring out the PID and process name of
a client. Make some existing functionality from SELinux and IA
extensions available for general use.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-12-23 13:53:18 +02:00
Tiago Vignatti
7d8cabd027 os: simplify smart scheduler init process
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2010-09-10 21:49:29 +03:00
Jesse Barnes
28e33ae6f6 OS support: fix writeable client vs IgnoreClient behavior
When ResetCurrentRequest is called, or IgnoreClient is called when a
client has input pending, IgnoredClientsWithInput will be set.  However,
a subsequent IgnoreClient request will clear the client fd from that fd
set, potentially causing the client to hang.

So add an Ignore/Attend count, and only apply the ignore logic on the
first ignore and the attend logic on the last attend.  This is
consistent with the comments for these functions; callers must pair
them.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=27035.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-30 07:59:04 -07:00
Jamey Sharp
e90f20eed3 Declare functions that unconditionally call FatalError as _X_NORETURN.
For AtomError, this should fix a clang warning; in the other cases it's
just good documentation.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-22 01:00:04 -07:00
Tiago Vignatti
edbc56c088 include: remove couple of unused structures fields and bump ABI
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-04-26 14:53:12 +03:00
Nicolai Hähnle
6583477035 Remove reference to non-existing requestLog and requestLogIndex
These fields were removed in 252ec50481.

Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 10:04:28 +10:00
Adam Jackson
252ec50481 Document which bits of ClientRec are currently unused 2009-03-31 15:00:26 -04:00
Daniel Stone
40877c6680 XKB: Make XKB mandatory
No more #ifdef XKB, because you can't disable the build, and no more
noXkbExtension either.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:06:25 +11:00
Paulo Cesar Pereira de Andrade
49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Adam Jackson
991ed2949b Rename SaveSetMap() to SaveSetShouldMap().
Avoids preprocessor collision with xfixeswire.h
2008-09-23 10:22:22 -04:00
Owen Taylor
ca9fae0079 Change 'remap' to 'map' in saveset functions/macros
Now that the code has been fixed so that Unmap means unmap and not "don't
remap", 'remap' was confusing to have in the function names/parameters, so
change it to simple 'map'.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-09-22 12:43:30 -07:00
Mathieu Bérard
9f9268821b The smart scheduler is not optional. 2008-08-11 13:52:38 -04:00
Peter Hutterer
8190ef8754 Merge branch 'master' into mpx
Conflicts:

	Xext/EVI.c
	Xext/appgroup.c
	Xext/cup.c
	Xext/mitmisc.c
	Xext/sampleEVI.c
	dix/window.c
2008-04-22 18:04:05 +09:30
Adam Jackson
eafaf40fb3 Death to APPGROUP. 2008-04-18 18:50:05 -04:00
Peter Hutterer
4f2cd0ed96 Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event
generation is very different, so we can't scale in GetPointerEvents.

Conflicts:

	Xi/opendev.c
	dix/devices.c
	dix/dixfonts.c
	dix/getevents.c
	dix/resource.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	mi/mipointer.c
	xkb/ddxBeep.c
	xkb/ddxCtrls.c
	xkb/ddxKeyClick.c
	xkb/ddxList.c
	xkb/ddxLoad.c
	xkb/xkb.c
	xkb/xkbAccessX.c
	xkb/xkbEvents.c
	xkb/xkbInit.c
	xkb/xkbPrKeyEv.c
	xkb/xkbUtils.c
2008-03-04 18:11:10 +10:30
Adam Jackson
aa5216e897 Rip out useless indirection in the callback list management. 2008-02-14 07:02:13 +11:00
Peter Hutterer
8da83836b6 Merge branch 'master' into mpx
Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
2008-01-03 17:04:54 +10:30
Peter Hutterer
0b729051c0 Merge branch 'master' into mpx
Conflicts:

	Xi/extinit.c
	Xi/grabdev.c
	Xi/setmode.c
	Xi/ungrdev.c
	dix/devices.c
	dix/events.c
	dix/getevents.c
	include/dix.h
	mi/midispcur.c
	mi/misprite.c
	xkb/xkbActions.c
	xkb/xkbEvents.c
	xkb/xkbPrKeyEv.c
2007-11-07 15:37:23 +10:30
Eamon Walsh
a52c9b2a59 Merge branch 'master' into XACE-SELINUX
Conflicts:

	dix/dispatch.c
	dix/property.c
	hw/xfree86/common/xf86VidMode.c
	include/xkbsrv.h
	render/glyph.c
	xkb/xkbActions.c
2007-11-05 19:08:36 -05:00
Arjan van de Ven
2338d5c991 reduce wakeups from smart scheduler
The smart scheduler itimer currently always fires after each request
(which in turn causes the CPU to wake out of idle, burning precious
power). Rather than doing this, just stop the timer before going into
the select() portion of the WaitFor loop. It's a cheap system call, and
it will only get called if there's no more commands batched up from the
active fd.

This change also allows some of the functions to be simplified;
setitimer() will only fail if it's passed invalid data, and we don't do
that... so make it void and remove all the conditional code that deals
with failure.

The change also allows us to remove a few variables that were used for
housekeeping between the signal handler and the main loop.

Signed-off-by: Keith Packard <keithp@koto.keithp.com>
2007-10-30 11:18:56 -07:00
Eamon Walsh
4017d31902 devPrivates rework: since API is already broken, switch everything
over to new system.

Need to update documentation and address some remaining vestiges of
old system such as CursorRec structure, fb "offman" structure, and
FontRec privates.
2007-08-28 09:28:25 -04:00
Eamon Walsh
9a183d7ba5 dix: remove caching of drawables and graphics contexts. The security checks
simply bypass the cached values so they are unused.
2007-08-14 11:39:26 -04:00
Peter Hutterer
1f97a76476 Merge branch 'master' into mpx
Conflicts:

	dix/devices.c
	hw/xfree86/common/xf86Xinput.c
	hw/xfree86/loader/xf86sym.c
	mi/mieq.c
2007-06-19 17:20:52 +09:30
Adam Jackson
dfbe32b5b8 Remove the old Kerberos 5 authentication code.
Before you complain, this code hasn't seen material change since at least
X11R6.  It certainly does not build with any modern version of Kerberos.
Anybody wanting krb5 auth to their X server should probably be using
GSSAPI instead of internal krb5 API anyway.
2007-06-04 18:07:00 -04:00
Peter Hutterer
e43b8a4e40 dix: Add ClientPointer to client, used for picking which pointer to use in
ambiguious request. PickPointer and PickKeyboard are used for getting
        the appropriate pointer when situation is unclear.
        Fix some issues with InitializeSprite.

dix, xfree86: Remove last traces of InitSprite.
2007-03-02 15:21:46 +10:30
Eamon Walsh
52ba722e4c Merge branch 'XACE-modular' into my-XACE-modular 2006-08-21 18:49:31 -04:00
Alan Coopersmith
c2535f6792 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into XACE-modular 2006-08-10 10:37:59 -07:00
Eamon Walsh
96e45626c4 Rebase Security extension to use devPrivates for storing security state. 2006-08-02 20:29:59 -04:00
Adam Jackson
0aaac95b0d Remove RCS tags. Fix Xprint makefile braindamage. 2006-07-21 17:56:00 -04:00
Eamon Walsh
37f0ae0245 Replace XC-SECURITY code with XACE security hooks
(cherry picked from 8526cd6395 commit)
2006-06-19 17:09:37 -07:00