summaryrefslogtreecommitdiffstats
path: root/content/common/gpu
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 00:54:25 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 00:54:25 +0000
commit744329cf9801e052f15c9697c3fcf57e7a3169b4 (patch)
tree92d17439d43862570ac6357c283f82ff8c829e99 /content/common/gpu
parent36a3cd62844159f91f542ae3657dd0ac24d7f5af (diff)
downloadchromium_src-744329cf9801e052f15c9697c3fcf57e7a3169b4.zip
chromium_src-744329cf9801e052f15c9697c3fcf57e7a3169b4.tar.gz
chromium_src-744329cf9801e052f15c9697c3fcf57e7a3169b4.tar.bz2
Revert 210138 "Perform glReadPixels with PBOs in the gpu, if PBO..."
> Perform glReadPixels with PBOs in the gpu, if PBOs are available. > Make GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM wait for readpixel transfers. > PLEASE NOTE: glMapBuffer does not wait for the readpixels transfer to complete anymore. > Nobody is currently relying on that behaviour. > Update gl_helper.cc and gl_renderer.cc to use queries. > > This CL is the same as https://codereview.chromium.org/16831004/ > but includes fixes for: > OutOfProcessPPAPITests.Graphics3D (removed a check in query_tracker.cc) > GLReadbackTest.ReadPixelsWithPBO (removed, no longer a valid test) > GLReadbackTest.ReadPixelsWithPBOAndQuery (now uses the correct query) > > BUG=249925 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=209873 > > Review URL: https://chromiumcodereview.appspot.com/18555006 TBR=hubbe@chromium.org BUG=258169 Review URL: https://codereview.chromium.org/19029003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu')
-rw-r--r--content/common/gpu/client/gl_helper.cc80
1 files changed, 29 insertions, 51 deletions
diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc
index 23efbdd..e4876b1 100644
--- a/content/common/gpu/client/gl_helper.cc
+++ b/content/common/gpu/client/gl_helper.cc
@@ -189,24 +189,20 @@ class GLHelper::CopyTextureToImpl :
int32 row_stride_bytes_,
unsigned char* pixels_,
const base::Callback<void(bool)>& callback_)
- : done(false),
- size(size_),
+ : size(size_),
bytes_per_row(bytes_per_row_),
row_stride_bytes(row_stride_bytes_),
pixels(pixels_),
callback(callback_),
- buffer(0),
- query(0) {
+ buffer(0) {
}
- bool done;
gfx::Size size;
int bytes_per_row;
int row_stride_bytes;
unsigned char* pixels;
base::Callback<void(bool)> callback;
GLuint buffer;
- WebKit::WebGLId query;
};
// A readback pipeline that also converts the data to YUV before
@@ -297,7 +293,7 @@ class GLHelper::CopyTextureToImpl :
GLHelper::ScalerQuality quality);
static void nullcallback(bool success) {}
- void ReadbackDone(Request *request);
+ void ReadbackDone(Request* request);
void FinishRequest(Request* request, bool result);
void CancelRequests();
@@ -385,16 +381,12 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync(
NULL,
GL_STREAM_READ);
- request->query = context_->createQueryEXT();
- context_->beginQueryEXT(GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM,
- request->query);
context_->readPixels(0, 0, dst_size.width(), dst_size.height(),
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- context_->endQueryEXT(GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM);
context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
- cc::SyncPointHelper::SignalQuery(
+ cc::SyncPointHelper::SignalSyncPoint(
context_,
- request->query,
+ context_->insertSyncPoint(),
base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request));
}
@@ -472,59 +464,45 @@ WebKit::WebGLId GLHelper::CopyTextureToImpl::CopyAndScaleTexture(
quality);
}
-void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request) {
+void GLHelper::CopyTextureToImpl::ReadbackDone(Request* request) {
TRACE_EVENT0("mirror",
"GLHelper::CopyTextureToImpl::CheckReadbackFramebufferComplete");
- finished_request->done = true;
+ DCHECK(request == request_queue_.front());
- // We process transfer requests in the order they were received, regardless
- // of the order we get the callbacks in.
- while (!request_queue_.empty()) {
- Request* request = request_queue_.front();
- if (!request->done) {
- break;
- }
-
- bool result = false;
- if (request->buffer != 0) {
- context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
- request->buffer);
- unsigned char* data = static_cast<unsigned char *>(
- context_->mapBufferCHROMIUM(
- GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY));
- if (data) {
- result = true;
- if (request->bytes_per_row == request->size.width() * 4 &&
- request->bytes_per_row == request->row_stride_bytes) {
- memcpy(request->pixels, data, request->size.GetArea() * 4);
- } else {
- unsigned char* out = request->pixels;
- for (int y = 0; y < request->size.height(); y++) {
- memcpy(out, data, request->bytes_per_row);
- out += request->row_stride_bytes;
- data += request->size.width() * 4;
- }
+ bool result = false;
+ if (request->buffer != 0) {
+ context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM,
+ request->buffer);
+ unsigned char* data = static_cast<unsigned char *>(
+ context_->mapBufferCHROMIUM(
+ GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY));
+ if (data) {
+ result = true;
+ if (request->bytes_per_row == request->size.width() * 4 &&
+ request->bytes_per_row == request->row_stride_bytes) {
+ memcpy(request->pixels, data, request->size.GetArea() * 4);
+ } else {
+ unsigned char* out = request->pixels;
+ for (int y = 0; y < request->size.height(); y++) {
+ memcpy(out, data, request->bytes_per_row);
+ out += request->row_stride_bytes;
+ data += request->size.width() * 4;
}
- context_->unmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM);
}
- context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
+ context_->unmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM);
}
-
- FinishRequest(request, result);
+ context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
}
+
+ FinishRequest(request, result);
}
void GLHelper::CopyTextureToImpl::FinishRequest(Request* request,
bool result) {
- TRACE_EVENT0("mirror", "GLHelper::CopyTextureToImpl::FinishRequest");
DCHECK(request_queue_.front() == request);
request_queue_.pop();
request->callback.Run(result);
ScopedFlush flush(context_);
- if (request->query != 0) {
- context_->deleteQueryEXT(request->query);
- request->query = 0;
- }
if (request->buffer != 0) {
context_->deleteBuffer(request->buffer);
request->buffer = 0;