Bug 1638010 [Wayland] Make WaylandDMABUFTextureData::BorrowDrawTarget() fail when underlying dmabuf surface is not locked, r=sotaro
authorMartin Stransky <stransky@redhat.com>
Fri, 15 May 2020 07:52:39 +0000
changeset 530236 c67a5c3491dfcfdc11dcfd644c26a8d7da67b2c4
parent 530235 6265eda0bf72fa31b2ce7f6fa338313c98496100
child 530237 a559275d075cfbe39284476d2281bf6e5bce9b4b
push id37420
push usernerli@mozilla.com
push dateFri, 15 May 2020 21:52:36 +0000
treeherdermozilla-central@f340bbb582d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1638010
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1638010 [Wayland] Make WaylandDMABUFTextureData::BorrowDrawTarget() fail when underlying dmabuf surface is not locked, r=sotaro Differential Revision: https://phabricator.services.mozilla.com/D75329
gfx/layers/opengl/WaylandDMABUFTextureClientOGL.cpp
--- a/gfx/layers/opengl/WaylandDMABUFTextureClientOGL.cpp
+++ b/gfx/layers/opengl/WaylandDMABUFTextureClientOGL.cpp
@@ -81,16 +81,19 @@ already_AddRefed<DataSourceSurface> Wayl
 
 already_AddRefed<DrawTarget> WaylandDMABUFTextureData::BorrowDrawTarget() {
   MOZ_ASSERT(mBackend != BackendType::NONE);
   if (mBackend == BackendType::NONE) {
     // shouldn't happen, but degrade gracefully
     return nullptr;
   }
   auto surf = mSurface->GetAsWaylandDMABufSurfaceRGBA();
+  if (!surf->GetMappedRegion()) {
+    return nullptr;
+  }
   return Factory::CreateDrawTargetForData(
       mBackend, (unsigned char*)surf->GetMappedRegion(),
       IntSize(surf->GetWidth(), surf->GetHeight()),
       surf->GetMappedRegionStride(), surf->GetFormat(), true);
 }
 
 void WaylandDMABUFTextureData::Deallocate(LayersIPCChannel*) {
   mSurface = nullptr;