Commit Graph

362 Commits

Author SHA1 Message Date
Hans de Goede
35c4e96ed1 randr: Fix crtc_bounds when using rotation combined with reflection
Before this commit crtc_bounds() did not take reflection into account,
when using reflection with 0 / 180 degree rotation this was not an
issue because of the default in the switch-case doing the right thing.

But when using 90 / 270 degree rotation we would also end up in the
default which is wrong in this case. This would lead to the cursor
being constrained to a height x height area of the monitor.

This commit masks out the reflection bits for the switch-case,
making crtc_bounds return the correct bounds and fixing the
problematic cursor constraining.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:27:30 +02:00
Hans de Goede
2eefb53f58 randr: Add RRHasScanoutPixmap helper function
This is a preparation patch for adding prime hw-cursor support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-13 10:26:47 +02:00
agoins
df8e86931e randr: Add ability to turn PRIME sync off
Adds an output parameter to disable PRIME synchronization.

Output parameter is created when the user calls 'xrandr
--setprovideroutputsource <sink> <source>' to prevent polluting output
parameters of non-PRIME configurations.

Defaults to on, so if the user wants PRIME synchronization they don't need
to do anything.

If the user wishes to disable PRIME synchronization when they first set up
PRIME, they can run 'xrandr --output <output> --set "PRIME Synchronization"
0' after running 'xrandr --setprovideroutputsource <sink> <source>', but
before 'xrandr --auto'.

If the user wishes to enable or disable PRIME synchronization after PRIME has
already been set up, they can run 'xrandr --output <output> --set "PRIME
Synchronization" <0 or 1>' at any time, xrandr will trigger a modeset, which
will tear down and setup PRIME in the configuration they requested on CRTCs
associated with that output.

randrstr.h:
    Add central definition of the output property name.

rrcrtc.c:
    Add function rrGetPixmapSharingSyncProp() to query the status of the
    output property.

    Add function rrSetPixmapSharingSyncProp() to set the output property.

    Add 'sync' parameter to rrSetupPixmapSharing(), which when false will
    use single buffering even if the required ABI functions are supported.
    Changes rrSetupPixmapSharing() to only report an error if falling back
    to single buffering when the user requested synchronization.

    Change RRCrtcSet() to use rrPixmapSharingSyncProp() to query the status
    of the output property and feed it into rrSetupPixmapSharing() using
    the 'sync' parameter.

rrprovider.c:
    Add RR(Init/Fini)PrimeSyncProps(), functions to create and destroy the
    PRIME synchronization output property.

    Add a call to RRInitPrimeSyncProps() in
    ProcRRSetProviderOutputSource(), such that the output property is
    created when the user requests PRIME.

    Add a call to RRFiniPrimeSyncProps() in RRProviderDestroy().

v1: Initial commit
v2: Unchanged
v3: Add /* TODO */ for handling different sources with different outputs
    Make rrSetupPixmapSharing() set the output property to 0 if it has to fall
    back, to avoid user confusion.
    Make rr(Get)PixmapSharingSyncProp() check the current value if there isn't a
    pending value
v4: Unchanged
v5: Unchanged
v6: Rebase onto ToT
v7: Unchanged

Signed-off-by: Alex Goins <agoins@nvidia.com>
2016-07-05 14:30:27 -04:00
Alex Goins
1bdbc7e764 randr/xf86: Add PRIME Synchronization / Double Buffer
Changes PRIME to use double buffering and synchronization if all required
driver functions are available.

rrcrtc.c:
    Changes rrSetupPixmapSharing() to use double buffering and
    synchronization in the case that all required driver functions are
    available. Otherwise, falls back to unsynchronized single buffer.

    Changes RRCrtcDetachScanoutPixmap() to properly clean up in the case of
    double buffering.

    Moves StopPixmapTracking() from rrDestroySharedPixmap() to
    RRCrtcDetachScanoutPixmap().

    Changes RRReplaceScanoutPixmap() to fail if we are using double buffering,
    as it would need a second ppix parameter to function with double buffering,
    and AFAICT no driver I've implemented double buffered source support in uses
    RRReplaceScanoutPixmap().

