1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __mozilla_widget_nsShmImage_h__
8 #define __mozilla_widget_nsShmImage_h__
11 # define MOZ_HAVE_SHMIMAGE
14 #ifdef MOZ_HAVE_SHMIMAGE
16 # include "mozilla/gfx/2D.h"
17 # include "nsIWidget.h"
20 # include <X11/Xlib-xcb.h>
24 // bug 1168843, compositor thread may create shared memory instances that are
25 // destroyed by main thread on shutdown, so this must use thread-safe RC to
26 // avoid hitting assertion
27 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsShmImage
)
32 already_AddRefed
<mozilla::gfx::DrawTarget
> CreateDrawTarget(
33 const mozilla::LayoutDeviceIntRegion
& aRegion
);
35 void Put(const mozilla::LayoutDeviceIntRegion
& aRegion
);
37 nsShmImage(Display
* aDisplay
, Drawable aWindow
, Visual
* aVisual
,
45 bool CreateShmSegment();
46 void DestroyShmSegment();
48 bool CreateImage(const mozilla::gfx::IntSize
& aSize
);
51 void WaitIfPendingReply();
54 xcb_connection_t
* mConnection
;
59 mozilla::gfx::SurfaceFormat mFormat
;
60 mozilla::gfx::IntSize mSize
;
65 xcb_get_input_focus_cookie_t mSyncRequest
;
68 xcb_shm_seg_t mShmSeg
;
73 #endif // MOZ_HAVE_SHMIMAGE