Module: Mesa Branch: master Commit: 4714c4ec48fcb17b8484cd1c44918fcedc3ce28e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4714c4ec48fcb17b8484cd1c44918fcedc3ce28e
Author: Chia-I Wu <olva...@gmail.com> Date: Fri Jul 25 10:53:05 2014 +0800 ilo: simplify ilo_flush() Move fence creation to the new ilo_fence_create(). --- src/gallium/drivers/ilo/ilo_context.c | 25 +++++-------------------- src/gallium/drivers/ilo/ilo_screen.c | 22 ++++++++++++++++++++++ src/gallium/drivers/ilo/ilo_screen.h | 3 +++ 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c index 2de0ed7..ab750ac 100644 --- a/src/gallium/drivers/ilo/ilo_context.c +++ b/src/gallium/drivers/ilo/ilo_context.c @@ -63,28 +63,13 @@ ilo_flush(struct pipe_context *pipe, { struct ilo_context *ilo = ilo_context(pipe); - if (f) { - struct ilo_fence *fence; - - fence = CALLOC_STRUCT(ilo_fence); - if (fence) { - pipe_reference_init(&fence->reference, 1); - - /* reference the batch bo that we want to wait on */ - if (ilo_cp_empty(ilo->cp)) - fence->bo = ilo->last_cp_bo; - else - fence->bo = ilo->cp->bo; - - if (fence->bo) - intel_bo_reference(fence->bo); - } - - *f = (struct pipe_fence_handle *) fence; - } - ilo_cp_flush(ilo->cp, (flags & PIPE_FLUSH_END_OF_FRAME) ? "frame end" : "user request"); + + if (f) { + *f = (struct pipe_fence_handle *) + ilo_fence_create(pipe->screen, ilo->last_cp_bo); + } } static void diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index e2a0e23..f4968f9 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -575,6 +575,28 @@ ilo_fence_finish(struct pipe_screen *screen, return true; } +/** + * Create a fence for \p bo. When \p bo is not NULL, it must be submitted + * before waited on or checked. + */ +struct ilo_fence * +ilo_fence_create(struct pipe_screen *screen, struct intel_bo *bo) +{ + struct ilo_fence *fence; + + fence = CALLOC_STRUCT(ilo_fence); + if (!fence) + return NULL; + + pipe_reference_init(&fence->reference, 1); + + if (bo) + intel_bo_reference(bo); + fence->bo = bo; + + return fence; +} + static void ilo_screen_destroy(struct pipe_screen *screen) { diff --git a/src/gallium/drivers/ilo/ilo_screen.h b/src/gallium/drivers/ilo/ilo_screen.h index 4c403f0..7e1ce72 100644 --- a/src/gallium/drivers/ilo/ilo_screen.h +++ b/src/gallium/drivers/ilo/ilo_screen.h @@ -60,4 +60,7 @@ ilo_fence(struct pipe_fence_handle *fence) return (struct ilo_fence *) fence; } +struct ilo_fence * +ilo_fence_create(struct pipe_screen *screen, struct intel_bo *bo); + #endif /* ILO_SCREEN_H */ _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit