Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: gpu/command_buffer/service/query_manager.cc

Issue 11428140: gpu: Add async pixel transfer interface, stub and tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address Feedback. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/query_manager.cc
diff --git a/gpu/command_buffer/service/query_manager.cc b/gpu/command_buffer/service/query_manager.cc
index 61a8d7f55c68794ff38eccdd011005c3cef5f54c..51055e2034a46fa5012ad2cc9c046903bfa24010 100644
--- a/gpu/command_buffer/service/query_manager.cc
+++ b/gpu/command_buffer/service/query_manager.cc
@@ -4,11 +4,13 @@
#include "gpu/command_buffer/service/query_manager.h"
#include "base/atomicops.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/time.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/feature_info.h"
+#include "ui/gl/async_pixel_transfer_delegate.h"
namespace gpu {
namespace gles2 {
@@ -162,7 +164,9 @@ void CommandLatencyQuery::Destroy(bool /* have_context */) {
CommandLatencyQuery::~CommandLatencyQuery() {
}
-class AsyncPixelTransfersCompletedQuery : public QueryManager::Query {
+class AsyncPixelTransfersCompletedQuery
+ : public QueryManager::Query
+ , public base::SupportsWeakPtr<AsyncPixelTransfersCompletedQuery> {
public:
AsyncPixelTransfersCompletedQuery(
QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset);
@@ -172,6 +176,8 @@ class AsyncPixelTransfersCompletedQuery : public QueryManager::Query {
virtual bool Process() OVERRIDE;
virtual void Destroy(bool have_context) OVERRIDE;
+ void MarkAsCompletedCallback() { MarkAsCompleted(1); }
+
protected:
virtual ~AsyncPixelTransfersCompletedQuery();
};
@@ -186,12 +192,24 @@ bool AsyncPixelTransfersCompletedQuery::Begin() {
}
bool AsyncPixelTransfersCompletedQuery::End(uint32 submit_count) {
- // TODO(epenner): Mark completion via an async task.
- // TODO(epenner): This will be a boolean to start, indicating
- // completion of all tasks in the query. We could change this
- // to return a count of tasks completed instead.
MarkAsPending(submit_count);
- return MarkAsCompleted(1);
+
+ // This will call MarkAsCompleted(1) as a reply to a task on
+ // the async upload thread, such that it occurs after all previous
+ // async transfers have completed.
+ manager()->decoder()->GetAsyncPixelTransferDelegate()->AsyncNotifyCompletion(
+ base::Bind(
+ &AsyncPixelTransfersCompletedQuery::MarkAsCompletedCallback,
+ AsWeakPtr()));
+
+ // TODO(epenner): The async task occurs outside the normal
+ // flow, via a callback on this thread. Is there anything
+ // missing or wrong with that?
+
+ // TODO(epenner): Could we possibly trigger the completion on
+ // the upload thread by writing to the query shared memory
+ // directly?
+ return true;
}
bool AsyncPixelTransfersCompletedQuery::Process() {
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698