randrstr.h:
    Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME
    double buffering.

xf86Crtc.h:
    Adds current_scanout_back to _xf86Crtc to facilitate detection
    of changes to it in xf86RandR12CrtcSet().

xf86RandR12.c:
    Changes xf86RandR12CrtcSet() to detect changes in
    scanout_pixmap_back.

    Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME double
    buffering.

v1: Initial commit
v2: Rename PresentTrackedFlippingPixmap to PresentSharedPixmap
v3: Refactor to accomodate moving (rr)StartFlippingPixmapTracking and
    (rr)(Enable/Disable)SharedPixmapFlipping to rrScrPrivRec from ScreenRec
    Add fallback if flipping funcs fail
v4: Detach scanout pixmap when destroying scanout_pixmap_back, to avoid
    dangling pointers in some drivers
v5: Disable RRReplaceScanoutPixmap for double-buffered PRIME, it would need an
    ABI change with support for 2 pixmaps if it were to be supported, but AFAICT
    no driver that actually supports double-buffered PRIME uses it.
    Refactor to use rrEnableSharedPixmapFlipping() as a substitute for
    rrCrtcSetScanoutPixmap() in the flipping case.
    Remove extraneous pSlaveScrPriv from DetachScanoutPixmap()
    Remove extraneous protopix and pScrPriv from rrSetupPixmapSharing()
v6: Rebase onto ToT
v7: Unchanged

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2016-06-28 12:56:17 -04:00
Alex Goins
b601f96a59 xf86: Add PRIME flipping functions to Screen
Adds typedefs for (*RRStartFlippingPixmapTrackingProcPtr),
(*RREnableSharedPixmapFlippingProcPtr),
and (*RRDisableSharedPixmapFlippingProcPtr) in randrstr.h.

Adds typedefs for (*PresentSharedPixmapProcPtr),
(*SharedPixmapNotifyDamageProcPtr),
(*RequestSharedPixmapNotifyDamageProcPtr), and
(*StopFlippingPixmapTrackingProcPtr) in scrnintstr.h.

Adds RR(Enable/Disable)SharedPixmapFlipping, and
RRStartFlippingPixmapTracking to rrScrnPrivRec.

Adds StopFlippingPixmapTracking, PresentSharedPixmap,
SharedPixmapNotifyDamage, and RequestSharedPixmapNotifyDamage to ScreenRec.

rrScrnPrivRec used for functions that use RandR-private data types, and
ScreenRec used for the rest.

RREnableSharedPixmapFlipping will allow the sink driver to setup for
flipping between two shared pixmaps.

RRDisableSharedPixmapFlipping will allow the sink driver to do teardown
associated with flipping between two shared pixmaps.

(RRStart/Stop)FlippingPixmapTracking are merely the double-buffered
equivalents of (Start/Stop)PixmapTracking, allowing the source driver to do
whatever setup and teardown necessary for presenting on the two shared
pixmaps.

PresentSharedPixmap is a function exposed by the source driver for the X
server or sink driver to call to request a present on a given shared
pixmap.  This way, presents can be driven by the sink's vblank instead of a
timer or similar mechanism.

SharedPixmapNotifyDamage and RequestSharedPixmapNotifyDamage are OPTIONAL
(even for double-buffered PRIME) functions exposed by the sink driver and
the source driver, respectively. By calling
master->RequestSharedPixmapNotifyDamage(ppix), the sink driver can request
for the source driver to call slave->SharedPixmapNotifyDamage(ppix) in
response to damage on the master screen pixmap tracked by ppix.

v1: Initial commit
v2: Rename PresentTrackedFlippingPixmap to PresentSharedPixmap
    Add SharedPixmapNotifyDamage / RequestSharedPixmapNotifyDamage
