summaryrefslogtreecommitdiff
path: root/src/i830_dri.c
AgeCommit message (Collapse)Author
2010-06-25Rename common infrastructure to the intel namespace.Chris Wilson
After splitting out the i810 driver into its own legacy directory, we can identify the common routines not as i830 but as intel. This clarifies the code which *is* i830 specific. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-25i810: Move into a legacy directory.Chris Wilson
The driver is still built but is no longer under active development so move it and supporting files to a new directory. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-21Emit the flush after a potential draw from the BlockHandler.Chris Wilson
As the batch submit may not trigger further drawing through flushing the vertices, pass the requirement to emit the flush down to the submission routine so that the flush can be appended after the final commands. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-06Use libc instead of deprecated libc wrappers for malloc/calloc/free.Eric Anholt
2010-06-02dri: Protect against NULL dereference following GPU hang.Chris Wilson
References: Bug 28361 - "glresize" causes server segfault with single buffering. https://bugs.freedesktop.org/show_bug.cgi?id=28361 [ 14528.767] (EE) intel(0): Failed to submit batch buffer, expect rendering corruption or even a frozen display: Input/output error. [ 14528.767] (EE) intel(0): Disabling acceleration. [ 14528.788] Backtrace: [ 14528.858] 0: /usr/bin/X (xorg_backtrace+0x28) [0x491818] [ 14528.858] 1: /usr/bin/X (0x400000+0x65ca9) [0x465ca9] [ 14528.858] 2: /lib/libpthread.so.0 (0x7f9df2dc9000+0xedf0) [0x7f9df2dd7df0] [ 14528.858] 3: /usr/local/lib/libdrm_intel.so.1 (drm_intel_bo_flink+0x0) [0x7f9defd60c60] [ 14528.858] 4: /usr/local/lib/xorg/modules/drivers/intel_drv.so (0x7f9deff6a000+0x2fdfd) [0x7f9deff99dfd] [ 14528.858] 5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x19e7) [0x7f9df01b99e7] [ 14528.858] 6: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x1fdb) [0x7f9df01b9fdb] [ 14528.858] 7: /usr/lib/xorg/modules/extensions/libdri2.so (DRI2GetBuffersWithFormat+0x10) [0x7f9df01ba250] [ 14528.858] 8: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x3834) [0x7f9df01bb834] [ 14528.858] 9: /usr/bin/X (0x400000+0x2fc2c) [0x42fc2c] [ 14528.858] 10: /usr/bin/X (0x400000+0x24da5) [0x424da5] [ 14528.858] 11: /lib/libc.so.6 (__libc_start_main+0xe6) [0x7f9df1d60a26] [ 14528.858] 12: /usr/bin/X (0x400000+0x24959) [0x424959] [ 14528.858] Segmentation fault at address 0x20 [ 14528.858] Fatal server error: [ 14528.858] Caught signal 11 (Segmentation fault). Server aborting Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-01DRI2: fix new buffer exchange checkJesse Barnes
Chris's new buffer exchange check is a good one, but we don't want to hit the immediate blit fallback path if it fails. We still want to schedule a blit for sometime in the future, and we need to use it wherever an exchange might occur (like the secondary flip check or the currently disabled CanExchange check). Fixes https://bugs.freedesktop.org/show_bug.cgi?id=28252. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-05-29dri: Compilation fix.Chris Wilson
17:53 < arekm> ickle: i830_dri.c:630:28: error: ‘DrawableRec’ has no member named ‘bpp’ 17:53 < arekm> ickle: i830_dri.c:630:57: error: ‘DrawableRec’ has no member named ‘bpp’ * sigh. I need to fix this machine to have the right version of the * headers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-29dri: Only flip if the front and back pixmaps match.Chris Wilson
An unredirected window (thanks Michel for the reminder) is backed by the Screen pixmap, and so uses a reference of that as its front buffer. The back buffer is a pixmap appropriately sized for the drawable. When the application requests to swap its buffers, obviously we cannot simply exchange the front and back buffer as they do not match, but need to copy the appropriate region from the back to the front. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-29Revert "dri: Use size from backing pixmap when creating buffers."Chris Wilson
This reverts commit 44d45d3fa56f121ce89ffe5b28beb48be01a95df. Michel Dänzer pointed out the flaw in using the pixmap size instead of the drawable size: Using the backing pixmap dimensions for this is not desirable. In particular, it means that the DRI2 buffers of non-redirected windows always have the same size as the screen. But even for redirected windows it wastes some graphics memory with a re-parenting window manager, that is if it doesn't break in various ways due to the top left corner of the DRI2 buffers no longer corresponding to the top left corner of the window.
2010-05-29dri: Use size from backing pixmap when creating buffers.Chris Wilson
This avoid using the garbage values stored in the Screen drawable, instead of the true values which are only maintained in its backing pixmap. The consequence of using the wrong size was to hand a 1x1 pixmap to metacity/mutter and have it believe it was a full screen drawable; GPU hangs ensued if using page flipping. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-18dri: Clean up DRI2 API #ifdefs a bitKristian Høgsberg
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-05-17i830: Remove vestigal debugging ALWAYS_FLUSH and ALWAYS_SYNCChris Wilson
These are now debugging options exposed in Xorg.conf, and now unused int the source code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-17dri: Check error code from GetScratchGC()Chris Wilson
It may fail so be prepared, and do use the right drawable! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-14drm: Remove unused old_front parameter from drmmode_do_pageflip.Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-14dri: Hold reference to buffers across swapChris Wilson
As we schedule swaps for some time in the future and may process a detachment prior to receiving the vblank notification from the kernel, we need to hold a reference to the buffers for our swap event handler. Fixes: Bug 28080 - "glresize" causes X server segfault with indirect rendering. https://bugs.freedesktop.org/show_bug.cgi?id=28080 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-12dri2: Handle reference counting across page flippingChris Wilson
1. Instead of swapping bos, swap the entire private structure. 2. If we update the pixmap bo for the Screen, make sure we update the reference inside intel->front_buffer so that xrandr still functions. Fixes: Bug 27922 - i965: Rapidly resizing OpenGL window causes GPU to hang. https://bugs.freedesktop.org/show_bug.cgi?id=27922 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-03-26DRI2: release our private front buffer ref when buffer swappingJesse Barnes
Pauli pointed out that we take a ref on the front buffer when exchanging but forget to release it. The ref is necessary since the set functions will drop refs as necessary, but once we set the front buffer to point at the back pixmap, we ned to release our private ref again, or we'll leak buffers. Reported-by: Pauli Nieminen <suokkos@gmail.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-08DRI2: make WaitMSC error handling more consistent with ScheduleSwapJesse Barnes
Just make it mirror ScheduleSwap: complete the wait on any error condition so as not to crash the client if the kernel is misbehaving. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-08DRI2: truncate OML values to 32 bitsJesse Barnes
We can only handle 32 bit values unless we totally virtualize the count, since the kernel only handles 32 bits itself. Rather than adding all that overhead, just tolerate the occasional missed event everytime the counter runs over. Reported-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-08DRI2: more WaitMSC fixesJesse Barnes
A couple more niggles: make sure we return a target_msc that at least matches the current count; this is a little more friendly to clients that missed an event. Also check for >= when calculating the remainder so we'll catch the *next* vblank event when the calculation is satisfied, rather than the current one as might happen at times. Reported-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-08DRI2: fixup stray curly braceJesse Barnes
Got left in the wrong column after the last cleanup. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-08DRI2: fixup ScheduleWaitMSC similarly to ScheduleSwapJesse Barnes
My merge of Mario's patch for this was botched. Fix it up so that OML waits work correctly, and remove a bogus warning from ScheduleSwap. Reported-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-05DRI2: handle target_msc, divisor and remainder properly in DRI2ScheduleSwapMario Kleiner
The current code in I830DRI2ScheduleSwap() only schedules the correct vblank events for the case divisor == 0, i.e., the simple glXSwapBuffers() case. In a glXSwapBuffersMscOML() request, divisor can be > 0, which would go wrong. This modified code should handle target_msc, divisor, remainder and the different cases defined in the OML_sync_control extension correctly for the divisor > 0 case. It also tries to make sure that the effective framecount of swap satisfies all constraints, taking the 1 frame delay in pageflipping mode and possible delays in blitting/exchange mode due to DRM_VBLANK_NEXTONMISS into account. The swap_interval logic in the X-Servers DRI2SwapBuffers() call expects the returned swap_target from the DDX to be reasonably accurate, otherwise implementation of swap_interval for the glXSwapBuffers() as defined in the SGI_swap_interval extension may become unreliable. For non-pageflipped mode, the returned swap_target is always correct due to the adjustments done by drmWaitVBlank(), as DRM_VBLANK_NEXTONMISS is set. In pageflipped mode, DRM_VBLANK_NEXTONMISS can't be used without severe impact on performance, so the code in I830DRI2ScheduleSwap() must make manual adjustments to the returned vbl.reply.sequence number. This patch adds the needed adjustments. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
2010-03-05DRI2: make MSC waits handle specific target_mscs and divisor/remaindersMario Kleiner
Previous code only handled divisor == 0 case correctly. This should honor a given target_msc for the divisor > 0 case and handle the (msc % divisor) == remainder constraint correctly. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
2010-03-05DRI2: handle offscreen drawables better at swap timeJesse Barnes
If a drawable isn't visible due to DPMS or redirection, we'll just blit it rather than schedule a swap event. However, we didn't reset the target_msc, so the swap target we receive from the server could get out of sync with the vblank count of the drawable's display. So at DPMS on time, the swap target would be the last good vblank count plus some large number (since the swaps won't have been throttled). Solve this by zeroing out the swap target like we should when we fall back to a blit. Also make the kernel error cases more friendly by making them fall back to blits too. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-02-24In frame event handling, track drawable id instead of drawable pointer.Eric Anholt
Windows aren't refcounted, so if the event came in after the window was destroyed, we'd dereference garbage and segfault.
2010-02-24Fix up a bunch of inconsistent 4-space indentation in i830_dri.cEric Anholt
2010-02-20Remove more DRI1 dead code.Eric Anholt
2010-02-17dri2: Silence the compiler for an unused function with proto < 4Chris Wilson
Move the unused function into the #if DRI2INFOREC_VERSION >= 4 block. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-02-11DRI2: handle full height blits without tearing in CopyRegionJesse Barnes
On 965 and up, if we detect a full height blit, we should just wait for vblank, rather than try to do a scanline wait for the whole display. On pre-965, doing a scanline wait followed by a blit works, but in the full height case we need to give the blitter time to start up, so we wait until the bottom line of the blit minus 2 padding scanlines to accommodate. Fixes FDO bug #22475. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-02-05DRI2: only use version 4 APIs if kernel support existsJesse Barnes
Check for page flipping support before enabling flip and vblank event support needed for the new DRI2 APIs. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-31Initialize DRI2 info rec version 4 list of driver namesKeith Packard
With DRI2 supporting multiple subsystems, the video driver must initialize the list of driver names instead of just passing the single driver name used by Mesa. Without this, the X server will fail to initialize DRI2 as the numDrivers field in this structure will be uninitialized. Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-13DRI2: if the swap condition is satisfied, complete it immediatelyJesse Barnes
If we get to the point where we check the divisor/remainder equation and it's satisfied, we should complete the swap immediately. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-13DRI2: support new DRI2 APIsJesse Barnes
The new interfaces allow for improved buffer swap, and support for the SGI_swap_control, SGI_video_sync and OML_sync_control GLX extensions. The Intel implementation allows page flipping to occur for swaps that are full screen and not rotated. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-12-07batch: Ensure we send a MI_FLUSH in the block handler for TFPChris Wilson
This should restore the previous level of synchronisation between textures and pixmaps, but *does not* guarantee that a texture will be flushed before use. tfp should be fixed so that the ddx can submit the batch if required to flush the pixmap. A side-effect of this patch is to rename intel_batch_flush() to intel_batch_submit() to reduce the confusion of executing a batch buffer with that of emitting a MI_FLUSH. Should fix the remaining rendering corruption involving tfp [inc compiz]: Bug 25431 [i915 bisected] piglit/texturing_tfp regressed http://bugs.freedesktop.org/show_bug.cgi?id=25431 Bug 25481 Wrong cursor format and cursor blink rate with compiz enabled http://bugs.freedesktop.org/show_bug.cgi?id=25481 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-12-02Remove flush parameter from intel_batch_flush()Chris Wilson
There is only a single caller that wishes to forcibly append a flush into the batch: intel_sync(). So move the logic there. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-12-02Rename I830Sync() to intel_sync()Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-12-02Review use of errno after libdrm callChris Wilson
Since drm may not actually set the appropriate errno after a failure, we must use the return code instead when determining the cause of failure. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-11-30Use new drmGetDeviceNameFromFd() for mapping to drm device nameKristian Høgsberg
Should have been in libdrm to begin with.
2009-11-29batch: Track pixmap domains.Chris Wilson
In order to detect when we require cache flushes we need to track which domains the pixmap currently belongs to. So to do so we create a device private structure to hold the extra information and hook it up. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-10-12DRI2 compat build fix: it's drawable->pScreen not drawable->screenJesse Barnes
Fallout from the conversion; DRI2 compat path was broken. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-10-08Rename pScreen to screen.Eric Anholt
2009-10-08Rename pGC to gc.Eric Anholt
2009-10-08Rename pDraw to plain old drawable.Eric Anholt
2009-10-08Call pPixmaps plain old pixmaps.Eric Anholt
2009-10-08de-pCamelHungarian the Render pictures and pixmaps.Eric Anholt
2009-10-08Rename the xf86 screen private from pScrn to scrn.Eric Anholt
2009-10-08Rename the screen private from I830Ptr pI830 to intel_screen_private *intel.Eric Anholt
This is the beginning of the campaign to remove some of the absurd use of Hungarian in the driver. Not that I don't like Hungarian, but I don't need to know that pI830 is a pPointer.
2009-10-06Move to kernel coding style.Eric Anholt
We've talked about doing this since the start of the project, putting it off until "some convenient time". Just after removing a third of the driver seems like a convenient time, when backporting's probably not happening much anyway.
2009-10-06Remove UMS support.Eric Anholt
At this point, the only remaining feature regressions should be the lack of overlay support (about to land), and the need to update the XVMC code to work in the presence of KMS. Acked-by: Keith Packard <keithp@keithp.com> (in principle) Acked-by: Carl Worth <cworth@cworth.org> (in principle)