[PATCH xserver 1/5] xfree86/modes: Refactor xf86_use_hw_cursor_argb to use xf86_use_hw_cursor
Keith Packard
keithp at keithp.com
Thu Dec 24 10:06:04 PST 2015
Michel Dänzer <michel at daenzer.net> writes:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> This reduces code duplication.
>
> One side effect of this change is that xf86_config->cursor will no longer
> be updated for cursors which cannot use the HW cursor.
That means we'll be holding on to the last HW cursor in use on the
screen 'forever'; not a big deal, but doesn't seem great.
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>
> The side effect might actually be a bugfix? Haven't noticed any actual
> problems because of this though.
The referencing counting was added to xf86Cursors.c (by me) back in 2007
to avoid having the cursor get freed at the wrong time.
xf86_config->cursor is read in only two places: xf86_reload_cursors and
xf86_set_cursor_colors. xf86_set_cursor_colors is only called from the
ramdac cursor code, and is never called when a SW cursor is
displayed. However, xf86_reload_cursors is currently called from drivers
during modesetting, and so may well be called when a SW cursor is
displayed.
Reading the code, I can't see any reason we can't just use
ScreenPriv->cursor instead of saving another reference in this code; any
time we're using the HW cursor, that will be correct, and anytime we're
not using the HW cursor, we won't be doing anything with it. This will
let unused cursors get freed sooner, and eliminate this twisty bit of
extra code here.
This is untested, but 'should' work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-xfree86-modes-Remove-extra-reference-to-current-curs.patch
Type: text/x-diff
Size: 5464 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151224/e372d066/attachment.patch>
-------------- next part --------------
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151224/e372d066/attachment.sig>
More information about the xorg-devel
mailing list