diff options
author | Zhigang Gong <zhigang.gong@linux.intel.com> | 2012-02-17 19:50:50 +0800 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-02-21 08:40:10 +0000 |
commit | ce7a57994d662f340b9457a2750e4385e7d669cd (patch) | |
tree | 10530a149d40b85c7fcbe22cef388e779c012384 | |
parent | 1a65e2b8a2ebfb4d736efb7631515babad75faf2 (diff) |
uxa/dri: Refine the pageflip processing.
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@linux.intel.com>
-rw-r--r-- | src/intel.h | 1 | ||||
-rw-r--r-- | src/intel_dri.c | 48 |
2 files changed, 29 insertions, 20 deletions
diff --git a/src/intel.h b/src/intel.h index 8104bfed..355aaaf0 100644 --- a/src/intel.h +++ b/src/intel.h @@ -166,6 +166,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 8bc61577..98ae2308 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, |