summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2013-09-15 23:04:28 -0700
committerMark Mueller <MarkKMueller@gmail.com>2013-10-28 11:06:48 -0700
commitcd32c906eea741d1f5b62807a237374fedf67491 (patch)
tree85b7acfd8d91527eb1822398e97aaa3285b1d7df
parent34b04cec39fe6b2a6801b899acd9bede9bc8dbb3 (diff)
clover: Simplify command_queue::flush().
Tested-by: Tom Stellard <thomas.stellard@amd.com>
-rw-r--r--src/gallium/state_trackers/clover/core/queue.cpp17
-rw-r--r--src/gallium/state_trackers/clover/core/queue.hpp4
2 files changed, 10 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp
index 084e3c3f73..3a8ccabb26 100644
--- a/src/gallium/state_trackers/clover/core/queue.cpp
+++ b/src/gallium/state_trackers/clover/core/queue.cpp
@@ -20,8 +20,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-#include <algorithm>
-
#include "core/queue.hpp"
#include "core/event.hpp"
#include "pipe/p_screen.h"
@@ -47,16 +45,15 @@ command_queue::flush() {
pipe_fence_handle *fence = NULL;
if (!queued_events.empty()) {
- // Find out which events have already been signalled.
- auto first = queued_events.begin();
- auto last = std::find_if(queued_events.begin(), queued_events.end(),
- [](event_ptr &ev) { return !ev->signalled(); });
-
- // Flush and fence them.
pipe->flush(pipe, &fence, 0);
- std::for_each(first, last, [&](event_ptr &ev) { ev->fence(fence); });
+
+ while (!queued_events.empty() &&
+ queued_events.front()->signalled()) {
+ queued_events.front()->fence(fence);
+ queued_events.pop_front();
+ }
+
screen->fence_reference(screen, &fence, NULL);
- queued_events.erase(first, last);
}
}
diff --git a/src/gallium/state_trackers/clover/core/queue.hpp b/src/gallium/state_trackers/clover/core/queue.hpp
index 671eaf7bdd..e3c4ceb774 100644
--- a/src/gallium/state_trackers/clover/core/queue.hpp
+++ b/src/gallium/state_trackers/clover/core/queue.hpp
@@ -23,6 +23,8 @@
#ifndef CLOVER_CORE_QUEUE_HPP
#define CLOVER_CORE_QUEUE_HPP
+#include <deque>
+
#include "core/object.hpp"
#include "core/context.hpp"
#include "core/timestamp.hpp"
@@ -69,7 +71,7 @@ namespace clover {
pipe_context *pipe;
typedef ref_ptr<hard_event> event_ptr;
- std::vector<event_ptr> queued_events;
+ std::deque<event_ptr> queued_events;
};
}