Commit Graph

139 Commits

Author SHA1 Message Date
Eric Anholt
e2e50c5097 xserver: Unifdef HAVE_CONFIG_H
The X Server never generates a global config.h, and instead all these
paths are including dix-config.h or xorg-config.h.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-03-23 13:19:51 -04:00
Hans de Goede
02ff0a5d7e xf86RandR12: Fix XF86VidModeSetGamma triggering a BadImplementation error
Commit b4e46c0444 ("xfree86: Hook up colormaps and RandR 1.2 gamma code")
dropped the providing of a pScrn->ChangeGamma callback from the xf86RandR12
code. Leaving pScrn->ChangeGamma NULL in most cases.

This triggers the BadImplementation error in xf86ChangeGamma() :

    if (pScrn->ChangeGamma)
        return (*pScrn->ChangeGamma) (pScrn, gamma);

    return BadImplementation;

Which causes X-apps using XF86VidModeSetGamma to crash with a
X protocol error.

This commit fixes this by re-introducing the xf86RandR12ChangeGamma
helper removed by the commit and adjusting it to work with the new
combined palette / gamma code.

Fixes: b4e46c0444 ("xfree86: Hook up colormaps and RandR 1.2 gamma code")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-28 14:53:39 -04:00
Hans de Goede
a58dd678bf xf86RandR12: Move calculating of shift inside init_one_component
This is a preparation patch to allow easier usage of init_one_component
outside of xf86RandR12CrtcInitGamma.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-28 14:53:39 -04:00
Michel Dänzer
5b9f3ea250 xfree86/modes: Set RandR primary output from CreateScreenResources
Fixes XRRGetOutputPrimary and xrandr not reporting a primary output after
startup. This was especially confusing when an output was explicitly
marked as primary using Option "Primary" in Section "Monitor".

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2016-09-16 10:00:08 -07:00
Michel Dänzer
a446ff84de xfree86/modes: Handle no palette case better in xf86RandR12CrtcSetGamma
Just use the RandR gamma ramp directly.

Fixes random on-monitor colours with drivers which don't call
xf86HandleColormaps, e.g. modesetting.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97154

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-10 16:56:09 +09:00
Michel Dänzer
b4e46c0444 xfree86: Hook up colormaps and RandR 1.2 gamma code v6
Instead of breaking the former when the driver supports the latter,
hook them up so that the hardware LUTs reflect the combination of the
current colourmap and gamma states. I.e. combine the colourmap, the
global gamma value/ramp and the RandR 1.2 per-CRTC gamma ramps into one
combined LUT per CRTC.

Fixes e.g. gamma sliders not working in games.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27222

v2:
* Initialize palette_size and palette struct members, fixes crash on
  server startup.
v3:
* Free randrp->palette in xf86RandR12CloseScreen, fixes memory leak.
v4:
* Call CMapUnwrapScreen if xf86RandR12InitGamma fails (Emil Velikov).
* Still allow xf86HandleColormaps to be called with a NULL loadPalette
  parameter in the xf86_crtc_supports_gamma case.
v5:
* Clean up inner loops in xf86RandR12CrtcComputeGamma (Keith Packard)
* Move palette update out of per-CRTC loop in xf86RandR12LoadPalette
  (Keith Packard)
v6:
* Handle reallocarray failure in xf86RandR12LoadPalette (Keith Packard)

Reviewed-by: Keith Packard <keithp@keithp.com>
2016-07-28 10:12:05 +09:00
Michel Dänzer
17213b74fd xfree86/modes: Remove xf86RandR12CrtcGetGamma
This would normally return the same values the core RandR code passed to
xf86RandR12CrtcSetGamma before, which is rather pointless. The only
possible exception would be if a driver tried initializing
crtc->gamma_red/green/blue to reflect the hardware LUT state on startup,
but that can't work correctly if whatever set the LUT before the server
started was running at a different depth.

Even the pointless round-trip case will no longer work with the
following change.

Reviewed-by: Keith Packard <keithp@keithp.com>
2016-07-28 10:11:14 +09:00
Michel Dänzer
62f4405257 xfree86/modes: Move gamma initialization to xf86RandR12Init12 v2
RRCrtcGammaSetSize cannot be used yet in xf86InitialConfiguration,
because randr_crtc isn't allocated yet at that point, but a following
change will require RRCrtcGammaSetSize to be called from
xf86RandR12CrtcInitGamma.

