Commit Graph

8052 Commits

Author SHA1 Message Date
Chris Wilson 487df2e7b1 sna: Silence a DBG compiler warning
kgem.c: In function '_kgem_submit':
kgem.c:3243:12: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
       write(fd, kgem->batch, batch_end*sizeof(uint32_t));

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson ffbe0aa185 sna: Reuse the first scanout bo
The path of last resort is meant to reuse the first scanout bo if they
all busy (since it will be the oldest). It chased a dangling pointer
instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:49:27 +01:00
Chris Wilson 40fe1f2c09 sna: Do not allow imported buffers to be cached
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:49:27 +01:00
Chris Wilson fc1f9b91ae sna: Mark all caches for expiration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 3dac734bb0 test: Only compute the masked pixel value if depth!=32
Minor saving for when we use a8r8g8b8.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 961139f587 sna: Use manual detiling for downloads
If we can CPU mmap the GPU bo, prefer to do so for migration to the CPU
as this saves an extra serialisation step.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 93d3df493d sna: Unexport kgem_get_unique_id()
This should always be set during bo creation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 792584fa74 sna/dri2: Reorder declarations to compile on old Xorg
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 19:43:47 +01:00
Chris Wilson 562c47fc21 Silence CLang (almost)
Fix up all the warnings about implicit enum conversions. The
container_of() macro remains defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 13:34:53 +01:00
Chris Wilson 6282fc9d0d sna/dri2: Fix the continuation mode for old style triple buffering
Otherwise we end up sending too many SwapCompletes back to the client
and confusing ourselves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 11:05:49 +01:00
Chris Wilson 916354164b sna: Fix the depth/format on the temporary shadow Pictures
When scaling the output, we re-render onto the scanout using a call to
Composite, for which we create temporary Pictures. In most cases, the
mismatching depth/format goes unnoticed, but along one particular
fallback path, we use those to create a new Picture but the mismatching
format results in a segfault.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-27 20:19:55 +01:00
Chris Wilson d8360bd74f sna: Handle bad picture format/depth mismatches
Scaling the output feed in an invalid picture->format/depth combination
which causes the fallback downsampling function to explode. Whilst this
is a bug in the higher layer, we can handle the error anyway.

References: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-27 20:19:49 +01:00
Chris Wilson 93b319cf9a uxa: Silence the compiler over a couple of unused variables
intel_driver.c: In function 'I830LeaveVT':
intel_driver.c:1085:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);
                        ^
intel_driver.c: In function 'I830EnterVT':
intel_driver.c:1102:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson e6ee067937 uxa: Silence compiler for warnings in Cursor API changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson 4321e8decd sna: Silence compiler for warnings in Cursor API changes
The API changed again in the RC, so update to keep the compiler quiet.
At the same time, protect against the ARGB_CURSOR struct changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson 2a0dc7ed49 sna/dri2: Move scanout processing from frame event to global
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-26 20:44:59 +01:00
Chris Wilson 05f149285b sna/dri2: Defer reallocation of backbuffer until request
If we defer the reallocation of the backbuffer until the client requests
the set of current buffers (with GetBuffers), then we can often avoid
allocating the fresh backbuffer as the flip often retires before the
client is ready.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 07:56:55 +01:00
Chris Wilson e8d8f754eb sna/dri2: Make the swap-limit transitions more obvious
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 07:56:55 +01:00
Chris Wilson 9f4f855ba3 sna: Implicit release of upload buffers considered bad
Currently upload buffers are automatically decoupled when the buffer is
retired. As retiring can happen during command setup after we have
selected which bo to render with, this can free the bo we plan to use.
Which is bad.

