Commit Graph

55 Commits

Author SHA1 Message Date
Dave Airlie
8218dadd30 cursor: drop ARGB_CURSOR
I doubt anyone builds with this turned off or has done for a long
time.

It helps my eyes bleed slightly less when reading the code, I've left
the define in place as some drivers use it.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-06-30 12:17:51 +10:00
Keith Packard
4c3932620c hw/xfree86: Restore API compatibility for cursor loading functions
Create load_cursor_image_check, load_cursor_argb_check,
LoadCursorImageCheck and LoadCursorARGBCheck that can return failure
and use them in preference to the old unchecked variants.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michael Thayer <michael.thayer@oracle.com>
2014-04-25 14:41:52 -07:00
Michael Thayer
901fbfbbbd Add a return value to load_cursor_argb() to allow it to report failure
load_cursor_argb() may need to be able to fail and have the server fall back
to a software cursor in at least the following circumstances.
1) The hardware can only support some ARGB cursors and this does not just
depend on cursor size.
2) Virtual hardware may not wish to pass through a cursor to the host at a
particular time but may wish to accept the same cursor at another time.
This patch adds a return value to the API and makes the server do the
software fall-back on failure.

Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-03 16:46:55 -07: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
Dave Airlie
41151f88a6 xf86: migrate to using xf86ScreenToScrn wrapper (v2)
migrate to new helper API.

This just wraps all the obvious uses of xf86Screens[pScreen->myNum],
and should be fairly simple to review.

v2: remove commented out lines.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-21 12:59:08 +01: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
Tiago Vignatti
6817050f31 configure: wrap PCI code with macro and set it at build time
--disable-pciaccess, used together with --disable-module-int10, can be used to
disable all pci code inside the server.

Note that XSERVER_LIBPCIACCESS was previously used only in the driver side and
now it defines also whether the library is used inside the server. Also,
XORG_BUS_PCI automake variable is introduced to track PCI code needs.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-15 21:18:47 -07:00
Aaron Plattner
57cd32e934 xfree86/modes: Make cursor position transform a helper function
When the driver can handle the crtc transform in hardware, it sets
crtc->driverIsPerformingTransform, which turns off both the shadow
layer and the cursor's position-transforming code.  However, some
drivers actually do require the cursor position to still be
transformed in these cases.  Move the cursor position transform into a
helper function that can be called by such drivers.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2011-10-03 11:30:04 -07:00
Aaron Plattner
245cb8e94f xfree86/modes: Let the driver handle the transform
If a driver can use hardware to handle the crtc transform, then
there's no need for the server's shadow layer to do it.  Add a crtc
flag that lets the driver indicate that it is handling the transform.
If it's set, consider the transformed size of the screen but don't
actually enable the shadow layer.  Also stop adjusting the cursor
image and position.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2011-10-03 11:30:00 -07:00
Jamey Sharp
8f69c935f6 Eliminate MAXSCREENS-sized CursorScreenKey array.
Use new per-screen privates API instead.

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: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-19 22:53:05 -07:00
Keith Packard
a91d33917b Revert "randr: Add sprite position transforms"
This reverts commit 66294afcab.
2011-02-23 11:18:12 -08:00
Keith Packard
66294afcab randr: Add sprite position transforms
This implements sprite position transformations. Sprite image
transforms are passed all the way to the DDX layer, but the images are
not yet manipulated before being passed to the drivers.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-12-06 20:08:40 -08:00
Aaron Plattner
ffcbfa0063 xfree86: Fix rotation of 2-color non-interleaved cursor images
When RandR 1.2's transformation code is enabled, it rotates the cursor
image so that it appears upright on a rotated screen.  This code
completely mangles 2-color cursors on hardware where the the mask and
source images are not interleaved due to two problems:

1. stride is calculated as (width / 4) rather than (width / 8), so the
   expression (y * stride) skips two lines instead of one for every
   time y is incremented.
2. cursor_bitpos ignores the 'mask' parameter if the hardware doesn't
   specify any of the HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_* flags.

To fix this, refactor the code to pass the whole xf86CursorInfoPtr
through to cursor_bitpos and compute the correct stride there based on
the flags.  If none of the SOURCE_MASK_INTERLEAVE flags are set, use
the total cursor size to move the 'image' variable into the mask part
of the image before computing the desired byte pointer.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Tested-by: Cyril Brulebois <kibi@debian.org>
2010-11-30 10:31:43 -08:00
Jamey Sharp
e4d4d6ddd5 Xserver need not be compatible with old versions of xserver.
Delete time-traveling multiple personality disorder from the server.

