Commit Graph

32 Commits

Author SHA1 Message Date
Adam Jackson 4e76c27117 dix: Remove PRIVATE_DAMAGE
None of this is actually wired up to anything, so we can also remove the
devPrivates from the DamageRec. The DamageExtRec is what would need
devPrivates for selinux labeling, in principle.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-21 11:20:26 -04:00
Dave Airlie a52530a655 dix: Add dixPrivatesCreated helper function
This is a preparation patch for adding prime hw-cursor support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:26:40 +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
Adam Jackson dbe10ef0e3 dbe: Fold the window private private into the window private
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
Keith Packard 9e4b8b74b0 privates: Allow device privates to be allocated after server start
This will permit midispcur to allocate its privates for hotplug outputs

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05 13:40:27 -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
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
Alan Coopersmith bc04065b5c "privates.h", line 198: warning: void function cannot return value
Providing an argument to return in a function with void return type
is not allowed by the C standard, and makes the Sun compilers unhappy.
(They actually flag it as an error, unless using a new enough version
 to be able to downgrade it to a warning with "-features=extensions".)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
2011-05-27 19:52:10 -07:00
James Jones 1c4a0db2c6 Add fence sync driver interface
-Add fence sync objects

-Add fence sync devPrivates

-Add a X sync module screen private

-Add wrappable functions to create and destroy
 fence sync objects

-Give fence sync objects wrappable functions to
 trigger, test, and reset their 'triggered' value.

-Give fence sync objects wrappable functions to
 notify driver when adding/removing triggers to/
 from the sync object.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-12-06 19:15:26 -08:00
Jamey Sharp 402942cdbc Introduce per-object per-screen privates.
This replaces dixCreatePrivateKey and the only uses, which were in
midispcur.

Commit by Jamey Sharp and Josh Triplett.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-09-18 11:17:18 +02:00
Alan Coopersmith 40d598a4f8 Correct function name in dixRegisterPrivateKey comments
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Patrick E. Kane <pekane52@gmail.com>
2010-08-09 21:09:56 -07:00
James Jones 48cac27870 Cast void* to pointer* to appease some compilers.
When this privates.h is included in C++ builds, the compiler
complains about implicitly casting void* to void**.  This small
patch fixes that up.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-07-01 22:59:09 -04:00
Keith Packard 34db537907 Add dixCreatePrivateKey API
Keys need to persist through server reset so that the private system
can be cleaned up in dixResetPrivates. In particular, this means that
keys cannot live in objects freed at reset time. This API provides
suitable object lifetime by having the privates code free the key in
the reset path.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-06-05 19:31:37 -07:00
Keith Packard 495fc3eb2d Change devPrivates implementation.
Each key now declares which object type it belongs to, this permits
keys for different types to share the same offset within the allocated
privates. As a special case for XSELinux, a key may be allocated as
PRIVATE_XSELINUX which will allow it to continue to be used across the
relevant object types.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-06-05 19:31:32 -07:00
Keith Packard faeebead7b Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05 19:23:03 -07:00
Keith Packard 431781a921 Remove dixRegisterPrivateOffset; hard-code devPrivates offsets instead
For predefined resource types, the offset of the devPrivates field was
already kept in a constant table. The only non-predefined type needing
this treatment was dbeDrawableResType, which is just a magic alias for
RT_PIXMAP.

This patch special-cases looking up RC_DRAWABLE offsets and uses the
table directly for everything else.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-06-05 19:11:32 -07:00
Keith Packard f2a0c324e3 Remove devPrivates init and delete callback lists.
XSELinux was the only consumer of these interfaces and it no longer
needs them.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-13 14:16:32 -07:00
Aaron Plattner 5623908aee dix: Improve documentation of the DIX private data functions.
The functions exported by the devPrivates code were poorly documented.  I tried
to spruce it up a little.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-30 12:46:04 -07: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
Eamon Walsh b6ab114212 Array-index based devPrivates implementation.
Note: DevPrivateKey is now pointer-to-int, which means
each key now needs to point to some global storage of
size at least sizeof(int).
2008-09-12 19:11:53 -04:00
Eamon Walsh 2d7ba09dc4 Make devPrivates lookup functions ABI instead of static inlines.
This is required to preserve compatibility across changes to the
internal representation of the privates list.
2008-06-13 16:43:56 -04:00
Eamon Walsh 57907e0943 devPrivates rework: register an offset for every resource type, use
signed values so -1 actually works correctly, and provide a macro for
adding an offset to a pointer.
2007-09-06 16:55:51 -04: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 860a09cfb8 devPrivates rework: Nevermind, can't const due to return value warnings.
This reverts commit 6fd0a0b08d.
2007-08-16 16:12:01 -04:00
Eamon Walsh 6fd0a0b08d devPrivates rework: add const qualifier to key type. 2007-08-16 16:01:42 -04:00
Eamon Walsh b2b7817497 devPrivates rework: use camelcase standard for name of key type. 2007-08-16 15:33:58 -04:00
Eamon Walsh fe05ba75a1 devPrivates rework: pass address of pointer to private callbacks instead of
the pointer itself.
2007-03-08 12:14:30 -05:00
Eamon Walsh 2fcb45eb5d devPrivates rework: redo field offset registration, drop RC_PRIVATES class. 2007-03-08 12:13:36 -05:00
Eamon Walsh 947f8d249b devPrivates rework: redo interface again, dropping parent and type parameters
as well as preallocation routine.
2007-03-08 12:13:18 -05:00
Eamon Walsh c45f676208 devPrivates rework: hook up new mechanism in backwards-compatibility mode
on existing structures that support devPrivates.
2007-03-08 12:12:51 -05:00
Eamon Walsh e684824709 devPrivates rework: redo interface and implementation. 2007-03-05 11:50:45 -05:00
Eamon Walsh 779faccfb7 devPrivates rework: add dix header file containing new interface. 2007-02-23 13:19:53 -05:00