v2:
* Bail from xf86RandR12CrtcInitGamma if !crtc->funcs->gamma_set (Keith
  Packard)

Reviewed-by: Keith Packard <keithp@keithp.com>
2016-07-27 17:49:39 +09: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
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
Daniel Stone
e957a2e5dd dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug
handler when running rootless (e.g. as a part of Weston/Mutter), since
the root window has no storage, so generating exposures will result in
writes to invalid memory.

Unfortunately, preventing the segfault also breaks sprite confinement.
SetRootClip updates winSize and borderSize for the root window, which
when combined with RRScreenSizeChanged calling ScreenRestructured,
generates a new sprite-confinment area to update it to the whole screen.

Removing this call results in the window geometry being reported
correctly, but winSize/borderSize never changing from their values at
startup, i.e. out of sync with the root window geometry / screen
information in the connection info / XRandR.

This patch introduces a hybrid mode, where we update winSize and
borderSize for the root window, enabling sprite confinement to work
correctly, but keep the clip emptied so exposures are never generated.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22 13:26:31 -05:00
Egbert Eich
3cd7d33380 randr: Remove senseless checks for xf86RandR12Key
When xf86RandR12Key is not set we will not get to the places where
these tests are done as the functions in question are not called.
In most cases we would have crashed before these checks anyway.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-09-21 14:44:10 -04: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
4cb1034906 Convert hw/xfree86 to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07: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
Dominik Behr
70e564104b xf86RandR12: use correct gamma size when allocating gamma table
When setting crtc->gamma_size to randr_crtc->gammaSize we should
use randr_crtc->gammaSize to allocate new gamma table in crtc.
Currently, if randr_crtc->gammaSize > crtc->gammaSize the subsequent
memcpy will overwrite memory beyond the end of gamma table.

Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-21 22:27:09 -07:00
Keith Packard
07b03e721e xfree86: Fix -Wshadow warnings
Just rename variables to eliminate -Wshadow warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-22 19:56:31 -08:00
Keith Packard
c78be3a4b7 xfree86 warning reduction
This gets the easy warnings, mostly constant string problems.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Aaron Plattner
bdd1e22cbd xfree86: detach scanout pixmaps when detaching output GPUs
Commit 8f4640bdb9 fixed a bit of a
chicken-and-egg problem by detaching GPU screens when their providers
are destroyed, which happens before CloseScreen is called.  However,
this created a new problem: the GPU screen tears down its RandR crtc
objects during CloseScreen and if one of them is active, it tries to
detach the scanout pixmap then.  This crashes because
RRCrtcDetachScanoutPixmap tries to get the master screen's screen
pixmap, but crtc->pScreen->current_master is already NULL at that
point.

It doesn't make sense for an unbound GPU screen to still be scanning
out its former master screen's pixmap, so detach them first when the
provider is destroyed.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-07-25 11:15:53 -07:00
Dave Airlie
9d26e8eaf5 randr: report changes when we disconnect a GPU slave
When we disconnect an output/offload slave set the changed bits,
so a later TellChanged can do something.

Then when we remove a GPU slave device, sent change notification
to the protocol screen.

This allows hot unplugged USB devices to disappear in clients.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-30 10:08:43 +10:00
Jeremy White
ecf6275508 Define prototypes for hw/xfree86/modes/xf86Modes.c only in xf86Modes.h.
This removes a large number of redundant declaration warnings.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Reviewed-by: Robert Morell <rmorell@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-04-08 09:19:34 -07:00
Dave Airlie
8f4640bdb9 randr: cleanup provider properly
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-03-01 18:14:28 +10:00
Rui Matos
1bf81af4a6 xf86RandR12: Don't call ConstrainCursorHarder() if panning is enabled
Panning is at odds with CRTC cursor confinement. This disables CRTC cursor
confinement as long as panning is enabled.

Fixes regression introduced in 56c90e29f0.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Rui Matos <tiagomatos@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-08-06 15:03:47 -07:00
Maarten Lankhorst
deb08658e2 xfree86: Strip dangling pointers from desiredMode
Based on the original patch by Chris Wilson, which was a better fix than mine.