v3: Add RRCrtcPtr as a parameter to StartFlippingPixmapTracking
    Move functions that use RandR-private data types to rrScrnPrivRec.
v4: Unchanged
v5: Add front and back parameters to RREnableSharedPixmapFlippingProcPtr
v6: Rebase onto ToT
v7: Unchanged

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2016-06-28 12:55:56 -04:00
Nikhil Mahale
15595d29c2 randr: Adjust master's last set time with slaves
In prime configurations master's last set time may not be latest
and greatest, adjust it with slaves last set time, pick up greatest
one. Otherwise xserver may end with events which has
lastSetTime < lastConfigTime even if that's not
the case and confuse xrandr client.

[hdegoede: rebase on "xrandrprovider: Do not use separate lists for unbound /
 source / offload slaves"]
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-06-17 11:38:13 +02:00
Hans de Goede
5c7af02b10 xrandrprovider: Do not use separate lists for unbound / source / offload slaves
A single provider can be both a offload and source slave at the same time,
the use of seperate lists breaks in this case e.g. :

xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 0 name:modesetting

xrandr --setprovideroutputsource 1 0x7b
xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 1 name:modesetting

xrandr --setprovideroffloadsink 1 0x7b
xrandr --listproviders
Providers: number : 3
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 2 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting
Provider 2: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting

Not good. The problem is that the provider with id 0x46 now is on both
the output_slave_list and the offload_slave_list of the master screen.

This commit fixes this by unifying all 3 lists into a single slaves list.

Note that this does change the struct _Screen definition, so this is an ABI
break. I do not expect any of the drivers to actually use the removed / changed
fields so a recompile should suffice.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-06-17 11:35:58 +02:00
Olivier Fourdan
941aeb3b92 randr: Do not update ConnectionInfo if NULL
RRScreenSizeNotify() will update the connection information block, but
if this occurs during initialization before ConnectionInfo is even
initialized, this will lead to a crash.

Simply check for ConnectionInfo prior to update it to avoid the crash.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95337
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-06-13 16:06:05 -04:00
Dave Airlie
a6b6e8ba02 prime: clean up slave bo properly. (v3)
This is an ABI break, in that we now pass NULL to a function that hasn't
accepted it before.

Alex Goins had a different patch for this but it wasn't symmetrical, it
freed something in a very different place than it allocated it, this
attempts to retain symmetry in the releasing of the backing bo.

v2: use a new toplevel API, though it still passes NULL to something
that wasn't expecting it.
v3: pass -1 instead of 0.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alex Goins <agoins at nvidia.com>
2016-06-08 12:51:51 -04:00
Dave Airlie
fc1f61b75c randr/provider: only allow slave gpu to be offload sources.
The other way around makes no sense.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-04 15:33:10 -04:00
Adam Jackson
137ac094e7 dix: Push UpdateCurrentTimeIf down out of the main loop
This was added in:

    commit 312910b4e3
    Author: Chase Douglas <chase.douglas@canonical.com>
    Date:   Wed Apr 18 11:15:40 2012 -0700

        Update currentTime in dispatch loop

Unfortunately this is equivalent to calling GetTimeInMillis() once per
request. In the absolute best case (as on Linux) you're only hitting the
vDSO; on other platforms that's a syscall. Either way it puts a pretty
hard ceiling on request throughput.

Instead, push the call down to the requests that need it; basically,
grab processing and event generation.

Cc: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-04 10:58:01 -04:00
Keith Packard
dbe8d03c42 randr: Send ConfigNotify when manual monitor list changes
This lets clients know that the layout of the monitors on the screen
has changed so they can adapt appropriately.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-02-16 20:56:39 -08:00
Jan Burgmeier
7bb64d8c1d Fix XineramaQueryScreens for reverse prime
Make sure we account for slave CRTCs when building the monitor list,
since that's what rrxinerama uses to fake Xinerama geometry.

[ajax: Slightly more informative commit message.]

Bugzilla: https://bugs.freedesktop.org/92313
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-02-08 17:22:34 -05:00
Adam Jackson
e98b36bc69 randr: Silence unused variable warning
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-12-09 09:33:56 -05:00
Michel Dänzer
5bccde749d randr: Stop dirty tracking for shared pixmap being destroyed
Otherwise, we leave a dangling reference to the destroyed pixmap in the
master screen's pixmap_dirty_list.

Fixes regression from commit cf5d6414 ("randr: Factor out shared pixmap
destruction").

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2015-12-02 10:56:56 -05:00
agoins
c7f4aef8f4 randr: Cleanup rrSetupPixmapSharing()
protopix is completely redundant with mscreenpix. Get rid of it.

We don't need rrScrPriv, so remove it.

[ajax: also squash an unused variable in RRCrtcDetachScanoutPixmap,
though it'll come back when the rest of this series lands]

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:44:31 -05:00
agoins
7006b4e7ff randr: Factor out shared pixmap creation
The old version of rrCreateSharedPixmap(), in addition to actually creating
a shared pixmap with scanout, also set up pixmap tracking on the source
driver.

I will be needing to create multiple shared pixmaps for PRIME double
buffering, so factor the part that does shared pixmap creation into its own
function, the new rrCreateSharedPixmap(). Rename the old
rrCreateSharedPixmap() to rrSetupPixmapSharing(), a function that
replicates the old functionality of rrCreateSharedPixmap() using the new
rrCreateSharedPixmap().

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:15:01 -05:00
agoins
cf5d6414e0 randr: Factor out shared pixmap destruction
Shared pixmap destruction is done by unrefing the master pixmap twice: once
for the original reference, and once for the reference implicitly added by
PixmapShareToSlave. Then, unrefing the slave pixmap once.

When I add PRIME double buffering and synchronization, I will need to do
this in multiple places. To avoid duplication of code and comments
explaining it everywhere, factor it out into its own function and use that
in place of where it was before.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:14:51 -05:00
Alberto Milone
702c0a247f randr: make RROutputChanged change the main protocol screen not the gpu screen
We only set changes on the main protocol screen as, for example
in RRSetChanged() and RRTellChanged(), therefore we should follow
the same logic when reporting that an output changed in
RROutputChanged().

This means that RRTellChanged() will then update the relevant
timestamps also when events come from gpu screens.

[ajax: Fix mixed code and decls]

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alberto Milone <alberto.milone@canonical.com>
2015-10-21 15:13:22 -04:00
Jeremy Huddleston
5dc415048e randr: Silence -Wshift-negative-value warnings
rrtransform.c:199:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value,Semantic Issue]
            rot_cos = F(-1);
                      ^~~~~
rrtransform.c:114:14: note: expanded from macro 'F'
                ^~~~~~~~~~~~~~
../render/picture.h:200:24: note: expanded from macro 'IntToxFixed'
                        ^~~~~~~~~~~~~~~~~~~~~~
/opt/X11/include/pixman-1/pixman.h:130:56: note: expanded from macro 'pixman_int_to_fixed'
                                                           ~~~ ^

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-19 11:51:52 -04:00
Jeremy Huddleston
9f0fcd14b5 randr: Correct a miscall of abs() to instead call fabs()
rrtransform.c:124:22: warning: using integer absolute value function 'abs' when
      argument is of floating point type [-Wabsolute-value,Semantic Issue]
            if ((v = abs(f_transform->m[j][i])) > max)
                     ^
rrtransform.c:124:22: note: use function 'fabs' instead [Semantic Issue]
            if ((v = abs(f_transform->m[j][i])) > max)
                     ^~~
                     fabs

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-10-19 11:49:53 -04:00
Jon TURNEY
9ee05c8987 debug output format fix in RRMonitorCrtcName()
xorg/xserver/randr/rrmonitor.c:35:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘RRCrtc’ [-Werror=format=]

RRCrtc is XID is CARD32, which inside the server is unsigned long or int
depending on architecture, so a cast is required.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-09-24 13:21:01 -04:00
Michal Srb
91c7acfc34 randr: Allow RRSelectInput for ProviderChange and ResourceChange events
[ajax: To be clear, we already have code to emit these events, and it
 looks like it works, but to get them you'd have had to also ask for one
 of the other notify types.  This makes it possible to listen for e.g.
 ProviderChange alone.]

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michal Srb <msrb@suse.com>
2015-09-23 13:12:21 -04:00
Chris Wilson
245040f0d0 randr/prime: Don't stop on the first pipe when disabling ReplaceScanoutPixmap
As we define sizeFits based on whether a CRTC is active, and skip trying
to redirect the scanout on a disable pipe, we then attempt to undo it
later and fail because crtc->scanout_pixmap != DRI2_Pixmap and
!sizeFits. Paper over this failure by skipping unredirected CRTC when
disabling.

v2: Unwind upon failure

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84653
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
Reported-by: Christoph Haag <haagch@frickel.club>
Tested-by: Christoph Haag <haagch@frickel.club>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 14:42:51 -04:00
Adam Jackson
a1c80bb7d5 randr: Unexport some 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
Dave Airlie
90db5edf11 prime: add rotation support for offloaded outputs (v2)
One of the lacking features with output offloading was
that screen rotation didn't work at all.

This patch makes 0/90/180/270 rotation work with USB output
and GPU outputs.

When it allocates the shared pixmap it allocates it rotated,
and any updates to the shared pixmap are done using a composite
path that does the rotation. The slave GPU then doesn't need
to know about the rotation and just displays the pixmap.

v2:
rewrite the sync dirty helper to use the dst pixmap, and
avoid any strange hobbits and rotations.

This breaks ABI in two places.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-07-08 11:13:09 -07:00
Keith Packard
0409b6e6d6 Merge remote-tracking branch 'evelikov/master' 2015-05-11 16:50:43 -07:00
Keith Packard
d7091a21d9 Merge remote-tracking branch 'airlied/for-keithp' 2015-05-11 15:49:34 -07:00
Dave Airlie
a9ac02f694 xf86Crtc/monitors: create initial monitors for tiled outputs
This creates an automatic monitor for a tiled monitor at startup.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-04-27 13:40:41 +10:00
Alan Coopersmith
1c56ac63c0 Convert top level extensions to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:08 -07:00
Keith Packard
5de1383070 randr: Use Monitor list for Xinerama
This replaces the CRTC-based Xinerama implementation with one which
uses Monitors instead, allowing clients to manipulate the Xinerama
configuration through the RandR Monitor list.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-03-31 12:32:04 +10:00
Keith Packard
7e1f86d42b randr: Add Monitor support (v1.1)
Store the user-defined monitors in the RandR screen private.

Generate a list of monitors from both the user-defined ones and from
any outputs not mentioned in one of the user-defined monitors. This list
covers both the outputs in the main screen as well as any slaves.

v1.1: airlied: fix up primary skipping bug,
fix wrong height initialiser
add get_active flag from updated protocol.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-03-31 12:32:04 +10:00
Emil Velikov
23702dd268 randr: coding style fixes
In most of xserver code-base we define new functions at column 0, with
their return type provided on the previous line. Two functions did not
follow this rule so update them, and get them wrapped up to 80 as an
added bonus.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-24 17:21:26 +00:00
Emil Velikov
739e8fac0e randr: wrap long line
Also make use of total_name_len variable for consistency.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-24 17:21:23 +00:00
Emil Velikov
363cd0e0b4 randr: use local variables where possible
This will allow us to make the code more readable, and the lines will
fit within 80 columns.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-24 17:21:19 +00:00
Emil Velikov
93ef0e580e randr: use randr: prefix in ErrorF()
To provide some information about the origin of the message.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-24 17:21:15 +00:00
Emil Velikov
a08ee77398 randr: remove chatty error messages
All of these seem like left over from developments stage. Remove them as
they can cause excessive flood in the logs.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-24 17:20:54 +00:00
Jon TURNEY
95e83ff87a Don't allow both RandR XINERAMA and pseudoramiX XINERAMA extensions to register
Prevent RRXinerama from activating if PseudoramiX is, so we don't get XINERAMA
listed twice in the list of extensions.  I think this is otherwise benign, as
the PseudoramiX XINERAMA gets registered first and thus handles all requests.

Perhaps AddExtension() ought to warn us if the extension name is already
registered?

This appears to be a long-standing bug seen in XQuartz, and now in XWin as well.

Future work: Perhaps since RRXinerama isn't actually doing anything useful but
faking it when we have one screen, it seems that the PseudoramiX code could be
also used in that case.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-03-24 14:46:39 +00:00
Dave Airlie
df1b401f57 randr: attempt to fix primary on slave output (v2)
If the user wants to set one of the slave devices as
the primary output, we shouldn't fail to do so,
we were returning BadMatch which was tripping up
gnome-settings-daemon and bad things ensues.

Fix all the places we use primaryOutput to work
out primaryCrtc and take it into a/c when slave
gpus are in use.

v2: review from Aaron, fix indent, unhide has_primary from
macro. I left the int vs Bool alone to be consistent with
code below, a future patch could fix both.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-26 16:23:10 -08:00
Carlos Sánchez de La Lama
437d2ec5f2 randr: swap num-preferred field on RRGetOutputInfo reply
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88614
Signed-off-by: Carlos Sánchez de La Lama <csanchezdll@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-23 10:01:42 -08:00
Alan Coopersmith
3df2fcf124 randr: unvalidated lengths in RandR extension swapped procs [CVE-2014-8101]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:48 -08:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
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-11-12 10:25:00 +10:00
David Ung
b063a185ab randr: Fix logic in RRPointerToNearestCrtc
RRPointerToNearestCrtc is suppose to snap to the nearest Crtc,
but best_x and best_y is always positive, hence when calling
SetCursorPosition it will make the cursor even further away.
Correct delta x/y to allow negative values and also use
"width/height -1" in the calculation.  Also choose the closest
Crtc by setting the "best" value.

Signed-off-by: David Ung <davidu@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-07-30 14:40:17 -07:00
Dave Airlie
01e18af17f rrcrtc: brackets are hard, lets go shopping.
Slaving two outputs on a secondary GPU to a primary GPU testing
picked this up, in that we'd try to resize to the totally the
wrong thing, then as usual segfault in the rotation code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2014-05-12 14:55:04 -07:00
Robert Morell
6d892ad112 randr: Implement RandR 1.4 request swapping
The protocol handlers all have support for swapping variable data and
replies, but the top-level dispatch plumbing was missing.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-21 11:44:38 -07:00
Robert Morell
ed4ee7c34a randr: Fix size checks for SetProvider* reqs
Both xRRSetProviderOutputSourceReq and xRRSetProviderOffloadSinkReq are
fixed-size requests, so the length on the wire should match exactly.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-21 11:44:31 -07:00
Robert Morell
668321e7e5 randr: Fix crash for NULL swap dispatch procs
The previous code was checking the wrong table for function pointers.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-21 11:44:02 -07:00
David Sodman
caf1dec2a7 V2: Add check for link from output to crtc before optimizing out a CrtcSet call
The function RRCrtcSet call checks to see if the config being set is
already configured, but, doesn't check that the selected outputs are
connected to the crtc before skipping.  This means that the following
sequence will omit the final CrtcSet call to the driver:

    CRTC c1 connect to output o
    CRTC c2 connect to output o
    CRTC c1 connect to output o

This change adds the check to ensure that each of the calls are made to
the driver.

Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-24 16:33:35 -08:00
Keith Packard
9888770654 randr: Eliminate -Wshadow warnings
Don't use rrScrPriv for nested screen private fetching.

Eliminate a duplicate fetch of the randr screen private in rrCheckPixmapBounding.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-22 19:56:32 -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