Bug 1314291 - use unchecked xcb PutImage requests in nsShmImage. r=karlt
authorLee Salzman <lsalzman@mozilla.com>
Thu, 03 Nov 2016 20:57:08 -0400
changeset 321003 36024a69211724511f461e0cfa1dca435d1a3d66
parent 321002 5b5686e1bcd1a736f9d6f48f29122c8bd5148501
child 321004 93515fab001d99f9723b931773ada3a3824a3ded
push id30914
push userphilringnalda@gmail.com
push dateSat, 05 Nov 2016 01:56:48 +0000
treeherdermozilla-central@f092853e5640 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1314291
milestone52.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 1314291 - use unchecked xcb PutImage requests in nsShmImage. r=karlt MozReview-Commit-ID: 1rxvpTh5EAl
widget/nsShmImage.cpp
widget/nsShmImage.h
--- a/widget/nsShmImage.cpp
+++ b/widget/nsShmImage.cpp
@@ -34,17 +34,16 @@ nsShmImage::nsShmImage(Display* aDisplay
   , mPixmap(XCB_NONE)
   , mGC(XCB_NONE)
   , mRequestPending(false)
   , mShmSeg(XCB_NONE)
   , mShmId(-1)
   , mShmAddr(nullptr)
 {
   mConnection = XGetXCBConnection(aDisplay);
-  mozilla::PodZero(&mPutRequest);
   mozilla::PodZero(&mSyncRequest);
 }
 
 nsShmImage::~nsShmImage()
 {
   DestroyImage();
 }
 
@@ -248,23 +247,16 @@ nsShmImage::CreateDrawTarget(const mozil
   // Typically X clients would wait for a XShmCompletionEvent to be received,
   // but this works as it's sent immediately after the request is processed.
   if (mRequestPending) {
     xcb_get_input_focus_reply_t* reply;
     if ((reply = xcb_get_input_focus_reply(mConnection, mSyncRequest, nullptr))) {
       free(reply);
     }
     mRequestPending = false;
-
-    xcb_generic_error_t* error;
-    if ((error = xcb_request_check(mConnection, mPutRequest))) {
-      gShmAvailable = false;
-      free(error);
-      return nullptr;
-    }
   }
 
   // Due to bug 1205045, we must avoid making GTK calls off the main thread to query window size.
   // Instead we just track the largest offset within the image we are drawing to and grow the image
   // to accomodate it. Since usually the entire window is invalidated on the first paint to it,
   // this should grow the image to the necessary size quickly without many intermediate reallocations.
   IntRect bounds = aRegion.GetBounds().ToUnknownRect();
   IntSize size(bounds.XMost(), bounds.YMost());
@@ -299,28 +291,28 @@ nsShmImage::Put(const mozilla::LayoutDev
     mGC = xcb_generate_id(mConnection);
     xcb_create_gc(mConnection, mGC, mWindow, 0, nullptr);
   }
 
   xcb_set_clip_rectangles(mConnection, XCB_CLIP_ORDERING_YX_BANDED, mGC, 0, 0,
                           xrects.Length(), xrects.Elements());
 
   if (mPixmap != XCB_NONE) {
-    mPutRequest = xcb_copy_area_checked(mConnection, mPixmap, mWindow, mGC,
-                                        0, 0, 0, 0, mSize.width, mSize.height);
+    xcb_copy_area(mConnection, mPixmap, mWindow, mGC,
+                  0, 0, 0, 0, mSize.width, mSize.height);
   } else {
-    mPutRequest = xcb_shm_put_image_checked(mConnection, mWindow, mGC,
-                                            mSize.width, mSize.height,
-                                            0, 0, mSize.width, mSize.height,
-                                            0, 0, mDepth,
-                                            XCB_IMAGE_FORMAT_Z_PIXMAP, 0,
-                                            mShmSeg, 0);
+    xcb_shm_put_image(mConnection, mWindow, mGC,
+                      mSize.width, mSize.height,
+                      0, 0, mSize.width, mSize.height,
+                      0, 0, mDepth,
+                      XCB_IMAGE_FORMAT_Z_PIXMAP, 0,
+                      mShmSeg, 0);
   }
 
   // Send a request that returns a response so that we don't have to start a
-  // sync in nsShmImage::CreateDrawTarget to retrieve the result of mPutRequest.
+  // sync in nsShmImage::CreateDrawTarget.
   mSyncRequest = xcb_get_input_focus(mConnection);
   mRequestPending = true;
 
   xcb_flush(mConnection);
 }
 
 #endif  // MOZ_HAVE_SHMIMAGE
--- a/widget/nsShmImage.h
+++ b/widget/nsShmImage.h
@@ -53,17 +53,16 @@ private:
   Visual*                      mVisual;
   unsigned int                 mDepth;
 
   mozilla::gfx::SurfaceFormat  mFormat;
   mozilla::gfx::IntSize        mSize;
 
   xcb_pixmap_t                 mPixmap;
   xcb_gcontext_t               mGC;
-  xcb_void_cookie_t            mPutRequest;
   xcb_get_input_focus_cookie_t mSyncRequest;
   bool                         mRequestPending;
 
   xcb_shm_seg_t                mShmSeg;
   int                          mShmId;
   uint8_t*                     mShmAddr;
 };