We stash a copy of the desiredMode on the crtc so that we can restore it
after a vt switch. This copy is a simple memcpy and so also stashes a
references to the pointers contained within the desiredMode. Those
pointers are freed the next time the outputs are probed and mode list
rebuilt, resulting in us chasing those dangling pointers on the next
mode switch.

==22787== Invalid read of size 1
==22787==    at 0x40293C2: __GI_strlen (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22787==    by 0x668F875: strdup (strdup.c:42)
==22787==    by 0x5DBA00: XNFstrdup (utils.c:1124)
==22787==    by 0x4D72ED: xf86DuplicateMode (xf86Modes.c:209)
==22787==    by 0x4CA848: xf86CrtcSetModeTransform (xf86Crtc.c:276)
==22787==    by 0x4D05B4: xf86SetDesiredModes (xf86Crtc.c:2677)
==22787==    by 0xA7479D0: sna_create_screen_resources
(sna_driver.c:220)
==22787==    by 0x4CB914: xf86CrtcCreateScreenResources (xf86Crtc.c:725)
==22787==    by 0x425498: main (main.c:216)
==22787==  Address 0x72c60e0 is 0 bytes inside a block of size 9 free'd
==22787==    at 0x4027AAE: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22787==    by 0x4A547E: xf86DeleteMode (xf86Mode.c:1984)
==22787==    by 0x4CD84F: xf86ProbeOutputModes (xf86Crtc.c:1578)
==22787==    by 0x4DC405: xf86RandR12GetInfo12 (xf86RandR12.c:1537)
==22787==    by 0x518119: RRGetInfo (rrinfo.c:202)
==22787==    by 0x51D997: rrGetScreenResources (rrscreen.c:335)
==22787==    by 0x51E0D0: ProcRRGetScreenResources (rrscreen.c:475)
==22787==    by 0x513852: ProcRRDispatch (randr.c:493)
==22787==    by 0x4346DB: Dispatch (dispatch.c:439)
==22787==    by 0x4256E4: main (main.c:287)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36108
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-11 15:55:22 -07:00
Dave Airlie
e2fd447e76 xf86: add callback for offloak sink setting support.
This adds support for setting the offload sink to the xf86 ddx.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:39:03 +01:00
Dave Airlie
22f02120eb xf86: store scanout pixmap in the xf86 struct as well.
This is so we can tell the scanout pixmap has changed between calls
to the crtc set function.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:45 +01:00
Dave Airlie
98686512cb xf86: add output source setting callback (v2)
This adds support for the randr callback for setting the output source
for a device.

v2: drop root clip change on detach

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:42 +01:00
Dave Airlie
2ed3f64d9d xf86: add initial scanout pixmap support (v2)
Add the simple passthrough interface for drivers to use,
so they can set scanout pixmaps.

v2: detach scanout pixmap properly.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:10 +01:00
Dave Airlie
9b5cf2ed76 xfree86: add framework for provider support in ddx. (v4)
This adds the framework for DDX provider support.

v2: as per keithp's suggestion remove the xf86 provider object
and just store it in the toplevel object.

v3: update for new protocol

v4: drop devPrivate, free name

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 22:16:08 +01:00
Dave Airlie
1f0e8bd5eb api: rework the X server driver API to avoid global arrays.
This is a squash merge containing all the API changes, as
well as the video ABI bump.

Its been squashed to make bisection easier.

Full patch log below:

commit b202738bbf0c5a1c1172767119c2c71f1e7f8070
Author: Aaron Plattner <aplattner@nvidia.com>
Date:   Mon May 14 15:16:11 2012 -0700

    xfree86: Bump video ABI to 13.0

    The ABI was broken by changes to convert from screen index numbers to ScreenPtr
    / ScrnInfoPtr in various structures and function signatures.

    Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 10:56:57 2012 +0100

    xf86: xf86ClearEntityListForScreen should take a pScrn

    When adding GPU screens this make life easier.

    (also fix comment, as pointed out by Alan)

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit afee8b5ab4501597ecc1ade34124d7ca227ab055
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 07:07:32 2012 +0100

    xf86i2c: add pscrn for drivers to use

    This just adds a pScrn pointer into the struct for the drivers to use
    instead of scrnIndex. Mostly scrnIndex is used for logging, but some
    drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

    Removing the scrnIndex is a bit more involved and I'm not sure its worth
    the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit ea5092f1f679691d187f1eee9427e6057beec56e
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 19:25:20 2012 +0100

    dix/gc: consolidate GC object creation in one place

    The standard GC create and scratch GC create were 90% the same really,
    and I have a need in the future for creating GC objects without the
    other bits, so wanted to avoid a third copy.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 10:24:06 2012 +0100

    xf86: add a define to denote the new non-index interfaces are being used

    This can be used by drivers to provide compatible APIs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 15:09:12 2012 +0100

    dix: make Create/Free scratch pixmaps take a ScreenPtr

    While technically an API/ABI change I doubt anyone uses it,
    but it helps in splitting screens up.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:57:55 2012 +0100

    xf86/xv: remove scrnIndexfrom xf86FindXvOptions.

    Move this interface to taking an ScrnInfoPtr.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:53:59 2012 +0100

    xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2)

    stop passing indices into this function.

    v2: drop flags argument.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 58824e414f35682435f15bfe6c4b656bd90b9235
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:48:09 2012 +0100

    xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI)

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:18:59 2012 +0100

    xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2)

    Instead of passing an index, pass the actual ScreenPtr. This allows
    more moving towards not abusing xf86Screens + screenInfo.

    v2: drop the blockData/wakeupData args as per ajax's suggestion.,
    fix docs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 790d003de20fb47674420a24dadd92412d78620d
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Apr 11 09:53:14 2012 +0100

    xf86/common: remove some more pScrn->pScreen uses

    remove some more conversions that appeared after api cleanups.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:34:53 2012 +0100

    ddc: change API to take ScrnInfoPtr (v2)

    This removes all xf86Screens usage from ddc code,
    it modifies the API for some functions to avoid taking indices.

    v2: address Alan's comments about dropping DDC2Init parameter.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit fe3f57b6eaf6860a33876a54f9439f69578f03a5
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:31:26 2012 +0100

    vbe: don't use index for VBEInterpretPanelID (API)

    Remove use of xf86screens from vbe module.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit abf1965f4ed91529036d3fdb470d6a3ce6f29675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:25:11 2012 +0100

    int10/vbe: don't use xf86Screens. (ABI) (v3)

    Pass the ScrnInfoPtr instead of the index in the int10 struct.

    This saves us using it to dereference xf86Screens.

    v2: address Alan's comment to fix struct alignment.

    v3: squash in all the int10 fixes, test the vm86 code builds,
    after comments by Keith.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 23cca612b4fb5efc33683c7624b803b457387e3d
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:30:18 2012 +0100

    xserver: drop index argument to ScreenInit (ABI/API) (v2)

    This drops the index argument, its the same as pScreen->myNum,
    and its the last major index abuse I can find.

    v2: address Alan's review - update docs, fix xwin/xnest/darwin

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:23:01 2012 +0100

    xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API)

    This migrates PointerMoved from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:20:46 2012 +0100

    xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API)

    This migrates the PMEvent from index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:18:30 2012 +0100

    xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API)

    This migrates the SetDGAMode callback from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit baf5e4818a74f2b68c3dfdcc56f54322351039a0
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:14:11 2012 +0100

    xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2)

    This migrates the ChangeGamma interface to avoid passing a index.

    v2: fix xf86RandR12.c + xf86cmap.c call

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 51e5f90ada929d6b23176090badbb42fdb3fa550
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:11:09 2012 +0100

    xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API)

    The EXA interface migrates to ScreenPtr,
    and the xf86 interface migrated to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 94f1f21d17e86f96d4a54292a399160950087675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:02:11 2012 +0100

    xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API)

    This migrates the ValidMode to passing a ScrnInfoPtr instead
    of an index.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3f8f18198fed4f39ec805b508a3482e91eea26b2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:59:46 2012 +0100

    xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2)

    This migrate the SwitchMode interface to take a ScrnInfoPtr
    instead of an index.

    v2: drop flags.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d06a038a5c49328ab3a8d969d24f9fcd22c63202
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:50:37 2012 +0100

    xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2)

    This converts AdjustFrame code paths to passing a ScrnInfoPtr
    instead of an integer index.

    v2: drop flags args.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:41:27 2012 +0100

    xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2)

    Another index->pScrn conversion.

    v2: drop flags arg.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:35:41 2012 +0100

    xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2)

    This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr
    instead of an index into xf86Screens. This allows dropping more
    public dereferences of the xf86Screens and screenInfo.

    v2: drop flags args as suggested by Keith, fix docs.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 06729dbbc804a20242e6499f446acb5d94023c3c
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:04:59 2012 +0100

    xserver: remove index from CloseScreen (API/ABI breakage)

    This drops the index from the CloseScreen callback,
    its always been useless really, since the pScreen contains it.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 13:22:18 +01:00