Gaetan notes:

    There were a couple of drivers containing an unknown version of the
    modes/parser code. This was done in server 1.2 time frame because it
    was released without mode code. It was barely or not maintained
    afterwards. There are currently no video drivers with a copy of the
    modes code.

Most of these ifdefs were introduced in commit
a8d760f567, where Aaron wrote,

    This change uses XORG_VERSION_CURRENT < 7.0 to mean "server newer
    than 1.2" since XORG_VERSION current went backwards at some point.

Alan explains that:

    In Xorg 1.3, when we first released an Xorg server release decoupled
    from the katamari release schedule.  (1.0 through 1.2 were released
    as part of X11R7.0 through 7.2, while 1.3 came out between X11R7.2 &
    7.3.)

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: Aaron Plattner <aplattner@nvidia.com>
2010-09-18 11:17:18 +02:00
Dave Airlie
80d1a548d6 rotation: fix cursor and overlap of one pixel.
Commit 77c7a64e88 was introduced to fix
a cursor off by one on Intel hw, however it also move the whole crtc
into an off by one position and you could see gnom-eshell overlapping.

This commit reverts that and instead fixes the cursor hotspot
translation to work like pixman does. We add 0.5 to the cursor vector
before translating, and floor the value afterwards.

Thanks to Soeren (ssp) for pointing out where the real problem was
after explaning how pixman translates points.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-22 11:38:30 -07:00
Matt Turner
f4190feb25 Remove more superfluous if(p) checks around free(p)
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-06-11 19:05:46 +07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Cyril Brulebois
fa6c701257 Fix null pointer dereference in xf86_reload_cursors().
Upon resume, X may try to dereference a null pointer, which has been
reported in Debian bug #507916 (http://bugs.debian.org/507916).

Jim Paris came up with a patch which solves the problem for him. Here's
a (hopefully) fixed version of his patch (without the typo).

Cc: Jim Paris <jim@jtan.com>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-By: Matthias Hopf <mhopf@suse.de>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-11 08:35:28 -07:00
Keith Packard
28b7b2b8d0 unifdef -B -DRENDER to always include RENDER code
This patch was created with:

git ls-files '*.[ch]' | while read f; do unifdef -B -DRENDER -o $f $f; done

Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-19 09:26:10 -07:00
Roland Scheidegger
75efb46a14 hw/xfree86: fix refcounting in xf86_use_hw_cursor
This is the same fix as was done in
fcdc1d78cc for xf86_use_hw_cursor_argb.

Signed-off-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-15 08:36:33 -07:00
Keith Packard
fcdc1d78cc Fix sporadic segfault on resume due to accidentally freeing cursor.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:38:22 +10:00
Matthias Hopf
91e1fe5863 Revert fe31f9c + 977953b to fix issue for good.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:38:17 +10:00
Matthias Hopf
977953bf14 Less intrusive workaround for sporadic segfault on resume.
Hopefully fixes fdo #24010 (memleak).
2009-09-21 16:41:49 +02:00
Matthias Hopf
3bdf364761 Work around sporadic segfault on resume with intel/KMS due to cursor->bits == NULL.
Apparently SavedCursor is sometime tried to be set while already being set.
2009-09-16 16:05:36 +02:00
Keith Packard
4aab05e3b3 xf86_reload_cursors: fix cursor position to eliminate jumping after mode set
xf86_reload_cursors restores the cursor to the correct position, but
that must adjust for cursor hot spot and frame before calling down to
the hardware function, otherwise the cursor jumps to the wrong
position until it is repositioned by the user.

