summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
AgeCommit message (Collapse)Author
2013-10-31radeon/glamor: with new pixmap for dri2 drawable no need to create new textureJerome Glisse
When creating a new pixmap/bo for dri2 drawable there is no need to create a new texture, instead the texture associated with the new pixmap should be use otherwise there is a missmatch between the bo backing the texture for the drawable and the bo used by dri2 client. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-09-18DRI2: Install client callback only onceMichel Dänzer
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60182 Acked-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: add interpolated blanks to frame number in event handlersIlija Hadzic
The 'frame' argument passed to event handlers is the plain CRTC vblank counter that stops progressing when the associated display is in DPMS-off mode. If we have a DPMS-off period the frame counter and MSC will diverge, which can cause some higher-level functions to return incorrect values. This patch fixes the problem by adding interpolated vblanks to the frame counter before using it in handler functions. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: support scheduling emulated events with zero delayIlija Hadzic
Now that we fully emulating a running CRTC through DPMS-off state it is possible to come up with a zero delay when scheduling a swap or MSC-wait (e.g., if a call into respective wait function was entered very late). This patch wraps the TimerSet function into our own radeon_dri2_schedule_event such that the latter calls the event right away if zero delay is specified. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: make wait_msc and get_msc work on disabled CRTCsIlija Hadzic
Now that the running CRTC is emulated through DPMS-off states, wait_msc and get_msc must also work on disabled CRTCs. When CRTC is disabled, we must extrapolate the MSC count from present time and last MSC when CRTC was running and also use timers facility in wait_msc. v2: CRTC-private now stores frame rate instead of nominal vblank period. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: move rename and rework radeon_dri2_deferred_swapIlija Hadzic
radeon_dri2_deferred_swap will be used to generate real events (not just fallbacks) so now it needs to generate real timestamp and frame counter. Also this function will be used both by schedule_swap and wait_msc, so give it a more generic name: radeon_dri2_deferred_event v2: - Extrapolate the frame number from the time of actual execution of the function instead of using the MSC calculated (extrapolated) at event scheduling time. - CRTC-private now stores frame rate instead of nominal vblank period. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: track CRTC in event recordIlija Hadzic
Tracking the CRTC associated with an event will save us some lookups later in event handlers. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: hook up vblank extrapolation to schedule_swapIlija Hadzic
This patch hooks up swap-scheduling function with vblank-extrapolation function. Rather than waiting for fixed time, we calculate exactly how much we should wait and what we should update target_msc to using radeon_dri2_extrapolate_msc_delay helper function and schedule the swap completion using DIX's timer facility. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: add vblank extrapolation functionIlija Hadzic
Implement a helper function that will be called when emulating the running CRTC. The function should be called only when CRTC is in DPMS-off state. It will look at the vblank count and the time that was recorded last time the CRTC was running and calculate how long one must wait (from present time) until the target_msc is reached if the CRTC were running. v2: - CRTC-private now stores frame rate instead of nominal vblank period. - DIX's timer facility can sometimes wake up the scheduled functions more than a millisecond earlier. To avoid generating an old MSC, we have to add more margin when converting the delay in microseconds to milliseconds. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: adjust MSC by the number of interpolated vblanksIlija Hadzic
Normally, MSC value equals the vblank count of the CRTC on which the drawable resides. However, we are now interpolating vblanks through DPMS-off state, so if the CRTC is turned off at some point, the vlbank count does not change, but MSC does change by the amount that equals the cumulative number of interpolated vblanks. So each time we interact with the CRTC's vblank facility, we have to adjust the vblank counter: in the request, we have to subtract the number of interpolated vblanks from MSC and in the reply we have to add the number of interpolated vblanks to the MSC. This patch only makes the MSC correct when CRTC is on. The subsequent patch will construct the MSC when CRTC is not running. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-29DRI2: make populate_vbl_request_type externalIlija Hadzic
We'll need to use this function in other .c files so remove static annotation from it. Also, add radeon_ prefix because this function is now part of global namespace, so it would be nice to know where it is coming from. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-23DRI2: change signature of populate_vbl_request_typeIlija Hadzic
This function no longer uses info argument, so nuke it. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-01-11DRI2/r[345]xx: 16 bit depth buffers use square micro tiling.Michel Dänzer
Fixes piglit sanity.tests (with 3D drivers which allocate depth buffers from the X server). Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-11DRI2: Properly use buffer depth passed in by client.Michel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-10Drop support for X servers older than 1.7.Michel Dänzer
The main purpose is to drop DRI2 compatibility code paths which are getting awkward to deal with and at this point are probably only tested lightly if at all. xserver 1.7 was released more than 3 years ago, and 1.6.2 was already required before. Mostly mechanical, there's probably potential for more cleanups. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-03DRI2: limit the swap rate when CRTC is in DPMS-off stateIlija Hadzic
If drawable is displayed on a CRTC and relevant CRTC is in DPMS off state, defer the swap by a fixed (hard-coded) time. This patch fixes a bug that caused an application to render at uncontrolled rate when CRTC goes into DPMS "off" state, thus thrashing the GPU and CPU and likely offsetting the power savings achieved by shutting off the display. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-03DRI2: change signature of radeon_dri2_drawable_crtcIlija Hadzic
Return pointer to the CRTC instead of CRTC ID and expose consider_disabled option in arguments of this function. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-03video: add option to include disabled CRTCs in best CRTC searchIlija Hadzic
This patch adds an option called consider_disabled to radeon_pick_best_crtc function. If this option is set and searching for best-fit CRTC yields nothing, the search will be widened to include CRTCs in DPMS "off" state. The new option is not used yet; it will be in the patches to follow. v2: Do not look at the CRTC mode, we only care about its box. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2012-11-15radeon: avoid segfault when pixmap exceed GPU capabilitiesJerome Glisse
We might get a request for a pixmap/drawable that is too big for GPU capabilities in the dri2 get buffer path. In face of such things just return NULL to dri2 get buffer request. The GL driver should then use something like transparent black to avoid something too ugly on the screen. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2012-10-16radeon/dri2: fix the window->pixmap math properly.Dave Airlie
Okay kwin did things different, and I really hope this time this is the correct transformation operation. It works here with gears under kwin and under mutter and under xcompmgr. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-10-11radeon/dri2: fix damage reporting on pageflipDave Airlie
when you use MPX or slave usb devices, the damage posting was incorrect, and resulted in misrendered boxes on the screen. Fix it by reporting damage correctly. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-13glamor: Force acceleration for DRI2 copies.Michel Dänzer
Improves performance of non-pageflipped 3D apps on SI. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-09-12glamor: Fix DRI2 crash introduced by PRIME changes.Michel Dänzer
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-09-04radeon/dri2: fix build against older servers.Dave Airlie
Older servers won't have DRI2UpdatePrime, so fix build. bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54433 Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-03radeon: add dri2 offload support.Dave Airlie
This adds the new dri2 interfaces required for radeon to be offloaded to. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-03radeon: damage full screen after pageflipDave Airlie
in order for offload to work we need to cause a full screen damage to be registered after pageflip. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13Deal more gracefully with DRI2 being unavailable at build or run time.Michel Dänzer
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-07-10Initial SI support.Michel Dänzer
Defaults to shadowfb. 3D acceleration is available with glamor. 2D acceleration is disabled until the radeonsi driver can handle glamor's shaders. v2: add chip flags (Alex Deucher) Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2012-07-10Initial glamor support.Michel Dänzer
Enable at build time with --enable-glamor and runtime with Option "AccelMethod" "glamor" The most notable lack of functionality is XVideo. Use something like VDPAU for now. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-06-15radeon: drop all UMS/DRI1/XAA/overlay support.Dave Airlie
This overhauls the radeon driver and removes all the old UMS-only code, it drops all the UMS, DRI1, XAA, overlay Xv, video capture, tv tuners There are probably a lot more cleanups that will fall out of this afterwards. So far this is compile/build tested. Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-06Don't page-flip or wait on a CRTC while we're VT-switched away.Michel Dänzer
We don't know what the CRTC state is. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-05-23ati: convert to new screen conversion APIsDave Airlie
The compat header takes care of the old server vs new server. this commit was autogenerated from util/modular/x-driver-screen-scrn-conv.sh Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-03-06DRI2: Unreference buffers immediately when event wait info is invalidated.Michel Dänzer
Deferring this could result in trying to unreference buffers from a previous server generation, i.e. accessing freed memory. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Christian König <Christian.koenig@amd.com>
2012-02-13Handle new xorg_list API.Michel Dänzer
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45937 Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-02-06r600-evergreen: use common surface allocator for tiling v11Jerome Glisse
Use libdrm common surface code so mesa,ddx have same idea about tiling surface and what their pitch should be and the alignment constraint. v2 fix remaining issue add new option to conditionaly enable v3 fix fbcon copy and r600 exa copy path v4 fix non tiled path 2D tiling on GPU >= R600, set it to false as default v5 adapt to pixel/element size split of libdrm/radeon v6 update to properly handle falling back to 1d tiled v6 final fix to tile split value on evergreen and newer v7 fix default array mode on r6xx, fix height alignment issue on evergreen v8 fix tile split value v9 add stencil tile split support, simplify dri2 for stencil with evergreen v10 Try to fix xv path regarding tiling. Adapt to libdrm API change. Try to fix case where there is no surface which means non tiled bo. v11 check for proper libdrm Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2011-12-28DRI2: Can't use page flipping for pixmaps. (bug #42913)Michel Dänzer
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=42913 . Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2011-12-06radeon: add original radeon to always tiled.Dave Airlie
and actually enable it for M7, previous commit only did one function. Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06radeon: refine always tiled depth checkDave Airlie
So it appears the M7 family always tiles its depth buffer also. Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05radeon: r200 depth buffers are always tiledDave Airlie
When we do the allocations we need to make sure the always tiled nature is taken into account. Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-25Make radeon_dri2_create_buffer(s) more robust. (Bug #30047)Michel Dänzer
In particular, handle and propagate failure to allocate GPU accessible memory, instead of crashing. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=30047 . Also take care not to leak resources in error paths. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2011-10-19dri2: Add vdpau driver name entryMaarten Lankhorst
libvdpau has a driver loading mechanism that looks for a dri2 driver first before falling back to nvidia, so lets use that. Allows use of libvdpau_rx00 without having to set things up separately, similar to the patch to xf86-video-nouveau. Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com> Reviewed-by: Christian König <deathsimple@vodafone.de> Reviewed-by: Michel Dänzer <michel@daenzer.net> Tested-by: Michel Dänzer <michel@daenzer.net>
2011-08-01dri2: Update front buffer pixmap and name before exchanging buffersVille Syrjala
Buffer exchange assumes that the front buffer pixmap and name information is accurate. That may not be the case eg. if the window has been (un)redirected since the buffer was created. Signed-off-by: Ville Syrjala <syrjala@sci.fi>
2011-06-17dri2: fix copy pasto in a6154c00c64932332e8f6e334661ffd579cfd894Alex Deucher
Reported-by: Nils Wallménius <nils.wallmenius@gmail.com> Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-06-16dri2: missing bit from a6154c00c64932332e8f6e334661ffd579cfd894Alex Deucher
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-06-16dri2/eg+: fix size and alignment of depth/stencil buffersAlex Deucher
Base alignment may be 256B or 512B depending on the group size. Also need to check against front size for virtualX. Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-05-06DRI2: fix high-crtc/vblank oversight/bugIlija Hadzic
improvements to high-crtc handling done in f0b7d7b449cc77bb2b281d81108507f8bc2e6018 introduced a bug that caused the populate_vbl_request_type to never use the high-crtc field even when it should. The reason is that the offending patch put the code under #ifdef DRM_VBLANK_HIGH_CRTC_MASK which is not visible outside the enum type, so #else was always taken in compilation type. This patch fixes it by basing #ifdef on (pre-processor visible) DRM_VBLANK_HIGH_CRTC_SHIFT constant Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
2011-04-05DRI2: Some cleanups for the scheduling mess.Michel Dänzer
* Fix build against libdrm that doesn't define *_VBLANK_HIGH_CRTC*. * If we have more than two CRTCs but can't use DRM_VBLANK_HIGH_CRTC_MASK, don't enable scheduling in the first place rather than relying on DRM_VBLANK_SECONDARY magically doing something sensible for higher CRTCs. * Only set up client state tracking when scheduling is enabled. * Only declare pRADEONEnt when it's needed, and break long lines.
2011-04-02xf86-video-ati: (revised #2) add support for vblank on crtc > 1Ilija Hadzic
Hi Alex, Enclosed is a revised version of two patches sent on Mar 18 and Mar 22, respectively. Details summarized in these two threads: http://lists.freedesktop.org/archives/dri-devel/2011-March/009463.html http://lists.freedesktop.org/archives/dri-devel/2011-March/009582.html This patch reconciles the DDX with the change in libdrm sent to this list earlier today. Specifically, it refers to a symbol that has been renamed from DRM_CAP_HIGH_CRTC to DRM_CAP_VBLANK_HIGH_CRTC. It *supersedes* the previous patch (i.e. apply it to the master branch as it exists at the time of this writing, not as an incremental patch to the one sent previously). Regards, Ilija Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-02-24dri2: disable pageflipping for transformed displaysAlex Deucher
Based on Ben's nouveau patch. Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2010-12-19ddx/ati: Bugfix for pageflip consistency check.Mario Kleiner
target_msc wasn't passed from vblank event handler to pageflip routine, due to a missing initalization. Now fixed. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>