summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300
diff options
context:
space:
mode:
authorJesse Barnes <jesse.barnes@intel.com>2007-10-29 11:56:31 -0700
committerJesse Barnes <jesse.barnes@intel.com>2007-10-29 12:06:00 -0700
commit38fdb47d26055e19d50cd407266b56ed4317ae0a (patch)
tree944589d67c440e7f9cef7350dde877424e087d19 /src/mesa/drivers/dri/r300
parent40133487dbdd14456a8a4f6a5716f57a36eb1ea7 (diff)
Refactor and fix core vblank support
Consolidate support for synchronizing to and retrieving vblank counters. Also fix the core vblank code to return monotonic MSC counters, which are required by some GLX extensions. Adding support for multiple pipes to a low level driver is fairly easy, the Intel 965 driver provides simple example code (see intel_buffers.c:intelWindowMoved()). The new code bumps the media stream counter extension version to 2 and adds a new getDrawableMSC callback. This callback takes a drawablePrivate pointer, which is used to calculate the MSC value seen by clients based on the actual vblank counter(s) returned from the kernel. The new drawable private fields are as follows: - vblSeq - used for tracking vblank counts for buffer swapping - vblFlags - flags (e.g. current pipe), updated by low level driver - msc_base - MSC counter from the last time the current pipe changed - vblank_base - kernel DRM vblank counter from the last time the pipe changed Using the above variables, the core vblank code (in vblank.c) can calculate a monotonic MSC value. The low level DRI drivers are responsible for updating the current pipe (by setting VBLANK_FLAG_SECONDARY for example in vblFlags) along with msc_base and vblank_base whenever the pipe associated with a given drawable changes (again, see intelWindowMoved for an example of this). Drivers should fill in the GetDrawableMSC DriverAPIRec field to point to driDrawableGetMSC32 and add code for pipe switching as outlined above to fully support the new scheme.
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.c7
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.h5
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.c8
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.h4
4 files changed, 10 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
index 6dfaf3c647..8316b745ce 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.c
+++ b/src/mesa/drivers/dri/r300/radeon_context.c
@@ -127,6 +127,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
void *sharedContextPrivate)
{
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+ __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv;
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
GLcontext* ctx;
GLcontext* shareCtx;
@@ -177,7 +178,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
radeon->do_usleeps ? "usleeps" : "busy waits",
fthrottle_mode, radeon->radeonScreen->irq);
- radeon->vblank_flags = (radeon->radeonScreen->irq != 0)
+ dPriv->vblFlags = (radeon->radeonScreen->irq != 0)
? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ;
(*dri_interface->getUST) (&radeon->swap_ust);
@@ -277,9 +278,7 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
radeon->glCtx);
if (radeon->dri.drawable != driDrawPriv) {
- driDrawableInitVBlank(driDrawPriv,
- radeon->vblank_flags,
- &radeon->vbl_seq);
+ driDrawableInitVBlank(driDrawPriv);
}
radeon->dri.readable = driReadPriv;
diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h
index 2f239417a9..38d8930601 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.h
+++ b/src/mesa/drivers/dri/r300/radeon_context.h
@@ -182,10 +182,7 @@ struct radeon_context {
GLuint irqsEmitted;
drm_radeon_irq_wait_t iw;
- /* VBI / buffer swap */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
+ /* buffer swap */
int64_t swap_ust;
int64_t swap_missed_ust;
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c
index 0b8656b9c1..eeef71aaaf 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c
@@ -157,7 +157,7 @@ static void radeonWaitForFrameCompletion(radeonContextPtr radeon)
/* Copy the back color buffer to the front color buffer.
*/
-void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
+void radeonCopyBuffer(__DRIdrawablePrivate * dPriv,
const drm_clip_rect_t * rect)
{
radeonContextPtr radeon;
@@ -187,7 +187,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
if (!rect)
{
UNLOCK_HARDWARE(radeon);
- driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
+ driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target);
LOCK_HARDWARE(radeon);
}
@@ -253,7 +253,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
}
}
-void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
+void radeonPageFlip(__DRIdrawablePrivate * dPriv)
{
radeonContextPtr radeon;
GLint ret;
@@ -293,7 +293,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
*/
radeonWaitForFrameCompletion(radeon);
UNLOCK_HARDWARE(radeon);
- driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
+ driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags,
&missed_target);
if (missed_target) {
radeon->swap_missed_count++;
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.h b/src/mesa/drivers/dri/r300/radeon_ioctl.h
index 3a80d36c62..210001e8e0 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.h
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.h
@@ -46,9 +46,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include "radeon_drm.h"
-extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable,
+extern void radeonCopyBuffer(__DRIdrawablePrivate * drawable,
const drm_clip_rect_t * rect);
-extern void radeonPageFlip(const __DRIdrawablePrivate * drawable);
+extern void radeonPageFlip(__DRIdrawablePrivate * drawable);
extern void radeonFlush(GLcontext * ctx);
extern void radeonFinish(GLcontext * ctx);
extern void radeonWaitForIdleLocked(radeonContextPtr radeon);