summaryrefslogtreecommitdiff
path: root/randr
AgeCommit message (Collapse)AuthorFilesLines
2016-02-16randr: Send ConfigNotify when manual monitor list changesKeith Packard1-2/+7
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-08Fix XineramaQueryScreens for reverse primeJan Burgmeier2-3/+15
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>
2015-12-09randr: Silence unused variable warningAdam Jackson1-1/+0
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-12-02randr: Stop dirty tracking for shared pixmap being destroyedMichel Dänzer1-3/+8
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-01randr: Cleanup rrSetupPixmapSharing()agoins1-6/+1
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-01randr: Factor out shared pixmap creationagoins1-17/+36
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-01randr: Factor out shared pixmap destructionagoins1-8/+15
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-10-21randr: make RROutputChanged change the main protocol screen not the gpu screenAlberto Milone1-5/+17
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-19randr: Silence -Wshift-negative-value warningsJeremy Huddleston1-4/+4
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-19randr: Correct a miscall of abs() to instead call fabs()Jeremy Huddleston1-1/+1
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-09-24debug output format fix in RRMonitorCrtcName()Jon TURNEY1-1/+1
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-23randr: Allow RRSelectInput for ProviderChange and ResourceChange eventsMichal Srb1-1/+3
[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-21randr/prime: Don't stop on the first pipe when disabling ReplaceScanoutPixmapChris Wilson1-22/+45
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-07-08randr: Unexport some implementation detailsAdam Jackson1-5/+5
Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08prime: add rotation support for offloaded outputs (v2)Dave Airlie1-17/+43
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-05-11Merge remote-tracking branch 'evelikov/master'Keith Packard2-24/+25
2015-05-11Merge remote-tracking branch 'airlied/for-keithp'Keith Packard2-3/+12
2015-04-27xf86Crtc/monitors: create initial monitors for tiled outputsDave Airlie2-3/+12
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-21Convert top level extensions to new *allocarray functionsAlan Coopersmith8-34/+33
v2: remove now useless parentheses Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-03-31randr: Use Monitor list for XineramaKeith Packard1-98/+20
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-31randr: Add Monitor support (v1.1)Keith Packard6-0/+838
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-24randr: coding style fixesEmil Velikov1-2/+4
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-24randr: wrap long lineEmil Velikov1-2/+3
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-24randr: use local variables where possibleEmil Velikov1-13/+17
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-24randr: use randr: prefix in ErrorF()Emil Velikov1-1/+1
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-24randr: remove chatty error messagesEmil Velikov2-6/+0
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-24Don't allow both RandR XINERAMA and pseudoramiX XINERAMA extensions to registerJon TURNEY1-0/+5
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-01-26randr: attempt to fix primary on slave output (v2)Dave Airlie3-7/+33
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-23randr: swap num-preferred field on RRGetOutputInfo replyCarlos Sánchez de La Lama1-0/+1
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>
2014-12-08randr: unvalidated lengths in RandR extension swapped procs [CVE-2014-8101]Alan Coopersmith1-0/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12Drop trailing whitespacesPeter Hutterer5-14/+14
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-07-30randr: Fix logic in RRPointerToNearestCrtcDavid Ung1-5/+6
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-05-12rrcrtc: brackets are hard, lets go shopping.Dave Airlie1-3/+4
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-04-21randr: Implement RandR 1.4 request swappingRobert Morell1-0/+138
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-21randr: Fix size checks for SetProvider* reqsRobert Morell1-2/+2
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-21randr: Fix crash for NULL swap dispatch procsRobert Morell1-1/+1
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-02-24V2: Add check for link from output to crtc before optimizing out a CrtcSet callDavid Sodman1-2/+12
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-01-22randr: Eliminate -Wshadow warningsKeith Packard1-9/+8
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-12Replace 'pointer' type with 'void *'Keith Packard9-43/+43
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>
2013-10-30randr: deliver Output and Crtc events of attached output providers.Michal Srb1-0/+24
Consider all attached output providers when looking for changed outputs and crtcs. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Michal Srb <msrb@suse.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-30randr: send RRResourceChangeNotify eventMichal Srb4-0/+49
Send RRResourceChangeNotify event when provider, output or crtc was created or destroyed. I.e. when the list of resources returned by RRGetScreenResources and RRGetProviders changes. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Michal Srb <msrb@suse.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-30randr: send RRProviderChangeNotify eventMichal Srb3-0/+65
Send RRProviderChangeNotify event when a provider becomes output source or offload sink. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Michal Srb <msrb@suse.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-09-10randr: Fix a copypasta bug in CRTC confinementAdam Jackson1-1/+1
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-04-30randr: only respected changed on the protocol screenDave Airlie1-1/+1
We don't want to know about changes on the non-protocol screen, we will fix up setchanged to make sure non-protocol screens update the protocol screens when they have a change. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-30randr: make SetChanged modify the main protocol screen not the gpu screenDave Airlie1-1/+15
When SetChanged is called we now modify the main protocol screen, not the the gpu screen. Since changed stuff should work at the protocol level. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-30randr: don't directly set changed bits in randr screenDave Airlie6-4/+16
Introduce a wrapper interface so we can fix things up for multi-gpu situations later. This just introduces the API for now. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-03-18Merge remote-tracking branch 'whot/next'Keith Packard1-6/+3
2013-03-01randr: cleanup provider properlyDave Airlie2-0/+8
So in the cold plug server shutdown case, we reap the resources before we call CloseScreen handlers, so the config->randr_provider is a dangling pointer when the xf86CrtcCloseScreen handler is called, however in the hot screen unplug case, we can't rely on automatically reaped resources, so we need to clean up the provider in the xf86CrtcCloseScreen case. This patch provides a cleanup callback from the randr provider removal into the DDX so it can cleanup properly, this then gets called by the automatic code for cold plug, or if hot unplug it gets called explicitly. Fixes a number of random server crashes on shutdown Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58174 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=891140 Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-15randr: fix "set but unused" warningsPeter Hutterer1-6/+3
rrcrtc.c: In function 'RRCrtcDetachScanoutPixmap': rrcrtc.c:366:9: warning: variable 'ret' set but not used [-Wunused-but-set-variable] rrcrtc.c: In function 'rrCheckPixmapBounding': rrcrtc.c:505:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable] rrcrtc.c:445:9: warning: unused variable 'i' [-Wunused-variable] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2013-02-11randr: unref the provider shared pixmap the appropriate number of timesAaron Plattner1-0/+5
When an RandR shared pixmap is created in rrCreateSharedPixmap, it has a refcnt of 1. Then, PixmapShareToSlave bumps the refcnt to 2. However, there's no corresponding PixmapUnshareFromSlave where the refcnt can be decreased again, and there's no convenient common place where the refcnt can be decremented when the slave pixmap is destroyed. Fix this by just unreffing the pixmap twice in RRCrtcDetachScanoutPixmap. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>