[Intel-gfx] [PATCH 1/3] uxa/dri: Refine the pageflip processing.
zhigang.gong at linux.intel.com
zhigang.gong at linux.intel.com
Fri Feb 17 12:50:50 CET 2012
From: Zhigang Gong <zhigang.gong at linux.intel.com>
Add a new element back_name to intel structure to track
the back bo's name then avoid flink every time.
And at function I830DRI2ExchangeBuffers, after finish
the BO exchange between info's front and back pixmap,
it set the new front bo to the screen pixmap. But the
screen pixmap should be the same as front's pixmap,
so this is a duplicate operation and can be removed.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
src/intel.h | 1 +
src/intel_dri.c | 48 ++++++++++++++++++++++++++++--------------------
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/src/intel.h b/src/intel.h
index 7593731..16055e9 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -254,6 +254,7 @@ typedef struct intel_screen_private {
void *modes;
drm_intel_bo *front_buffer, *back_buffer;
+ unsigned int back_name;
long front_pitch, front_tiling;
void *shadow_buffer;
int shadow_stride;
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 8bc6157..98ae230 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -835,14 +835,27 @@ i830_dri2_del_frame_event(DrawablePtr drawable, DRI2FrameEventPtr info)
free(info);
}
+static struct intel_pixmap *
+intel_exchange_pixmap_buffers(PixmapPtr front, PixmapPtr back)
+{
+ struct intel_pixmap *new_front, *new_back;
+
+ new_front = intel_get_pixmap_private(back);
+ new_back = intel_get_pixmap_private(front);
+ intel_set_pixmap_private(front, new_front);
+ intel_set_pixmap_private(back, new_back);
+ new_front->busy = 1;
+ new_back->busy = -1;
+
+ return new_front;
+}
+
static void
-I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back)
+I830DRI2ExchangeBuffers(struct intel_screen_private *intel, DRI2BufferPtr front, DRI2BufferPtr back)
{
I830DRI2BufferPrivatePtr front_priv, back_priv;
- struct intel_pixmap *front_intel, *back_intel;
- ScreenPtr screen;
- intel_screen_private *intel;
int tmp;
+ struct intel_pixmap *new_front;
front_priv = front->driverPrivate;
back_priv = back->driverPrivate;
@@ -853,21 +866,11 @@ I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr bac
back->name = tmp;
/* Swap pixmap bos */
- front_intel = intel_get_pixmap_private(front_priv->pixmap);
- back_intel = intel_get_pixmap_private(back_priv->pixmap);
- intel_set_pixmap_private(front_priv->pixmap, back_intel);
- intel_set_pixmap_private(back_priv->pixmap, front_intel);
-
- screen = draw->pScreen;
- intel = intel_get_screen_private(xf86Screens[screen->myNum]);
-
+ new_front = intel_exchange_pixmap_buffers(front_priv->pixmap,
+ back_priv->pixmap);
dri_bo_unreference (intel->front_buffer);
- intel->front_buffer = back_intel->bo;
+ intel->front_buffer = new_front->bo;
dri_bo_reference (intel->front_buffer);
-
- intel_set_pixmap_private(screen->GetScreenPixmap(screen), back_intel);
- back_intel->busy = 1;
- front_intel->busy = -1;
}
/*
@@ -881,6 +884,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
{
I830DRI2BufferPrivatePtr priv = info->back->driverPrivate;
drm_intel_bo *new_back, *old_back;
+ int tmp_name;
if (!intel->use_triple_buffer) {
if (!intel_do_pageflip(intel,
@@ -889,7 +893,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
return FALSE;
info->type = DRI2_SWAP;
- I830DRI2ExchangeBuffers(draw, info->front, info->back);
+ I830DRI2ExchangeBuffers(intel, info->front, info->back);
return TRUE;
}
@@ -915,6 +919,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
}
drm_intel_bo_disable_reuse(new_back);
+ dri_bo_flink(new_back, &intel->back_name);
} else {
new_back = intel->back_buffer;
intel->back_buffer = NULL;
@@ -934,10 +939,13 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
priv = info->front->driverPrivate;
intel_set_pixmap_bo(priv->pixmap, new_back);
- dri_bo_flink(new_back, &info->front->name);
+
+ tmp_name = info->front->name;
+ info->front->name = intel->back_name;
+ intel->back_name = tmp_name;
/* Then flip DRI2 pointers and update the screen pixmap */
- I830DRI2ExchangeBuffers(draw, info->front, info->back);
+ I830DRI2ExchangeBuffers(intel, info->front, info->back);
DRI2SwapComplete(info->client, draw, 0, 0, 0,
DRI2_EXCHANGE_COMPLETE,
info->event_complete,
--
1.7.4.4
More information about the Intel-gfx
mailing list