summaryrefslogtreecommitdiff
path: root/src/sna/sna_driver.c
AgeCommit message (Collapse)Author
2016-07-21sna: Unregister the BlockHandler on closeChris Wilson
Now that we register a callback with an external stack and not the screen, we have to remove it when the screen is destroyed. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-20Update to ABI 22 and NotifyFdChris Wilson
ABI 22 brings in a new BlockHandler/WakeupHandler interface (SetNotifyFd) and throws out the current interface (albeit without delivering any improvements). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-02DRI3 is not supported by mesa/i915Chris Wilson
Since mesa requires __DRI2_FLUSH version 4 for its DRI3 support and mesa/i915 only provides version 3, libGL fails to load (not even falling back to DRI2). Workaround this by not enabling DRI3. References: https://bugs.freedesktop.org/show_bug.cgi?id=96783 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-28sna: Restore TearFree operation after switching everything offChris Wilson
We give up on TearFree if we ever see an error whilst page flipping (in the hope that we can keep displaying via direct use of the scanout). With the advent of MST, this can happen simply by the user unplugging a dock causing connectors to disappear and if we flip before we see the uevent telling us which outputs are disabled, we get an error. So, lets try and re-enable TearFree on the next opportunity, when all the outputs are off and we can rebuild the shadow buffer. Reported-by: Martin Jørgensen <mkj@gotu.dk> References: https://bugs.freedesktop.org/show_bug.cgi?id=96180 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18sna: Use dirtyfb for fallback direct renderingChris Wilson
The preferred solution when direct rendering is too costly is to render into the backbuffer and flip. However, if the user insists, we need to tell the kernel when to flush the scanout due to direct rendering. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-22sna: Disable secondary planes on taking over VTChris Wilson
Sometimes the kernel may leave other planes enabled on our VT. So, just as we validate that the CRTC state is as we expect when we take over the VT, make sure all secondary planes on the CRTCs are also disabled. Note to self: Xv needs to restore its planes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-01sna: Indicate when we expect to call RRGetInfo during discoveryChris Wilson
Continuing the udevless saga where we query for topology changes on calls to RRGetInfo() and so where we cannot call RRGetInfo() ourselves on discovering the changes (to facilitate hotplug). The next step is explicitly prevent the recursive call. References: https://bugs.freedesktop.org/show_bug.cgi?id=91929#c10 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-22sna: Check for udev events before readingChris Wilson
When performing RRGetInfo() we drain any pending uevents before checking the CRTC/connector statuses. However, some versions of libudev do a blocking read and so when we call RRGetInfo() from a Timer callback (outside of the usual sigtimer interrupts) that blocking read lasts indefinitely. Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna: Release the mode before releasing the accel backend on LeaveVTChris Wilson
When we release the accel backend, we mark the interface as wedged. However, when we release the modesetting backend we flush the vblank queue which may want to do rendering. So if we do that first then disable the accel backend, things we go much smoother. References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c20 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-28sna: Batch process hotplug eventsChris Wilson
Read all available HOTPLUG uevents and batch them into a single topology probe. Like waiting for a bus, when one hotplug uevent arrives expect a few more. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26sna: Add a few more DBG and assertions around Present/TearFree interactionsChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=91467#c12 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01sna: Force Linear FB when swizzling is unknown and fencing disabledChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-28sna: sna_set_desired_mode() always returns true, make it voidChris Wilson
Since sna_set_desired_mode() always returns true, we can make it void and remove some unreachable code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-04Remove the driver option to delete connectors on unpluggingChris Wilson
With a MST topology change, we can find outputs may disappear. We offered a choice as to whether to simply disable them or completely remove them from the listing of available outputs. However, clients never expected that their operation on any output could trigger a BadID XError (or that there is anyway to prevent race conditions). As such an option was made to disable by default, but allow testing complete removal. Now the RandR protocol has been clarified such that XID assigned to outputs are now permanent, as such the option breaks the spec, so drop it. See randrproto commit 895ee5264524c7c239ee4ef5e39c4e295323fb51 Author: Dave Airlie <airlied@redhat.com> Date: Wed Apr 22 10:58:18 2015 +1000 randrproto: clarify output XID lifetimes. This just makes a note that randr won't make outputs disappear dynamically. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Dave Airlie <airlied@redhat.com>
2015-04-12sna: Mark the GPU as available before doing the mode restore on VT enterChris Wilson
Sometimes we want to render with the GPU when doing a mode switch, e.g. if we need to initialise an output surface. To do so, we need to prepare the acceleration layer first. Lots of thanks to Vasily for tracking this one down. Reported-by: Vasily Khoruzhick <anarsoul@gmail.com> Bugzilla: https://bugs.archlinux.org/task/43534 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-09sna: Fix RandR detection to work before dixPrivateKeyRegisteredChris Wilson
Since dixPrivateKeyRegistered was only introduced in 1.10, we need an alternative probe for older Xservers. Suggested-by: Olivier Fourdan <ofourdan@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-13sna: Remove redundant RRGetInfo on hotplug discoveryChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-05sna: Remove the flush after waking up between clientsChris Wilson
In the normal command processing stream, we will have lots of opportunity to ask whether we should be batching requests together. If we wakeup without doing any work, then we will check inside the block handler whether the GPU is idle and flush then. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24sna: udev integration depends on fstat and sys/stat.hChris Wilson
src/sna/sna_driver.c: In function 'sna_handle_uevents': src/sna/sna_driver.c:759:2: error: implicit declaration of function 'fstat' [-Werror=implicit-function-declaration] Also take the opportunity to include udev support in the configure summary. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04Allow runtime selection between DRI levelsChris Wilson
Rather than imposing a maximum DRI level at compile time by compiling out unwanted protocol handlers, default to limiting it at runtime so that we can switch between any level. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31Unify Option "DRI" parsingChris Wilson
Allow Option "DRI" "[23]" to also work with UXA. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26sna: Log maximum number of CPU threadsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26sna: Tweak treatment of DPMS mode to be consistent at all layersChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=88794 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-23sna: Add a fallback DBG for the git versionChris Wilson
In case the version numbering is disabled, like on Arch, include it anyway in the full debug log. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-22sna: Declare outputs as hidden at startChris Wilson
Required for our internal bookkeeping of DPMS events. Reported-by: Jiri Slaby <jirislaby:gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c79 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-21sna: Keep front_active consistent across DPMS eventsChris Wilson
When disabling outputs with DPMS, make sure we update front_active for consistency. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-20sna: Add missing include of DPMS constantsChris Wilson
Fixes build with slightly older X servers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-20sna: Finish e6227daff1e3eChris Wilson
Missed the git-add before pushing. :| Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-20sna: Add a loud DBG message when enabledChris Wilson
Having a reminder/alert when the debug tracing is enabled I find useful. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-13sna: Wrap direct access to ScrnInfoPtr->pScreenChris Wilson
Admittedly ScrnInfoPtr->pScreen has nearly always existed, but for completeness wrap it up in a compat macro. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-09sna: Capitlize log message "display hotplut detection"Chris Wilson
It looks out of place starting with a lower case letter when the surrounding messages are sentence captilized. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-08sna: Differentiate between disabling CRTC and turning off DPMSChris Wilson
xf86DisableUnusedFunctions() uses crtc->dpms(off) to disable unused pipes. In this case, we do want to explicitly disable the CRTC to release any shared state (e.g. PLLs and encoders). However, the user can also request for the DPMS to be disabled, either via the DPMS extension or the ScreenSaver. Here, we don't want to full disable the pipe as that incurs extra latency (and risk of failure) when switching the display back on. In order to distinguish the two cases, we can hook into the user paths and skip disabling the CRTCs. Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-11sna: Catch NULL RandR screen privateChris Wilson
If Xinerama is enabled, than RandR12 will be silently disabled. Be careful not to dereference the rrScrPiv when it doesn't exist. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87207 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-04sna: Clear the read flags for the shared drm fd after useChris Wilson
In ZaphodHeads, we may reuse the same select read flags and attempt to read from a blocking drm fd multiple times. However, if we clear the read flags after first exhausting the fd, we shouldn't then block on subsequent heads. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04sna: Correct units for videoRamChris Wilson
The mappable aperture size is stored as a page count, videoRam expects size in KiB. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04sna: Reuse the queried aperture size for videoRam determinationChris Wilson
Rather than repeat our derivation of how much RAM we can map, just reuse the already determined value. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-13sna: Drain all udev events before checking output statusChris Wilson
As libudev only pulls off events one by one and we may need to process several for a MST topology change, keep polling until complete. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-08intel: Store pointer to struct intel_deviceChris Wilson
Beware the barbarians at the gate, who invade and steal your ScrnInfoPtr and its Entity from underneath you. In some configurations, we lose access to the struct intel_device stored on the Entity after initialisation, causing havoc. Workaround this by storing the intel_device that we open in our driverPrivate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-07sna: Wrap rrGetInfo so that we can probe when udev is not activeChris Wilson
If the ddx is configured without udev support, we do not receive notifications when the MST topology is changed. This leads us to query the kernel for bad connectors, and so we end up reporting an unknown connection status for them, which the user and client often find confusing. However, we can not simply act upon the detection failure as we are too deep inside the callback chain and cannot change the arrays of known connectors whilst iterating over them. A neat compromise is to hook into the rrGetInfo call chain and poll for MST changes before we report back the current configuration. References: https://bugs.freedesktop.org/show_bug.cgi?id=84718 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-29sna; Markup that we are ignoring errors from early ScreenCreateResourcesChris Wilson
In the early move-to-gpu in ScreenCreateResources we purposefully ignore any errors from the move-to-gpu as they will be fixed up later when we try to bind to the CRTCs. Mark it as ignored for future readers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-26sna: Allow move-to-gpu to fail during ScreenCreateResourcesChris Wilson
Before we attach the Screen Pixmap to the scanout, we will have to create a GPU bo and apply any fixups as required. Therefore failing to pre-emptively move it during ScreenCreateResource is not fatal and the failure can be simply ignored. Suggested-by: Egbert Eich <eich@freedesktop.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10sna: Emit assertions with FatalErrorChris Wilson
The intention is to be able to capture the assertion in the Xorg.0.log (journald equivalent). At the moment, it is emitted to stderr which is difficult to capture and defeats the goal of only asking the reporter to upload one log file. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10sna: Relax early failure to set KMS modesChris Wilson
Under the new world order, we may not have KMS rights until we are given a VT. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-26sna: Fix attaching to a headless configurationChris Wilson
ADDFB fails with a headless config (as any fb size is invalid). Fortunately, with headless we can use any depth we like. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-18sna: Be defensive during FreeScreen()Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-18sna: Add some DBG warnings for early PreInit failuresChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-08sna: Update check for static driver data on loading errorChris Wilson
Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1354424 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-08Prepare for spurious Xv ABI changesChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-05sna: Set the RandR primary output from the optionChris Wilson
If the user specifies the Option "Primary" for a monitor, we need to set it as the RandR primary output. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82193
2014-07-23sna: Disable rendering with the DRM device whilst away from VTChris Wilson
As root, X gets away with many things, including submitting commands to the DRM device whilst it is no longer authorised (i.e. when it has relinquished master to another client across a VT switch). In the non-root future, if we attempt to use the device whilst unauthorized the rendering will be lost and we will mark the device as unusable. So flush our render queue to the device around a VT switch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>