summaryrefslogtreecommitdiff
path: root/hw/xfree86/ramdac/xf86HWCurs.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-25ramdac: Check ScreenPriv != NULL in xf86ScreenSetCursor()Alex Goins1-1/+8
Similar to change cba5a10f, xf86ScreenSetCursor() would dereference ScreenPriv without NULL checking it. If Option "SWCursor" is specified, ScreenPriv == NULL. Without this fix, it is observed that setting Option "SWCursor" "on" on the modesetting driver in a PRIME configuration will segfault the server. It is important to return success rather than failure in the instance that ScreenPriv == NULL and pCurs == NullCursor, because otherwise xf86SetCursor() can fall into infinite recursion: xf86SetCursor(pCurs) calls xf86ScreenSetCursor(pCurs), and if FALSE, calls xf86SetCursor(NullCursor). If xf86ScreenSetCursor(NullCursor) returns FALSE, it calls xf86SetCursor(NullCursor) again and this repeats forever. Signed-off-by: Alex Goins <agoins@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-02-08xfree86: Immediately handle failure to set HW cursor, v5Michael Thayer1-4/+4
Based on v4 by Alexandre Courbot <acourbot@nvidia.com> There is currently no reliable way to report failure to set a HW cursor. Still such failures can happen if e.g. the MODE_CURSOR DRM ioctl fails (which currently happens at least with modesetting on Tegra for format incompatibility reasons). As failures are currently handled by setting the HW cursor size to (0,0), the fallback to SW cursor will not happen until the next time the cursor changes and xf86CursorSetCursor() is called again. In the meantime, the cursor will be invisible to the user. This patch addresses that by adding _xf86CrtcFuncs::set_cursor_check and _xf86CursorInfoRec::ShowCursorCheck hook variants that return booleans. This allows to propagate errors up to xf86CursorSetCursor(), which can then fall back to using the SW cursor immediately. v5: Updated the patch to apply to current git HEAD, split up into two patches (server and modesetting driver) and adjusted the code slightly to match surrounding code. I also removed the new exported function ShowCursorCheck(), as instead just changing ShowCursor() to return Bool should not affect its current callers. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Michael Thayer <michael.thayer@oracle.com>
2017-02-06xfree86: Take input_lock() for xf86ScreenCheckHWCursorChris Wilson1-7/+20
2017-02-06xfree86: Take input lock for xf86TransparentCursorChris Wilson1-0/+4
2017-02-06xfree86: Take the input lock for xf86RecolorCursorChris Wilson1-6/+18
xf86RecolorCursor() may be called directly from XRecolorCursor as well as from xf86ScreenSetCursor(). In the latter case, the input lock is already held, but not for the former and so we need to add a wrapper function that acquires the input lock before performing xf86RecolorCursor() References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
2016-10-28ramdac: Check sPriv != NULL in xf86CheckHWCursor()Alex Goins1-0/+4
xf86CheckHWCursor() would dereference sPriv without NULL checking it. If Option "SWCursor" is specified, sPriv == NULL. In this case we should assume that HW cursors are not supported. Signed-off-by: Alex Goins <agoins@nvidia.com> Reviewed-by: Andy Ritger <aritger@nvidia.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2016-10-13xf86Cursor: Take the input lock in xf86Set/MoveCursorMichel Dänzer1-3/+14
Prevents the HW cursor from intermittently jumping around when the cursor image is changed while the cursor is being moved. This is hardly noticeable in normal operation but can be quite confusing when stepping through these codepaths in a debugger. Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-10-13xf86Cursor: Use PRIME master xf86CursorScreenRec::HotX/Y for slavesMichel Dänzer1-4/+16
xf86CursorScreenRec::HotX/Y contain 0 for PRIME slave screens. Fixes incorrect HW cursor position on PRIME slave screens. Also hoist the hotspot translation out from xf86ScreenSet/MoveCursor to xf86Set/MoveCursor, since the hotspot position is a property of the cursor, not the screen. v2: * Squash patches 1 & 2 of the v1 series, since it's basically the same problem * Use the master screen's xf86CursorScreenRec::HotX/Y instead of CursorRec::bits->x/yhot, since CursorRec::bits can be NULL (Hans de Goede) Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-13xf86Cursor: Add hw cursor support for primeDave Airlie1-5/+77
Currently with PRIME if we detect a secondary GPU, we switch to using SW cursors, this isn't optimal, esp for the intel/nvidia combinations, we have no choice for the USB offload devices. This patch checks on each slave screen if hw cursors are enabled, and also calls set cursor and move cursor on all screens. Cc: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13xf86Cursor: Add xf86CheckHWCursor() helper functionDave Airlie1-0/+12
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: Michel Dänzer <michel.daenzer@amd.com>
2015-06-30cursor: drop ARGB_CURSORDave Airlie1-6/+0
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>
2014-11-12Drop trailing whitespacesPeter Hutterer1-1/+1
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-04-25hw/xfree86: Restore API compatibility for cursor loading functionsKeith Packard1-7/+7
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-03Add a return value to load_cursor_argb() to allow it to report failureMichael Thayer1-6/+9
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-01-12Replace 'pointer' type with 'void *'Keith Packard1-6/+6
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>
2012-07-10Remove XAADaniel Stone1-0/+9
Commit 0c6987df in June 2008 disabled XAA offscreen pixmaps per default, as they were broken, leaving XAA only able to accelerate operations directly on the screen pixmap and nowhere else, eliminating acceleration for basically every modern toolkit, and any composited environment. So, it hasn't worked for over four years. No-one's even come close to fixing it. RIP. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
2012-05-21xf86: migrate to using xf86ScreenToScrn wrapper (v2)Dave Airlie1-1/+1
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-03-21Introduce a consistent coding styleKeith Packard1-209/+224
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>
2011-09-19Eliminate MAXSCREENS-sized CursorScreenKey array.Jamey Sharp1-2/+2
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>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov1-16/+16
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>
2008-10-06xalloc+memset(0) -> xcallocAdam Jackson1-1/+1
2008-08-27Add an array of integers for use as per-screen cursor private keys.Eamon Walsh1-2/+2
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-05-06xfree86: re-enable hardware cursor (for a single cursor)Peter Hutterer1-4/+0
This commit enables HW rendering for cursors again, but only for a single cursor. Other cursors can be created, however they will not be visible.
2008-01-03Merge branch 'master' into mpxPeter Hutterer1-10/+10
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
2007-08-30devPrivates rework: convert CursorRec and CursorBits over to new interface.Eamon Walsh1-2/+2
2007-08-28devPrivates rework: since API is already broken, switch everythingEamon Walsh1-8/+8
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.
2006-12-18Cleaning up ifdef MPX from remaining files, removing it from configure.ac.Peter Hutterer1-3/+0
Removing building mpx extension from Makefile.am
2006-11-17dix: moved isMPdev field to end of _DeviceIntRec structurePeter Hutterer1-0/+7
mi: added miMPPointers array to mipointer.c added DeviceIntPtr to all miPointerSpriteFuncs. Coming from miPointer we use inputInfo.pointer as standard value. ABI BREAK! ramdac: forcing failed HW Cursor initialisation. MPX needs software rendering. changes to use new miPointerSpriteFunc (this required externing inputInfo, should probably be fixed at a later point). RAC: changes to use new miPointerSpriteFuncs.
2006-07-21Remove RCS tags. Fix Xprint makefile braindamage.Adam Jackson1-1/+0
2006-02-10Remove libcwrapper usage from xorg server modules. The libcwrapper is onlyEric Anholt1-1/+2
of (marginal) use in the drivers, and that usage remains.
2005-07-03Change <X11/misc.h> and <X11/os.h> to "misc.h" and "os.h".Daniel Stone1-1/+1
2005-07-03Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.Daniel Stone1-0/+4
Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings. Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all source files in the xserver/xorg tree, predicated on defines of HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to <X11/fonts/foo.h>.
2005-07-01Change all misc.h and os.h references to <X11/foo.h>.Daniel Stone1-1/+1
2005-04-20Fix includes right throughout the Xserver tree:Daniel Stone1-1/+1
change "foo.h" to <X11/foo.h> for core headers, e.g. X.h, Xpoll.h; change "foo.h", "extensions/foo.h" and "X11/foo.h" to <X11/extensions/foo.h> for extension headers, e.g. Xv.h; change "foo.[ch]" to <X11/Xtrans/foo.[ch]> for Xtrans files.
2004-04-23Merging XORG-CURRENT into trunkEgbert Eich1-1/+1
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich1-1/+1
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich1-1/+1
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich1-1/+1
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich1-1/+1
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_16Kaleb Keithley1-1/+8
2003-11-14Initial revisionKaleb Keithley1-0/+516