summaryrefslogtreecommitdiff
path: root/src/sna/sna.h
AgeCommit message (Collapse)Author
2015-02-08sna: Avoid accessing past the end of the clip boxes for incremental clippingChris Wilson
During incremental clipping of the trapezoids, we can assign the end BoxPtr to begin, and so we should be careful not to dereference that pointer (as it points passed the end of the clip boxes). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08sna: Check against last clip box (not past the end of the boxes)Chris Wilson
The end BoxPtr actually points to one past the end of the clip boxes, so in order to inspect whether the line is after the clip region, we want to look at the last box, i.e. the box before. We also only want to ignore the clip if we do not intersect at all, otherwise we need to find the start of the clip row. Reported-by: Matti Hämäläinen <ccr@tnsp.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08sna/present: Fallback to first available CRTC if none overlap WindowChris Wilson
In order to handle PRIME offscreen Windows nicely, tie their presentation into the Primary CRTC (if available). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06sna/trapezoids: Use incremental region clipping for spansChris Wilson
Within a span, we have the advantage of knowing that we only need to intersect one box with the clip region, and that box has monotonically increasing y. This avoid having to compute RegionIntersect for every span element which was very slow (e.g. libreoffice). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05sna/present: Queue the unflip if we have flips outstandingChris Wilson
Rather than synchronously wait in the unflip for the pageflips to complete by forcing the modeset, try to queue the unflip to happen after the pending flip completes. 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-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-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-19sna/dri2: Preserve the shadow CRTCs when copying to other areasChris Wilson
In the Composite setup, if we are doing a DRI2 copy onto the front buffer, we are fully cognizant that the copy will not go onto the unredirected Windows of another Client. So we can preserve the shadow CRTC mapping for those Clients, and prevent ping-ponging between CRTC modes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-19sna/dri2: Decouple Window cache on Pixmap changesChris Wilson
If the Pixmap for a Window is changed (i.e. Composite redirection/unredirection), we also need to decouple any associated DRI2 front buffer for the Pixmap (e.g. used for single CRTC flipping). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-16sna: Make error debug tracing available at normal debug levelsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-08sna: Inline check for pending events before reading from drm fdChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-10sna: Only reshow unhidden cursors after modesettingChris Wilson
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-06sna: Experimental support for write-combining mmapsChris Wilson
If we have a linear buffer, we can request the kernel mmap it directly with write-combining without having to pin it into the GTT. This allows us to efficiently upload very large buffers, and can avoid the dreaded aperture thrashing. 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: Retrieve private pointer from vblank cookieChris Wilson
When using ZaphodHeads, we share the /dev/dri/card0 fd between both screens. So when we read an event back from the fd, it could be for either head and we cannot assume that our private pointer is valid for the data passed along with the event. Instead, we need to retreive that pointer from the event. Fixes regression from commit 8369166349c92a20d9a2e7d0256e63f66fe2682b [2.99.912] Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed Jun 4 08:29:51 2014 +0100 sna/dri2: Enable immediate buffer exchanges although the design bug is actually older. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84744#c15 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-10-06sna: Avoid the intermediate allocation for PRIME pixmapsChris Wilson
If we attempt to share an unused Pixmap, we first create an ordinary GPU bo when migrating onto the GPU. Add a flag here to cause the migration to create a Pixmap suitable for PRIME instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15sna: Last ditch attempt to make extra large batches fitChris Wilson
If we have unfortunate fragmentation, e.g. a cursor is pinned in the middle of an aperture, we can struggle to fit large objects, especially fenced objects on gen2/gen3. We do have one last trick up our sleeves that we can try: disable all of the outputs and cursors and try submitting the batch in as pristine an aperture as we can arrange. We can only hope that the subsequent restoration of the outputs is more conducive to future batches (and so not lead us into continual flicker). 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-02sna: Leave more Pixmap breadcrumbs in DBGChris Wilson
Add the Pixmap id to various DBG messages to make it easier to track rendering. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-14sna: Do not force creation of a linear GPU bo that we don't wantChris 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-08-03sna: Add some paranoid asserts around get_window_pixmap()Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>
2014-07-23sna: Disable all outputs when initializing as a slaved output providerChris Wilson
When we are constructed as a slaved device, we need to disable all outputs or else they are not correctly hooked into the master device upon startup. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11configure: Provide a poor man's replacement for getline()Chris Wilson
uClibc is one such library that doesn't implement getline() Reported-by: Ben Widawsky <benjamin.widawsky@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-02sna: Limit the size of the tiling object to be smaller than either the originalsChris Wilson
When we tile, we do so in order to fit an operation involving two objects larger than the aperture. If we then choose an intermediate tiling object that is larger than either of those two, the error will persist and we will be forced to recuse. In the worst case, this will provide an upper bound to the recursion. Reported-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01sna: Enforce LinearFramebuffer optionChris Wilson
This option should only be used for compatibility. Previously this was done at a high level, this changes it to enforce the tiling as we apply the CRTC. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-26sna/dri2: Hook into ClientGone callback to clear dangling referencesChris Wilson
As the Window may exist for multiple Clients, we cannot rely on the destruction of the Window decoupling all outstanding events and preventing chasing a stale Client pointer. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80157 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23sna: Rename IGNORE_CPU to IGNORE_DAMAGE to better reflect its purposeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19sna: Always readback shadow damage after replacing the bufferChris Wilson
Instead track what we explicitly want to discard for the next operation, so that we don't have to copy back the whole buffer if we have to replace the shadow and intend to overwrite it all. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-16sna: Clear our private hints about front rendering exported boChris Wilson
Unlike GLXWindows, GLXPixmaps are rendered directly into, without a staging copy. Therefore we must treat those carefully when exported and clear our hints everytime control passes back to the Client. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79999 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-14sna: Enable TearFree by default for systems with PSRChris Wilson
Panel Self-Refresh requires us to avoid frontbuffer rendering in order to be power efficient. This is a job for TearFree! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13sna: Reorder ignore_cpu_damage() to avoid assertsChris Wilson
Tricksy asserts making sure that the correct arguments are passed around! Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11sna: MST topologies may change on any hotplug eventChris Wilson
As the kernel does not send out an explicit DISCOVER event, we have to reinspect every connector after every hotplug event to detect topology changes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11sna: Discard TearFree damage before checking for an overwriting uploadChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11sna: Silence compiler warnings for discarding const Region pointsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09sna/dri2: Allow TearFree flipping to individual CRTCChris Wilson
Baby step. We first take advantage of TearFree to allow us to redirect a single CRTC to the DRI2 frontbuffer and so allow a fullscreen game covering a single monitor to avoid expensive blits when running in a multi-monitor setup. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07sna: Fix TearFree for non-compositorsChris Wilson
The tearfree code forgot to update the shadow bo, so after the first flip it would be rendering to the scanout anyway and flip to itself periodically. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06sna: Hook up a backlight udev monitor for external changesChris Wilson
Changes to the backlights are notified through uevents. Hooking up a udev monitor to listen out for external changes to the backlight (e.g. through ACPI function keys, or by the user writing to /sys/class/backlight directly) is easier than enabling polling on the backlight sysfs file using X's select() mechanism. Since we listen to backlight changes, we have to be careful not to confuse the side-effects of disabling connectors (which may cause either ourselves or the kernel to turn off the backlight) with the user value. Many thanks to Alexander Mezin for the suggestion to use udev for tracking the notifications for external changes to the backlight. Reported-by: Alexander Mezin <mezin.alexander@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79699 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05sna/dri2: Enable immediate buffer exchangesChris Wilson
The primary benefit of this is avoid the extra blit when using a compositor and instead propagate the compositor flip on the frontbuffer to the scanout, or equivalently allows a fullscreen game to flip onto the scanout without intervention by TearFree. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02sna: Add support for PresentChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02sna: Add support for DRI3Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02sna: Enable kernel support for asynchronous flipsChris Wilson
If a flip fails, attempt to restore the previous working configuration (using a modeset) then disable further flipping. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26sna/dri2: Move scanout processing from frame event to globalChris Wilson
The scanout is a global property, track it as so. The primary benefit to this is it strengthens our assertions that we never hand out an active scanout for use as a back buffer. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22sna/dri2: Move fixed array allocations to per-crtcChris Wilson
Replace the fixed size MAX_PIPES array by moving the vblank handling to per-crtc. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21sna/dri2: Apply a margin of error to the sequence wrap detectionChris Wilson
If we have a queue of events, we may set the msc from a recent vblank query only to then process an older vblank event and declare the counter wrapped. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21sna/dri2: Tidy recording of the last swap sequence number and timeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21sna/dri2: Tidy computation of 64bit ustChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>