summaryrefslogtreecommitdiff
path: root/src/sna/sna.h
AgeCommit message (Collapse)Author
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-06-20sna/video: Create one XvAdapter for each sprite planeChris Wilson
The caveat here is that the sprite plane must be available on all CRTCs so that the availability of the XvAdapter is not dependent upon output configuration or Window placement. Based on a patch by Michael Hadley <michaelx.hadley@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-20sna: Record all sprite planes reported by the kernelChris Wilson
In the following patches, we wish to expose them all to userspace. First we have to enumerate them, and make sure they all behave as expected. Based on a patch by Michael Hadley <michaelx.hadley@intel.com> 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-04-07sna: Don't limit CRTC idChris Wilson
Don't bake in the assumption that the CRTCs will always be allocated in the low byte of the identifiers range. It is only used in a pair of other functions (Xv plane updates), so not a big deal. Reported-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-06sna/gen9: Quick and dirty implementationChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-06sna/present: Skip the unflip if a no-opChris Wilson
If the screen is already scanning out from the desired framebuffer (because we failed when flipping and already restored the mode), skip the unflip. References: https://bugs.freedesktop.org/show_bug.cgi?id=94829 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-24sna/present: Add missing "static inline" for disabled present stubsChris Wilson
Oops, copy'n'paste broke the non-Present build: sna_trapezoids_boxes.c:(.text+0x0): multiple definition of `sna_present_cancel_flip' Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-24sna/present: Cancel pending unflips when resizing the screenChris Wilson
Otherwise we try to flip back before we complete the mode change. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-10sna/dri2: Add a specific recursion indicator for TearFree/DRI2Chris Wilson
Avoid conflating the DRI3/Present flag for controlling TearFree by adding a separate flag to indicate when we are waiting inside the TearFree shadow handler to avoid recursion in DRI2. Reported-by: Andreas Reis <andreas.reis@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92873 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-07-26sna: Only check non-NULL PixmapsChris Wilson
check_pixmap() can be called very early in the Window setup proceeding, before a pixmap is even assigned to a Window. There we expect the Window to be NULL, so be more careful in our check_pixmap. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91467#c16 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26sna: Add a small pixmap sanity checkChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-10sna: Increase assertion to cater for concurrent & recursion vblank/flip handlersChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-05sna: Only add the COW to the flush write if exported for writingChris Wilson
If the source is only being exported for reading, we can skip adding it to the flush list only to perform a no-op. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-19sna: Force restoration of SW cursor after HW cursor failsChris Wilson
In order to reset the SW cursor, we need to call xf86CursorSetCursor. However, the parameters we need to call SetCursor with are not exposed we need to be a little tricky and call a pair of functions that will save and then restore the cursor. 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-18sna/present: Reuse last cached swap msc/ust during a flip chainChris Wilson
Querying the known swap values is much slower than not! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-05sna/dri2: Prevent the sw cursor from copyig to a buffer as we discard itChris Wilson
During swapbuffers, the sw cursor tries to write to the old buffer. Ordinary this is not an issue as we are discarding it, but under TearFree that write causes us to instantiate the shadow buffer with a possible recursion into set_bo and mayhem. v2: commit 226a58bc592d4ed305b7ad0e460f1ee2548e0ddf Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Sat Apr 4 20:58:24 2015 +0100 sna/dri2: Prevent the sw cursor from copyig to a buffer as we discard it Tried to fix it by disabling SourceValidate. However, it a direct hook into the Damage code by miSprite that triggers the copy. Since there appears to be no way to intervene, we just mark that copy as internal and ignore it. Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=89903 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-13sna: Apply affine transformations to HW cursorsChris Wilson
Until now we only applied pixel-exact rotations to the cursors. However, this left the cursors ignoring scaling and so appearing incorrect on outputs with transformations applied. An extra complications comes from making sure that the scaling routine is signal safe. 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-03-02sna: Tweak find clip box assertsChris Wilson
Reordering the asserts to save one predicate! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-01sna: Unrecurse clip box searchChris Wilson
Unwind the trivial tail recursion from the clip box bisection and add a couple of assertions on the inlined fast-paths. References: https://bugs.freedesktop.org/show_bug.cgi?id=89295 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16sna/present: Append duplicates onto queued vblanksChris Wilson
If we have multiple events for the same vblank, append the notification to an existing vblank. This is particularly useful as we it ensures that we then report notifications in the same order as queued. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-15sna/present: Avoid tricks with the TearFree flagChris Wilson
Modifying the flag may cause havoc if we need to modeset whilst Present is in control as the CRTC will be setup without reference to TearFree, but then when Present unflips, we restore the stale configuration. So let's have a separate flag just to disable TearFree flips when a Present flip chain is active. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-14sna/present: Integrate into TearFree, take 2Chris Wilson
Following on from the previous attempt is the realisation that we can simply disable TearFree during a Present flip queue, and re-enable TearFree upon unflip. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-13sna/present: Hook into TearFreeChris Wilson
For the duration of the Present flip chain, replace our frontbuffer with the Client's Pixmap. Before any attempt to draw into the real frontbuffer, Present will unflip back to the TearFree front+shadow. However, it does give the Client direct access to the scanout through their Pixmap (effectively disabling TearFree on behalf of the Client). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11sna/present: Handle fake RRCrtcChris Wilson
Be sure we don't crash if the user requests presenting on one of our fake RRCrtcs. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11sna/present: Compensate for time elapsed since last swapChris Wilson
When computing the delay for the fake flip, compensate for any time elapsed since the last frame in order to hit the desired vblank more accurately. A side-effect of this is that we may now compute 0 delay timers which require special handling. Testcase: present-test/accuracy Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10sna: Prefer first active CRTC for offscreen drawablesChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>