summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 13:44:53 +0000
committerskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 13:44:53 +0000
commitb68b7341b54da6638643e02d62a61c225ecad0f6 (patch)
treea49525a257bc552f56f6b5cdcb153783a1c38f3b /ui
parentc7f723c82709ca3b09d4711be191ca762550eab4 (diff)
downloadchromium_src-b68b7341b54da6638643e02d62a61c225ecad0f6.zip
chromium_src-b68b7341b54da6638643e02d62a61c225ecad0f6.tar.gz
chromium_src-b68b7341b54da6638643e02d62a61c225ecad0f6.tar.bz2
gpu: Finish after EGLImage creation on Qualcomm
Qualcomm devices (e.g., Nexus 4) run into texture corruption problems if the same texture is uploaded to with both async and normal uploads. Synchronize after EGLImage creation on the main thread as a work-around. BUG=178634 Review URL: https://chromiumcodereview.appspot.com/12390020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gl/async_pixel_transfer_delegate_android.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/ui/gl/async_pixel_transfer_delegate_android.cc b/ui/gl/async_pixel_transfer_delegate_android.cc
index a1c7eb2..85a4374 100644
--- a/ui/gl/async_pixel_transfer_delegate_android.cc
+++ b/ui/gl/async_pixel_transfer_delegate_android.cc
@@ -184,6 +184,7 @@ class TransferStateInternal
public:
explicit TransferStateInternal(GLuint texture_id,
bool wait_for_uploads,
+ bool wait_for_creation,
bool use_image_preserved)
: texture_id_(texture_id),
thread_texture_id_(0),
@@ -191,6 +192,7 @@ class TransferStateInternal
transfer_completion_(true, true),
egl_image_(EGL_NO_IMAGE_KHR),
wait_for_uploads_(wait_for_uploads),
+ wait_for_creation_(wait_for_creation),
use_image_preserved_(use_image_preserved) {
static const AsyncTexImage2DParams zero_params = {0, 0, 0, 0, 0, 0, 0, 0};
late_bind_define_params_ = zero_params;
@@ -254,8 +256,13 @@ class TransferStateInternal
}
void CreateEglImageOnMainThreadIfNeeded() {
- if (egl_image_ == EGL_NO_IMAGE_KHR)
+ if (egl_image_ == EGL_NO_IMAGE_KHR) {
CreateEglImage(texture_id_);
+ if (wait_for_creation_) {
+ TRACE_EVENT0("gpu", "glFinish creation");
+ glFinish();
+ }
+ }
}
void WaitForLastUpload() {
@@ -323,6 +330,7 @@ class TransferStateInternal
// Customize when we block on fences (these are work-arounds).
bool wait_for_uploads_;
+ bool wait_for_creation_;
bool use_image_preserved_;
};
@@ -332,9 +340,11 @@ class AsyncTransferStateAndroid : public AsyncPixelTransferState {
public:
explicit AsyncTransferStateAndroid(GLuint texture_id,
bool wait_for_uploads,
+ bool wait_for_creation,
bool use_image_preserved)
: internal_(new TransferStateInternal(texture_id,
wait_for_uploads,
+ wait_for_creation,
use_image_preserved)) {
}
virtual ~AsyncTransferStateAndroid() {}
@@ -454,6 +464,11 @@ AsyncPixelTransferState*
// In practice, they are complete when the CPU glTexSubImage2D completes.
bool wait_for_uploads = !is_imagination_;
+ // Qualcomm runs into texture corruption problems if the same texture is
+ // uploaded to with both async and normal uploads. Synchronize after EGLImage
+ // creation on the main thread as a work-around.
+ bool wait_for_creation = is_qualcomm_;
+
// Qualcomm has a race when using image_preserved=FALSE,
// which can result in black textures even after the first upload.
// Since using FALSE is mainly for performance (to avoid layout changes),
@@ -464,6 +479,7 @@ AsyncPixelTransferState*
return static_cast<AsyncPixelTransferState*>(
new AsyncTransferStateAndroid(texture_id,
wait_for_uploads,
+ wait_for_creation,
use_image_preserved));
}