Signed-off-by: Keith Packard <keithp@keithp.com>
2009-08-25 18:14:19 -07:00
Peter Hutterer
d3f6b43a24 Update to xextproto 7.0.99.1.
xextproto had Xlib client headers moved into libXext.
Protocol header files are named fooproto.h, header files with constants
foo.h or fooconst.h where foo.h was already in use for client-side headers.
2009-07-15 17:00:05 +10: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
Stuart Bennett
0b8f8b24f7 xf86Cursors: xf86_reload_cursors shouldn't unconditionally show hwcursor (#14820)
Also, no need to call ShowCursor when SetCursorPosition already does it
Based on a previous patch by Maarten Maathuis

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-02 22:54:18 -08:00
Keith Packard
9ffc671939 Move matrix operations from X server to pixman 0.13.2
pixman 0.13.2 now holds all of the matrix operations. This leaves
the protocol conversion routines and some ABI stubs in place

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-11-25 22:17:58 -08:00
Keith Packard
7e69e364d2 Fix rotated/reflected cursor positions.
Doing projective transforms required repositioning the cursor using the
hotspot, but that requires relocating the upper left corner in terms of said
hotspot.
2008-11-24 13:24:40 -08:00
Keith Packard
49db14e4ac Handle RandR transform matrices in floating point.
RandR matrix computations lose too much precision in fixed point;
computations using the inverted matrix can be as much as 10 pixels off.
Convert them to double precision values and pass those around. These API
changes are fairly heavyweight; the official Render interface remains fixed
point, so the fixed point matrix comes along for the ride everywhere.
2008-11-24 13:24:40 -08:00
Keith Packard
8fd82c88e3 Adjust transformed cursor position to account for hotspot 2008-11-24 13:24:38 -08:00
Eamon Walsh
ec7907f8fa Add an array of integers for use as per-screen cursor private keys.
Replaces the use of the screen pointer itself as the key, which was
nice but won't work now that an array index is being stored.
2008-08-27 19:27:13 -04:00
Peter Hutterer
99d28c3ef3 Merge branch 'master' into mpx
Conflicts:

	Xext/xprint.c (removed in master)
	config/hal.c
	dix/main.c
	hw/kdrive/ati/ati_cursor.c (removed in master)
	hw/kdrive/i810/i810_cursor.c (removed in master)
	hw/xprint/ddxInit.c (removed in master)
	xkb/ddxLoad.c
2008-05-20 10:20:14 +09:30
Dave Airlie
7dca84f3ee cursor: don't dereference NULL pointer is devPrivates not yet set.
This fixes a bug on server recycle with ati zaphod.
2008-05-19 11:16:08 +10:00
Peter Hutterer
6f63724b28 xfree86: don't try to repaint the cursor before cursors exist. 2008-05-02 14:56:58 +09:30
Peter Hutterer
fd06e8f8c1 Merge branch 'master' into dcdc_rework
Conflicts:

	Xext/xevie.c
	dix/dispatch.c
2008-04-07 07:56:41 +09:30
Michel Dänzer
da973e962d Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB
This patch (and not setting HARDWARE_CURSOR_BIT_ORDER_MSBFIRST on big endian
platforms) fixes it for me with the radeon driver and doesn't break intel.

Correct patch this time :)
2008-03-20 09:18:29 -04:00
Alex Deucher
f8c1eb29e2 Revert "Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB"
This reverts commit 2673525796.

Pushed the wrong patch.
2008-03-20 09:14:41 -04:00
Michel Dänzer
2673525796 Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB
See bug 11796
2008-03-19 19:12:37 -04:00
Aaron Plattner
a8d760f567 Get modes code building with old X servers again.
This change uses XORG_VERSION_CURRENT < 7.0 to mean "server newer than 1.2"
since XORG_VERSION current went backwards at some point.
2008-03-06 14:42:00 -08:00
Peter Hutterer
0ac1755977 Merge branch 'master' into mpx
Conflicts:

	Xext/sampleEVI.c
2008-01-26 13:55:07 +10:30
Dave Airlie
1f83f40525 xf86Cursors: fix memset for non-square cursors 2008-01-15 10:21:17 +10: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
47ab4d648b devPrivates rework: convert CursorRec and CursorBits over to new interface. 2007-08-30 11:40:39 -04:00
Alex Deucher
81f8b652d9 Add _X_EXPORT to exported functions in hw/xfree86/modes/*
Also add missing exports to hw/xfree86/loader/xf86sym.c
2007-08-22 19:26:34 -04:00
Keith Packard
7dc8531548 Ref count cursors used in hw/xfree86/modes code.
The multi-crtc cursor code in hw/xfree86/modes holds a reference to the
current cursor. This reference must be correctly ref counted so the cursor
is not freed out from underneath this code.
2007-08-20 23:24:12 -07:00
Peter Hutterer
f367285fd5 Merge branch 'master' into mpx
Conflicts:

	Xi/exevents.c
	dix/devices.c
	dix/getevents.c
	include/dix.h
	mi/mieq.c
2007-08-12 15:31:10 +09:30
Dave Airlie
722d73a0ef Revert "Fix RandR 1.2 conversion of two colour to ARGB cursor on MSB first platforms."
This reverts commit 0f057ebb27.

This screws my cursor up just starting a bare X server on Intel,
I get the X more like <> than ><..
2007-07-31 10:34:56 +10:00