mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1094442 - Part 2: Adjust tile size to the stride of the gralloc buffers. r=kats
--HG-- extra : rebase_source : d3386ee007d6429b81aa6d3ffe6c518fb67c7d6a
This commit is contained in:
parent
8a1c4934f8
commit
48140f14fe
@ -89,8 +89,17 @@ CompositorChild::Create(Transport* aTransport, ProcessId aOtherProcess)
|
||||
NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We release this ref in ActorDestroy().
|
||||
return sCompositor = child.forget().take();
|
||||
sCompositor = child.forget().take();
|
||||
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
sCompositor->SendGetTileSize(&width, &height);
|
||||
gfxPlatform::GetPlatform()->SetTileSize(width, height);
|
||||
|
||||
// We release this ref in ActorDestroy().
|
||||
return sCompositor;
|
||||
}
|
||||
|
||||
/*static*/ CompositorChild*
|
||||
|
@ -387,9 +387,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
||||
mCompositorVsyncObserver = new CompositorVsyncObserver(this);
|
||||
}
|
||||
|
||||
gfxPlatform::GetPlatform()->SetTileSize(
|
||||
gfxPrefs::LayersTileWidth(),
|
||||
gfxPrefs::LayersTileHeight());
|
||||
gfxPlatform::GetPlatform()->ComputeTileSize();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -525,6 +523,14 @@ CompositorParent::RecvFlushRendering()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvGetTileSize(int32_t* aWidth, int32_t* aHeight)
|
||||
{
|
||||
*aWidth = gfxPlatform::GetPlatform()->GetTileWidth();
|
||||
*aHeight = gfxPlatform::GetPlatform()->GetTileHeight();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvNotifyRegionInvalidated(const nsIntRegion& aRegion)
|
||||
{
|
||||
@ -1352,6 +1358,7 @@ public:
|
||||
, mNotifyAfterRemotePaint(false)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
gfxPlatform::GetPlatform()->ComputeTileSize();
|
||||
}
|
||||
|
||||
// IToplevelProtocol::CloneToplevel()
|
||||
@ -1377,6 +1384,13 @@ public:
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) MOZ_OVERRIDE
|
||||
{
|
||||
*aWidth = gfxPlatform::GetPlatform()->GetTileWidth();
|
||||
*aHeight = gfxPlatform::GetPlatform()->GetTileHeight();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tells this CompositorParent to send a message when the compositor has received the transaction.
|
||||
|
@ -151,6 +151,8 @@ public:
|
||||
const nsIntRect& aRect) MOZ_OVERRIDE;
|
||||
virtual bool RecvFlushRendering() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
|
||||
|
@ -88,6 +88,10 @@ parent:
|
||||
// block until they are completed.
|
||||
sync FlushRendering();
|
||||
|
||||
// Get the size of the tiles. This number should not change at runtime.
|
||||
sync GetTileSize()
|
||||
returns (int32_t tileWidth, int32_t tileHeight);
|
||||
|
||||
sync StartFrameTimeRecording(int32_t bufferSize)
|
||||
returns (uint32_t startIndex);
|
||||
|
||||
|
@ -58,10 +58,14 @@ public:
|
||||
};
|
||||
|
||||
TEST(TiledLayerBuffer, TileConstructor) {
|
||||
gfxPlatform::GetPlatform()->ComputeTileSize();
|
||||
|
||||
TestTiledLayerBuffer buffer;
|
||||
}
|
||||
|
||||
TEST(TiledLayerBuffer, TileStart) {
|
||||
gfxPlatform::GetPlatform()->ComputeTileSize();
|
||||
|
||||
TestTiledLayerBuffer buffer;
|
||||
|
||||
ASSERT_EQ(buffer.RoundDownToTileEdge(10, 256), 0);
|
||||
@ -69,6 +73,8 @@ TEST(TiledLayerBuffer, TileStart) {
|
||||
}
|
||||
|
||||
TEST(TiledLayerBuffer, EmptyUpdate) {
|
||||
gfxPlatform::GetPlatform()->ComputeTileSize();
|
||||
|
||||
TestTiledLayerBuffer buffer;
|
||||
|
||||
nsIntRegion validRegion(nsIntRect(0, 0, 10, 10));
|
||||
|
@ -78,6 +78,10 @@
|
||||
#include "TexturePoolOGL.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "mozilla/layers/GrallocTextureHost.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/Hal.h"
|
||||
#ifdef USE_SKIA
|
||||
#include "skia/SkGraphics.h"
|
||||
@ -885,6 +889,39 @@ gfxPlatform::SetTileSize(int aWidth, int aHeight)
|
||||
mTileHeight = aHeight;
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::ComputeTileSize()
|
||||
{
|
||||
// The tile size should be picked in the parent processes
|
||||
// and sent to the child processes over IPDL GetTileSize.
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
NS_RUNTIMEABORT("wrong process.");
|
||||
}
|
||||
|
||||
int32_t w = gfxPrefs::LayersTileWidth();
|
||||
int32_t h = gfxPrefs::LayersTileHeight();
|
||||
|
||||
// TODO We may want to take the screen size into consideration here.
|
||||
if (gfxPrefs::LayersTilesAdjust()) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
int32_t format = android::PIXEL_FORMAT_RGBA_8888;
|
||||
android::sp<android::GraphicBuffer> alloc =
|
||||
new android::GraphicBuffer(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight(),
|
||||
format,
|
||||
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
|
||||
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
|
||||
android::GraphicBuffer::USAGE_HW_TEXTURE);
|
||||
|
||||
if (alloc.get()) {
|
||||
w = alloc->getStride(); // We want the tiles to be gralloc stride aligned.
|
||||
// No need to adjust the height here.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SetTileSize(w, h);
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
|
||||
{
|
||||
|
@ -301,6 +301,12 @@ public:
|
||||
int GetTileWidth();
|
||||
int GetTileHeight();
|
||||
void SetTileSize(int aWidth, int aHeight);
|
||||
/**
|
||||
* Calling this function will compute and set the ideal tile size for the
|
||||
* platform. This should only be called in the parent process; child processes
|
||||
* should be updated via SetTileSize to match the value computed in the parent.
|
||||
*/
|
||||
void ComputeTileSize();
|
||||
|
||||
/**
|
||||
* Rebuilds the any cached system font lists
|
||||
|
@ -277,6 +277,7 @@ private:
|
||||
// they are often the same size as the screen, especially for width.
|
||||
DECL_GFX_PREF(Once, "layers.tile-width", LayersTileWidth, int32_t, 256);
|
||||
DECL_GFX_PREF(Once, "layers.tile-height", LayersTileHeight, int32_t, 256);
|
||||
DECL_GFX_PREF(Once, "layers.tiles.adjust", LayersTilesAdjust, bool, true);
|
||||
DECL_GFX_PREF(Once, "layers.tile-max-pool-size", LayersTileMaxPoolSize, uint32_t, (uint32_t)50);
|
||||
DECL_GFX_PREF(Once, "layers.tile-shrink-pool-timeout", LayersTileShrinkPoolTimeout, uint32_t, (uint32_t)1000);
|
||||
DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking", OverzealousGrallocUnlocking, bool, false);
|
||||
|
@ -3909,6 +3909,12 @@ pref("layers.tile-width", 256);
|
||||
pref("layers.tile-height", 256);
|
||||
// Max number of layers per container. See Overwrite in mobile prefs.
|
||||
pref("layers.max-active", -1);
|
||||
// If this is set the tile size will only be treated as a suggestion.
|
||||
// On B2G we will round this to the stride of the underlying allocation.
|
||||
// On any platform we may later use the screen size and ignore
|
||||
// tile-width/tile-height entirely. Its recommended to turn this off
|
||||
// if you change the tile size.
|
||||
pref("layers.tiles.adjust", true);
|
||||
|
||||
// Set the default values, and then override per-platform as needed
|
||||
pref("layers.offmainthreadcomposition.enabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user