Dave Airlie
2e237c838f xf86: reimplement XF86SCRNINFO macro using new functions.
This macro did lookups via privates but we can just use the ScreenToScrn
conversion instead.

This patch drops all in-server uses, we should drop the macro later,
once drivers have been converted to not use it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-21 12:59:20 +01:00
Dave Airlie
738367ac9b xf86/modes: drop two uses of screenInfo
Just use new macros to access scrn->screen.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-21 12:59:20 +01:00
Dave Airlie
41151f88a6 xf86: migrate to using xf86ScreenToScrn wrapper (v2)
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-05-21 12:59:08 +01:00
James Cloos
afc153a5b4
Fix RANDR’s gamma_to_ramp().
In order to generate a 256-entry ramp in [0,65535] which covers the full
range, one must mupliply eight-bit values not by 256 but rather by 257.

Many years back – well before the RANDR extension was written, and
before xorg@fdo – a similar bug fix was made to the DIX for converting
client-supplied eight-bit color values into sixteen-bit values.

Noticed by: Elle Stone and Graeme Gill.

Signed-off-by: James Cloos <cloos@jhcloos.com>
2012-05-08 17:55:10 -04:00
Keith Packard
9838b7032e Introduce a consistent coding style
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>
2012-03-21 13:54:42 -07:00
Peter Hutterer
8bebb4b489 Store desktop dimensions in screenInfo.
For Zaphod mode screen crossing handling we need to know the size of all
screens together (i.e. the whole desktop size). Store that in the screenInfo to
have it readily available in events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-13 11:26:09 +10:00
Nicolas Kaiser
387f45a707 hw/xfree86/modes: remove duplicated include
Remove duplicated include.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2011-04-24 19:46:06 -07:00
Adam Jackson
3d688316af xfree86: warning fix
xf86RandR12.c: In function 'xf86RandR12EnterVT':
xf86RandR12.c:1769:5: warning: ISO C90 forbids mixed declarations and code

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 13:01:03 -04:00
Keith Packard
6c90e839d9 Merge remote branch 'whot/for-keith' 2011-03-03 14:41:44 -08:00
Keith Packard
b833f9b924 Revert "Replace huge argument list in xf86CrtcSetModeTransform with struct"
This reverts commit 8b35118c03.
2011-02-23 11:18:35 -08:00
Keith Packard
a91d33917b Revert "randr: Add sprite position transforms"
This reverts commit 66294afcab.
2011-02-23 11:18:12 -08:00
Keith Packard
3d4ee25a1e Revert "randr: Implement RRSetCrtcConfigs"
This reverts commit d94a035ea9.
2011-02-23 11:18:08 -08:00
Keith Packard
8b0e651f7d Revert "hw/xfree86/modes: Add optional driver API for RRSetCrtcConfigs"
This reverts commit 86c489c319.
2011-02-23 11:18:05 -08:00
Keith Packard
9e8c20b0d4 Revert "randr: Add per-crtc pixmaps"
This reverts commit 82612045e1.
2011-02-23 11:17:42 -08:00
Keith Packard
7b7cd3f121 Revert "Set sprite transforms from RRSetCrtcConfigs"
This reverts commit a88d70fb20.
2011-02-23 11:17:29 -08:00
Keith Packard
fd9331f6eb Revert "Separate out screen size and screen pixmap sizes in RRScreenSizeSet"
This reverts commit 752c368421.
2011-02-23 11:17:24 -08:00
Peter Hutterer
e48bf3b640 xfree86: replace two inputInfo.pointer uses with device loops.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Keith Packard
752c368421 Separate out screen size and screen pixmap sizes in RRScreenSizeSet
This provides for separate sizes for the screen scanout and rendering
buffer and the application-visible screen size.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-12-06 20:09:04 -08:00
Keith Packard
a88d70fb20 Set sprite transforms from RRSetCrtcConfigs
These were getting ignored.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-12-06 20:08:58 -08:00