Files
palemoon27/gfx/layers/basic/TextureClientX11.cpp
T
roytam1 89d38b5d7a import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1173364 - support ARIA table and cell roles, r=marcoz (c6f9fc891e)
- Bug 1205318 - make aria-owns loop alg more sophisticated, r=yzen (d287b1e41c)
- Bug 1205476 - crash in mozilla::a11y::DocAccessible::ProcessInvalidationList(), r=smaug (bf920abdd3)
- Bug 1205476 - crash in mozilla::a11y::DocAccessible::ProcessInvalidationList(), part3, r=davidb (675c3a0ee2)
- Bug 1205476 - crash in mozilla::a11y::DocAccessible::ProcessInvalidationList, part2, r=davidb (a7cd835169)
- Bug 1186786 - Replace nsBaseHashtable::EnumerateRead() calls in accessible/ with iterators. r=tbsaunde. (172fcbe18f)
- Bug 1219299 - rework aria-owns implementation, r=yzen (c297a84b41)
- Bug 1219744 - no child_of/parent_of relations for aria-owns, r=yzen (38ea8be268)
- Bug 1205341 - get rid of aria-owns provided relations, part1: remove ARIA combobox special support (bug 819273 backout), r=yzen (0ca03a27bd)
- Bug 1219743 - remove special ARIA owns support for ARIA menus, r=yzen (64468fdfd1)
- Bug 1200595 - Introduce TextureData and implement it for X11. r=mattwoodrow, Bas, sotaro (2e6bc3f02c)
- Bug 1200595 - Buffer TextureData implementation. r=mattwoodrow (1cb3ffd937)
- Bug 1227415 - Fix copy buffer size r=jolin (344130daec)
- Bug 1200595 - Gralloc TextureData implementation. r=sotaro (a0726233ca)
- Bug 1205725 - Add basic SidebandStream handling to HwcComposer2D r=mwu,nical (42bea59a5f)
- namespace (ab69730d53)
- Bug 1194775 - Paper over a crash in ContentClient. r=Bas (998051cee4)
- minor (c24c0b069d)
- Bug 1197315 - remove PR_snprintf calls in gfx/; r=froydnj (f153fed9c8)
- Bug 1157664 - Initialize mozilla::layers::FPSCOUNTER::mIteratorIndex. r=nical (cf5d2203ee)
- Bug 1157663 - Init mMap in the constructor to avoid half initialized structures. r=nical (d972306493)
- Bug 1167370: Check for Map() call failing. r=bas (707eda52ff)
- Bug 1221276 - Don't crash if we don't have a surface. r=nical (c53141ea3d)
- Bug 1219230 - Use the valid region for determining buffer size instead of the visible region. r=mstange (f2d4783eef)
- Pass the correct moz2d backend in CanvasClients. (bug 1212499, r=mattwoodrow) (c16688afbb)
- Bug 1179987 - Simplify unlocking of tiled texture hosts. r=nical (781200f702)
- Bug 1170189 - Fix tiling crash on Linux. r=jrmuizel (879bbfb506)
- Bug 1170189 - fix a comment in the tiling code. r=BenWa (62b47f1bbd)
- Bug 1179987 - Make tiled TextureSource recycling based on pointer comparisons rather than trying to do it geometrically. r=nical (7bde534929)
- Bug 1189710 - Use correct offset for LayerRenderState in TiledContentHost. r=jrmuizel (cb93c2f98a)
- Bug 1215050 - Make layerscope support TiledPaintedLayer when using HWC. r=mattwoodrow, r=cjku (6bffac30f8)
- Bug 1186208 - Fix crash when tiling is enabled on linux. r=mattwoodrow (b2f2c85734)
- Bug 1197713 - Add missing gfxPrefs.h include to TiledContentHost.cpp. r=nical (22bce4e071)
- Bug 1143575. Async image invalidation does not necessarily need to invalidate the layer; LayerTreeInvalidation will do that for us. r=mattwoodrow (a6144b7127)
- Bug 1219529 - Don't attempt to deallocate shmems after the ipdl protocol is shut down. r=sotaro (3bb89ef36e)
- Bug 1143575. Add assertion for diagnostic purposes. r=nical (e4944dd72f)
- Bug 1202175 - Guard GLX-specific call in SurfaceDescriptorX11. r=jgilbert (167a4aa49b)
- Bug 1132528 - Handle non existent key r=nical (6c12df1446)
- Bug 1137151: Marked destructor of |GrallocReporter| as protected, r=jmuizelaar (57605c4472)
- Bug 1145389 - Add gralloc allocation requet size check r=nical (47c6065148)
- Bug 1181197 - Fix null dereference in SharedPlanarYCbCrImage destructor. r=jgilbert (3f8c390a6f)
- Bug 1195110 - Check if GLContext is destroyed before freeing resources in CompositingRenderTargetOGL. r=jrmuizel (8eac603d84)
- bug 1178956 - Specify precision in OGLShaderProgram.cpp to fix compositor on iOS. r=kip (daa6d9db20)
- Bug 1186725 - InitTextures should check if LockRect() returns an error, r=mattwoodrow (bc87f908a7)
- Bug 1170143 - Add some error checks around the creation of dxgi ycbcrvideo frames. r=Bas (c96e4d9e79)
- Bug 1170143 - Build fix. r=me (a9d0064bc3)
- Bug 1202700 - Use d3d9 device to upload YCbCr surfaces on the client side if possible. r=Bas (3ccd0c68f5)
- Bug 1199361 - Add texture memory reporters for YCbCr TextureClients. r=jrmuizel (723e9d4b10)
- bug 1183967 - fixup correct case of mfidl.h (e9abd04709)
- Bug 1133007 - followup - make CreateServerSocketRunnable's constructor explicit; r=bustage (5de0ec7900)
- Bug 1195653 - Part1.1: Dump SecondaryEffects (EffectTypes::MASK) on Layerscope viewer. r=dglastonbury (v2, carry r+) (a6736ad381)
- Bug 1195653 - Part1.2: Use sSentTextureIds instead of sTextureIdList and move HasTextureIdBeenSent into SendTextureSource. r=dglastonbury (v3, carry r+) (7e0b14bca6)
- Bug 1195653 - Part1.3: Add isMask attribute field to LayerScopePacket.proto. r=dglastonbury (v2, carry r+) (510e50e09a)
- Bug 1195653 - Part1.4: Generated file diffs from patched LayerScopePacket.proto. r=dglastonbury (v1, carry r+) (f1824afcb3)
- Bug 1195653 - Part1.5: Send isMask info to LayerScope viewer by TexturePacket. r=dglastonbury (v3) (1722e5e6fe)
- Bug 1205521 - Part1: (v3) Add texture/mask attribute fields in LayerScopePacket.proto. r=dglastonbury (0cca15f8f5)
- Bug 1205521 - Part2: (v3) Generated file diffs from patched LayerScopePacket.proto. r=dglastonbury (6253724bcf)
- Bug 1205521 - Part3: (v3) Dump texture/mask attributes on layerscope viewer. r=dglastonbury (31d346bad1)
- Bug 1205521 - Part4: (v2) Align LayerScopePacket to fit changes in Bug 1211324. r=dglastonbury (712da0fe9c)
- Bug 1177023 - Log the IsRootContent flag when dumping framemetrics. r=botond (9bea51f318)
- Bug 1153724 - Only assert if the size was reasonable to start. r=mchang (c3d61bbee1)
- namespace (edcce0a0b3)
- Bug 1195857: Make nsPresContext::HasAuthorSpecifiedRules()'s arg 'const', to remove need for const_cast in callers. r=jwatt (274fe66dca)
- Bug 1182414, part 1 - Fix printing crash with range input controls. r=dholbert (352a408a83)
- Bug 1182414, part 2 - Add printing crash test. r=dholbert (0fc9bd4529)
- Bug 1099103 - Prevent numbers input using a grouping separator from being mis-processed as if the separator was a decimal separator. r=dholbert (90276c2f6b)
- Bug 1157142 - Support logical (inline/block) in addition to physical orientation for the <input type=range> element; make inline the default behavior so that range sliders respect writing mode. r=jwatt (2ec37cbba8)
2023-01-30 12:47:09 +08:00

