summaryrefslogtreecommitdiff
path: root/randr
AgeCommit message (Collapse)AuthorFilesLines
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>
2013-02-08randr: bump advertised RandR version to 1.4Dave Airlie1-1/+1
Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Tested-by: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-11-30randr: call RRProviderInit in the proper place.Dave Airlie1-0/+2
No idea where this got lost across development cycles, but its definitely missing. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=57448 Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-11-05randr: export more provider property symbolsYaakov Selkowitz1-0/+8
These were added as part of commit 66d92afeaeed9f4a19267d95a1f81b9bf27162a5 but never declared or exported. Fixes warnings: rrproviderproperty.c:255:1: warning: no previous prototype for 'RRPostProviderPendingProperties' rrproviderproperty.c:327:1: warning: no previous prototype for 'RRConfigureProviderProperty' Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-08-06Merge remote-tracking branch 'alanc/master'Keith Packard3-5/+23
2012-08-06randr: fix xinerama output for output slavesDave Airlie1-1/+19
This fixes the xinerama geometry when output slaves are enabled. Tested with xdpyinfo -ext XINERAMA before after slave added. Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-08-06RRModeCreate: plug memory leak of newModes if AddResource failsAlan Coopersmith1-1/+3
Reported by parfait 1.0: Error: Memory leak (CWE 401) Memory leak of pointer 'newModes' allocated with realloc(((char*)modes), ((num_modes + 1) * 8)) at line 93 of randr/rrmode.c in function 'RRModeCreate'. pointer allocated at line 82 with realloc(((char*)modes), ((num_modes + 1) * 8)). Error: Memory leak (CWE 401) Memory leak of pointer 'newModes' allocated with malloc(8) at line 93 of randr/rrmode.c in function 'RRModeCreate'. pointer allocated at line 84 with malloc(8). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-08-06rrproperty.c: free newly allocated prop in more error pathsAlan Coopersmith1-2/+10
Reported by parfait 1.0: Error: Memory leak (CWE 401) Memory leak of pointer 'prop' allocated with RRCreateOutputProperty(property) at line 220 of randr/rrproperty.c in function 'RRChangeOutputProperty'. 'prop' allocated at line 154 with RRCreateOutputProperty(property). prop leaks when pending != 0 at line 160. Error: Memory leak (CWE 401) Memory leak of pointer 'prop' allocated with RRCreateOutputProperty(property) at line 346 of randr/rrproperty.c in function 'RRConfigureOutputProperty'. 'prop' allocated at line 334 with RRCreateOutputProperty(property). at line 350 of randr/rrproperty.c in function 'RRConfigureOutputProperty'. 'prop' allocated at line 334 with RRCreateOutputProperty(property). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-08-06rrproviderproperty.c: free newly allocated prop in more error pathsAlan Coopersmith1-2/+10
Reported by parfait 1.0: Error: Memory leak (CWE 401) Memory leak of pointer 'prop' allocated with RRCreateProviderProperty(property) at line 221 of randr/rrproviderproperty.c in function 'RRChangeProviderProperty'. 'prop' allocated at line 155 with RRCreateProviderProperty(property). prop leaks when pending != 0 at line 161. Error: Memory leak (CWE 401) Memory leak of pointer 'prop' allocated with RRCreateProviderProperty(property) at line 345 of randr/rrproviderproperty.c in function 'RRConfigureProviderProperty'. 'prop' allocated at line 333 with RRCreateProviderProperty(property). at line 349 of randr/rrproviderproperty.c in function 'RRConfigureProviderProperty'. 'prop' allocated at line 333 with RRCreateProviderProperty(property). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-16Use C99 designated initializers in RandR 1.4 extension EventsAlan Coopersmith1-23/+24
RandR 1.4 was going through review in parallel with main batch of C99 initialization changes - sync up now that both have landed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-16Use C99 designated initializers in RandR 1.4 extension RepliesAlan Coopersmith3-44/+55
RandR 1.4 was going through review in parallel with main batch of C99 initialization changes - sync up now that both have landed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-09Move extension initialisation prototypes into extinit.hDaniel Stone2-4/+1
Create extinit.h (and xf86Extensions.h, for Xorg-specific extensions) to hold all our extension initialisation prototypes, rather than duplicating them everywhere. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09Replace padlength tables with inline functions from misc.hAlan Coopersmith1-4/+1
Adds new function padding_for_int32() and uses existing pad_to_int32() depending on required results. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use C99 designated initializers in extension EventsAlan Coopersmith4-85/+73
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use C99 designated initializers in randr RepliesAlan Coopersmith7-159/+204
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use calloc to zero fill buffers being allocated for replies & eventsAlan Coopersmith1-1/+1
Ensures padding bytes are zero-filled Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09ProcRRListOutputProperties: skip atom walk if the list is emptyAlan Coopersmith1-5/+7
pAtoms is only allocated if numProps was non-zero, so move the walk through the property list to copy atoms to it inside the if (numProps) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09ProcRRGetScreenInfo: swap configTimestamp as wellAlan Coopersmith1-0/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Bug 51375: Xorg doesn't set status for RRGetOutputInfoJaroslav Šmíd1-0/+1
https://bugs.freedesktop.org/show_bug.cgi?id=51375 https://bugs.freedesktop.org/attachment.cgi?id=63397 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use temporary variables instead of parts of reply structuresAlan Coopersmith3-19/+26
When passing variable pointers to functions or otherwise doing long sequences to compute values for replies, create & use some new temporary variables, to allow for simpler initialization of reply structures in the following patches. Move memsets & other initializations to group with the rest of the filling in of the reply structure, now that they're not needed so early in the code path. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Remove unneccesary casts from WriteToClient callsAlan Coopersmith7-27/+26
Casting return to (void) was used to tell lint that you intended to ignore the return value, so it didn't warn you about it. Casting the third argument to (char *) was used as the most generic pointer type in the days before compilers supported C89 (void *) (except for a couple places it's used for byte-sized pointer math). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-07dix/randr: add a hook into screen to replace scanout pixmapDave Airlie3-1/+62
For DRI2 in some offload cases we need to set a new pixmap on the crtc, this hook allows dri2 to call into randr to do the necessary work to set a pixmap as the scanout pixmap for the crtc the drawable is currently on. This is really only to be used for unredirected full screen apps in composited environments. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: add hooks for offload sink provider protocolDave Airlie3-1/+65
This adds the protocol handler and associated providers handling for the offload slaves, it allows two providers to be connected as offload sink/source. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07dix/xf86: initial offload slave tracking (v1.1)Dave Airlie1-0/+7
add the linked list and provider hooks. v1.1: add another assert in the add path. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: add output source setupDave Airlie3-2/+66
This adds the output sources to the associated list and adds the protocol handler for the randr SetProviderOutputSource. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: hook up output slave to screen resources returnDave Airlie1-0/+169
When the client asks for the screen resources list, it will now get a list of crtc/outputs for the master + all attached slaves, this will let randr configure all attached slave devices properly. Keith asked I merge the two functions, but not just yet, the current multi screen code doesn't handle primary yet properly, will fix it up later. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: check the screen size bounds against the masterDave Airlie1-2/+12
The master contains the complete screen size bounds, so check the width/height against it. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: fix tellchanged to work with slave scanoutsDave Airlie1-7/+19
Tell changed need to tell only for the master pixmap, however it gets called from various places for slave screens, so convert to telling clients about changes on the master screen. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: fixup constrain to work with slave screens.Dave Airlie1-11/+46
Current code constrains the cursor to the crtcs on the master device, for slave outputs to work we have to include their crtcs in the constrain calculations. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: add initial scanout pixmap support (v3)Dave Airlie2-0/+183
When randr notices a crtc configuration request for a slave device, it checks if the slave allocated pixmap exists and is suitable, if not it allocates a new shared pixmap from the master, shares it to the slave, and starts the master tracking damage to it, to keep it updated from the current front pixmap. If the resize means the crtc is no longer used it will destroy the slave pixmap. This adds the concept of a scanout_pixmap to the randr_crtc object, and also adds a master pixmap pointer to the pixmap object, along with defining some pixmap helper functions for getting pixmap box/regions. v2: split out pixmap sharing to a separate function. v3: update for void * Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07dix: add ability to link output slave gpus to the current gpu (v1.1)Dave Airlie1-0/+7
Just add the interfaces to attach/detach output slaves, and a linked list to keep track of them. Hook up the randr providers list to include these slaves. v1.1: add another assert to the add path. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07randr: expose unattached providers to the clients.Dave Airlie1-0/+8
This provides the unattached provider list to the clients. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06randr: add provider object and provider property support (v6)Dave Airlie6-3/+1163
This adds the initial provider object and provider property support to the randr dix code. v2: destroy provider in screen close v2.1: fix whitespace v3: update for latest rev of protocol + renumber after 1.4 tearout. v4: fix logic issue, thanks Samsagax on irc v5: keithp's review: fix current_role, fix copyrights, fix master reporting crtc/outputs. v6: port to new randr interface, drop all set role bits for now v7: drop devPrivate in provider, not needed, add BadMatch returns for NULL SetProviderOffloadSink and SetProviderOutputSource, drop the old typedef. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-29randr: Fix REQUEST vs. REQUEST_SIZE_MATCH mismatchAaron Plattner1-1/+1
ProcRRGetScreenSizeRange uses REQUEST(xRRGetScreenSizeRangeReq) followed by REQUEST_SIZE_MATCH(xRRGetScreenInfoReq). This happens to work out because both requests have the same size, so this is not a functional change, just a cosmetic one. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28randr: Catch two more potential unset rrScrPriv usesKeith Packard2-1/+5
Ricardo Salveti <ricardo.salveti@linaro.org> found one place where the randr code could use the randr screen private data without checking for null first. This happens when the X server is running with multiple screens, some of which are randr enabled and some of which are not. Applications making protocol requests to the non-randr screens can cause segfaults where the server touches the unset private structure. I audited the code and found two more possible problem spots; the trick to auditing for this issue was to look for functions not taking a RandR data structure and where there was no null screen private check above them in the call graph. Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28randr: first check pScrPriv before using the pointer at RRFirstOutputRicardo Salveti de Araujo1-0/+3
Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo, which later calls RRFirstOutput. Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-21randr: Clean up compiler warnings about unused and shadowing variablesKeith Packard4-16/+13
set but not used variables shadowing a previous local A hidden problem was that the VERIFY_RR_* macros define local 'rc' variables, any other local definitions for those would be shadowed and generate warnings from gcc. I've renamed the other locals 'ret' instead of 'rc'. Signed-off-by: Keith Packard <keithp@keithp.com>