Instead of making the release of upload buffers automatic, we manually
check whether the buffer is idle before use as a source to consider
scrapping it and replacing it with a real GPU bo. This is likely to keep
upload buffers alive for longer (limiting reuse between Pixmaps but
making reuse of the buffer within a Pixmap more likely) which is both
good and bad. (Good - may improve the content cache, bad - may increase
the amount of memory used by upload buffers for arbitrary long periods.)

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79238
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 07:56:55 +01:00
Chris Wilson b508d8f331 sna: Assert that we do not replace active IO buffers
References: https://bugs.freedesktop.org/show_bug.cgi?id=79238
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 07:46:51 +01:00
Chris Wilson 605fcd9050 sna/dri2: Handle allocation failure adding frame events gracefully
Now that we do not preallocate the storage for the chain in the Window
devPrivates, we need to check for an allocation failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 13:57:16 +01:00
Chris Wilson 36a4a654da sna/dri2: Tidy add/remove chain to use the common DRI2 private
The code is more readable directly updating the private rather than
hiding the pointer chasing through the opaque lookups.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 12:59:46 +01:00
Chris Wilson 417997f389 sna/dri2: Handle offscreen Window and Pixmap with CRTC tracking
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 12:41:24 +01:00
Chris Wilson d3781e19cf test/dri2: Restore original configuration after testing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 11:21:47 +01:00
Chris Wilson 1d6106c289 sna/dri2: Combine the DRI2 Window privates together into a single struct
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 11:20:29 +01:00
Chris Wilson d6c4e72f1a sna/dri2: Free the private CRTC tracker on each window
Remember to clean up our privates when the window is destroyed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 10:17:45 +01:00
Chris Wilson 43fd06ee7d sna/dri2: Adjust current msc / target seq between CRTCs
The target_msc supplied by the client is required to be monotonic. Since
the client does not know which CRTC the window is on, they do not
control from which pipe we derive the MSC, and so we need to adjust the
hardware values such that the client only ever sees a monotonic value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 09:49:05 +01:00
Chris Wilson c8decdbccd test/dri2: Check validity of MSC across CRTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 09:49:05 +01:00
Chris Wilson a6613a8fe3 sna/dri2: Queue the flip immediately for the next frame
If we compute that we want to flip on the next frame, queue it
immediately rather than take a round trip through the kernel and risk
missing the vblank.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 07:32:22 +01:00
Chris Wilson 24443c6c89 sna/dri2: Tidy computation of target sequence
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 07:32:22 +01:00
Chris Wilson a767ad2e50 sna/dri2: Use the timestamps stored on the CRTC
Now that we store the information for the swap completion on the CRTC,
we don't need to pass it around inside the frame event.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 22:00:28 +01:00
Chris Wilson 5d80af3066 sna/dri2: Tweak flip continuation
Minor tidying to the returned target_msc and a useful assertion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 22:00:28 +01:00
Chris Wilson 8d1e9afb60 intel-virtual-output: Probe after claiming virtual output
Rerun a detection cycle after claiming the virtual output so that it is
hidden again.

References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 20:55:55 +01:00
Chris Wilson 0f0cd87c66 sna/dri2: DBG fixes
Update the DBG statements to match current code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 10:05:20 +01:00
Chris Wilson 80dfbaa3c3 sna/dri2: Move fixed array allocations to per-crtc
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-22 08:27:54 +01:00
Chris Wilson 9b21237a1c sna/dri2: Maintain sequence calculation in 64bits
Avoid casting down to 32bits at the begining of the calculation to only
then compare against the full 64bit values later.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 00:44:08 +01:00
Chris Wilson c548f231c1 sna/dri2: Fix WaitMSC to maintain the vblank counters
Fix WaitMSC to also use 64 bit counters and maintain the last vblank
notifications.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 00:44:08 +01:00
Chris Wilson 1f237bb6db sna/dri2: Apply a margin of error to the sequence wrap detection
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-21 23:07:36 +01:00
Chris Wilson 00d9396f6b sna: Fix attachment of the default monitor to the first output
Broke during code motion in

commit add84cd8a8
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 2 13:21:02 2014 +0100

    sna: Perform dynamic connector discovery

Reported-and-tested-by: Jay Little <jaylittle@jaylittle.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79015
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 21:07:46 +01:00
Chris Wilson 5168a160a1 sna/dri2: Decouple queued events
Becareful when reaping a chain on a destroyed window as some events may
be queued ahead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 20:12:24 +01:00
Chris Wilson 66e14c96d0 sna/dri2: Limit pending swaps to 1 when queueing a future blit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 18:56:13 +01:00
Chris Wilson bf4475d29d sna/dri2: Tidy conditional use of XORG_CAN_TRIPLE_BUFFER
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 11:52:33 +01:00
Chris Wilson 0b3ea29727 sna/dri2: Tidy recording of the last swap sequence number and time
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 09:15:48 +01:00
Dave Airlie 183a0728ba uxa: fix getmsc to not fail hard
If some outputs go away we race with this call and apps
get X errors and fall over. Do what SNA does and don't
bother trying.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-05-21 07:47:57 +01:00
Chris Wilson 2dbe76c492 sna/dri2: Tidy computation of 64bit ust
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 07:40:02 +01:00
Chris Wilson a82f6a7594 sna/dri2: Client cannot be NULL, so drop the checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-20 22:19:35 +01:00
Chris Wilson c548427e6d sna: Only mark the scanout as being busy for writes (not solitary reads)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-20 22:19:35 +01:00
Chris Wilson 61df0ffc0b sna/dri2: Verify that the reference pipe is still active for flipping
We rely on the reference pipe to drive the event wake up. If we issue a
deferred flip, there is a chance that the user could rearrange the
screen on another crtc whilst otherwise preserving the screen geometry.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-20 22:19:35 +01:00
Dave Airlie 197ab0cda0 uxa: fix pageflips on 3 head scenarios
While fixing up UXA for MST I eventually fell over this bug.

Signed-off-by: Dave Airlie <airlied@redhat.com>
[ickle: replace constant with macro to track pipe-dependent code]
2014-05-20 07:46:48 +01:00
Chris Wilson bfd0e41d5c sna: Fix assertions for combining shadow transforms and TearFree
When the RandR shadow buffer is enabled we set the sna_crtc->transform
flag. We set the crtc->transform_in_use only when coordinate transforms
are required - i.e. we may enable the shadow buffer if a CRTC is out of
bounds, but otherwise has no transformation. That confused the asserts.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-19 12:34:49 +01:00