157 lines
4.3 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/TextureClientX11.h"
#include "mozilla/layers/CompositableClient.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/ShadowLayerUtilsX11.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Logging.h"
#include "gfxXlibSurface.h"
#include "gfx2DGlue.h"
#include "mozilla/X11Util.h"
#include <X11/Xlib.h>
using namespace mozilla;
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
already_AddRefed<TextureClient>
CreateX11TextureClient(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ISurfaceAllocator* aAllocator)
{
TextureData* data = X11TextureData::Create(aSize, aFormat, aFlags, aAllocator);
if (!data) {
return nullptr;
}
return MakeAndAddRef<ClientTexture>(data, aFlags, aAllocator);
}
X11TextureData::X11TextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
bool aClientDeallocation, bool aIsCrossProcess,
gfxXlibSurface* aSurface)
: mSize(aSize)
, mFormat(aFormat)
, mSurface(aSurface)
, mClientDeallocation(aClientDeallocation)
, mIsCrossProcess(aIsCrossProcess)
{
MOZ_ASSERT(mSurface);
}
bool
X11TextureData::Lock(OpenMode aMode, FenceHandle*)
{
return true;
}
void
X11TextureData::Unlock()
{
if (mSurface && mIsCrossProcess) {
FinishX(DefaultXDisplay());
}
}
bool
X11TextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
{
MOZ_ASSERT(mSurface);
if (!mSurface) {
return false;
}
if (!mClientDeallocation) {
// Pass to the host the responsibility of freeing the pixmap. ReleasePixmap means
// the underlying pixmap will not be deallocated in mSurface's destructor.
// ToSurfaceDescriptor is at most called once per TextureClient.
mSurface->ReleasePixmap();
}
aOutDescriptor = SurfaceDescriptorX11(mSurface);
return true;
}
already_AddRefed<gfx::DrawTarget>
X11TextureData::BorrowDrawTarget()
{
MOZ_ASSERT(mSurface);
if (!mSurface) {
return nullptr;
}
IntSize size = mSurface->GetSize();
RefPtr<gfx::DrawTarget> dt = Factory::CreateDrawTargetForCairoSurface(mSurface->CairoSurface(), size);
return dt.forget();
}
bool
X11TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
{
RefPtr<DrawTarget> dt = BorrowDrawTarget();
if (!dt) {
return false;
}
dt->CopySurface(aSurface, IntRect(IntPoint(), aSurface->GetSize()), IntPoint());
return true;
}
void
X11TextureData::Deallocate(ISurfaceAllocator*)
{
mSurface = nullptr;
}
TextureData*
X11TextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
return X11TextureData::Create(mSize, mFormat, aFlags, aAllocator);
}
X11TextureData*
X11TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ISurfaceAllocator* aAllocator)
{
MOZ_ASSERT(aSize.width >= 0 && aSize.height >= 0);
if (aSize.width <= 0 || aSize.height <= 0 ||
aSize.width > XLIB_IMAGE_SIDE_SIZE_LIMIT ||
aSize.height > XLIB_IMAGE_SIDE_SIZE_LIMIT) {
gfxDebug() << "Asking for X11 surface of invalid size " << aSize.width << "x" << aSize.height;
return nullptr;
}
gfxImageFormat imageFormat = SurfaceFormatToImageFormat(aFormat);
RefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(aSize, imageFormat);
if (!surface || surface->GetType() != gfxSurfaceType::Xlib) {
NS_ERROR("creating Xlib surface failed!");
return nullptr;
}
gfxXlibSurface* xlibSurface = static_cast<gfxXlibSurface*>(surface.get());
bool crossProcess = !aAllocator->IsSameProcess();
X11TextureData* texture = new X11TextureData(aSize, aFormat,
!!(aFlags & TextureFlags::DEALLOCATE_CLIENT),
crossProcess,
xlibSurface);
if (crossProcess) {
FinishX(DefaultXDisplay());
}
return texture;
}
} // namespace
} // namespace