Backed out 4 changesets (bug 1182665) for android reftest orange CLOSED TREE

Backed out changeset 719a4fbded10 (bug 1182665)
Backed out changeset 9559cead8d08 (bug 1182665)
Backed out changeset 4080fb4b9a7f (bug 1182665)
Backed out changeset c8549221c366 (bug 1182665)
This commit is contained in:
Wes Kocher 2015-09-11 11:21:56 -07:00
Родитель bbe3773db1
Коммит ca0fa7c1cb
20 изменённых файлов: 129 добавлений и 132 удалений

Просмотреть файл

@ -169,10 +169,6 @@ ScreenManagerParent::RecvScreenForBrowser(const TabId& aTabId,
bool
ScreenManagerParent::ExtractScreenDetails(nsIScreen* aScreen, ScreenDetails &aDetails)
{
if (!aScreen) {
return false;
}
uint32_t id;
nsresult rv = aScreen->GetId(&id);
NS_ENSURE_SUCCESS(rv, false);

Просмотреть файл

@ -69,7 +69,27 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
return nullptr;
}
if (gfxPlatform::GetPlatform()->CanUseDoubleBufferedContent(backend)) {
bool useDoubleBuffering = false;
#ifdef XP_WIN
if (backend == LayersBackend::LAYERS_D3D11) {
useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
} else
#endif
#ifdef MOZ_WIDGET_GTK
// We can't use double buffering when using image content with
// Xrender support on Linux, as ContentHostDoubleBuffered is not
// suited for direct uploads to the server.
if (!gfxPlatformGtk::GetPlatform()->UseImageOffscreenSurfaces() ||
!gfxPlatformGtk::GetPlatform()->UseXRender())
#endif
{
useDoubleBuffering = (LayerManagerComposite::SupportsDirectTexturing() &&
backend != LayersBackend::LAYERS_D3D9) ||
backend == LayersBackend::LAYERS_BASIC;
}
if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
return MakeAndAddRef<ContentClientDoubleBuffered>(aForwarder);
}
return MakeAndAddRef<ContentClientSingleBuffered>(aForwarder);

Просмотреть файл

@ -100,7 +100,13 @@ gfxAndroidPlatform::gfxAndroidPlatform()
RegisterStrongMemoryReporter(new FreetypeReporter());
mOffscreenFormat = GetScreenDepth() == 16
nsCOMPtr<nsIScreenManager> screenMgr = do_GetService("@mozilla.org/gfx/screenmanager;1");
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
mScreenDepth = 24;
screen->GetColorDepth(&mScreenDepth);
mOffscreenFormat = mScreenDepth == 16
? gfxImageFormat::RGB16_565
: gfxImageFormat::RGB24;
@ -412,6 +418,12 @@ gfxAndroidPlatform::RequiresLinearZoom()
return gfxPlatform::RequiresLinearZoom();
}
int
gfxAndroidPlatform::GetScreenDepth() const
{
return mScreenDepth;
}
bool
gfxAndroidPlatform::UseAcceleratedSkiaCanvas()
{

Просмотреть файл

@ -80,6 +80,8 @@ public:
FT_Library GetFTLibrary();
virtual int GetScreenDepth() const;
virtual bool CanRenderContentToDataSurface() const override {
return true;
}

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/SharedBufferManagerChild.h"
#include "mozilla/layers/ISurfaceAllocator.h" // for GfxMemoryImageReporter
#include "mozilla/layers/LayerManagerComposite.h"
#include "mozilla/Logging.h"
#include "mozilla/Services.h"
@ -53,7 +52,6 @@
#include "gfxGraphiteShaper.h"
#include "gfx2DGlue.h"
#include "gfxGradientCache.h"
#include "gfxUtils.h" // for NextPowerOfTwo
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
@ -388,7 +386,6 @@ gfxPlatform::gfxPlatform()
, mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
, mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo)
, mCompositorBackend(layers::LayersBackend::LAYERS_NONE)
, mScreenDepth(0)
{
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
@ -509,7 +506,6 @@ gfxPlatform::Init()
InitLayersAccelerationPrefs();
InitLayersIPC();
gPlatform->PopulateScreenInfo();
gPlatform->ComputeTileSize();
nsresult rv;
@ -1016,45 +1012,43 @@ gfxPlatform::ComputeTileSize()
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()) {
gfx::IntSize screenSize = GetScreenSize();
if (screenSize.width > 0) {
w = h = std::max(std::min(NextPowerOfTwo(screenSize.width) / 2, 1024), 256);
}
#ifdef MOZ_WIDGET_GONK
int32_t format = android::PIXEL_FORMAT_RGBA_8888;
android::sp<android::GraphicBuffer> alloc =
new android::GraphicBuffer(w, h, android::PIXEL_FORMAT_RGBA_8888,
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
android::GraphicBuffer::USAGE_HW_TEXTURE);
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);
}
void
gfxPlatform::PopulateScreenInfo()
{
nsCOMPtr<nsIScreenManager> manager = do_GetService("@mozilla.org/gfx/screenmanager;1");
MOZ_ASSERT(manager, "failed to get nsIScreenManager");
nsCOMPtr<nsIScreen> screen;
manager->GetPrimaryScreen(getter_AddRefs(screen));
if (!screen) {
// This can happen in xpcshell, for instance
return;
#ifdef XP_MACOSX
// Use double sized tiles for HiDPI screens.
nsCOMPtr<nsIScreenManager> screenManager =
do_GetService("@mozilla.org/gfx/screenmanager;1");
if (screenManager) {
nsCOMPtr<nsIScreen> primaryScreen;
screenManager->GetPrimaryScreen(getter_AddRefs(primaryScreen));
double scaleFactor = 1.0;
if (primaryScreen) {
primaryScreen->GetContentsScaleFactor(&scaleFactor);
}
if (scaleFactor > 1.0) {
w *= 2;
h *= 2;
}
}
#endif
screen->GetColorDepth(&mScreenDepth);
int left, top;
screen->GetRect(&left, &top, &mScreenSize.width, &mScreenSize.height);
SetTileSize(w, h);
}
bool
@ -2087,6 +2081,13 @@ gfxPlatform::GetLog(eGfxLog aWhichLog)
return nullptr;
}
int
gfxPlatform::GetScreenDepth() const
{
NS_WARNING("GetScreenDepth not implemented on this platform -- returning 0!");
return 0;
}
mozilla::gfx::SurfaceFormat
gfxPlatform::Optimal2DFormatForContent(gfxContentType aContent)
{
@ -2290,33 +2291,6 @@ gfxPlatform::DisableBufferRotation()
sBufferRotationCheckPref = false;
}
bool
gfxPlatform::CanUseDoubleBufferedContent(LayersBackend aBackend) const
{
bool useDoubleBuffering = false;
#ifdef XP_WIN
if (aBackend == LayersBackend::LAYERS_D3D11) {
useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
} else
#endif
#ifdef MOZ_WIDGET_GTK
// We can't use double buffering when using image content with
// Xrender support on Linux, as ContentHostDoubleBuffered is not
// suited for direct uploads to the server.
if (!gfxPlatformGtk::GetPlatform()->UseImageOffscreenSurfaces() ||
!gfxPlatformGtk::GetPlatform()->UseXRender())
#endif
{
useDoubleBuffering = (LayerManagerComposite::SupportsDirectTexturing() &&
aBackend != LayersBackend::LAYERS_D3D9) ||
aBackend == LayersBackend::LAYERS_BASIC;
}
return useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING");
}
already_AddRefed<ScaledFont>
gfxPlatform::GetScaledFontForFontWithCairoSkia(DrawTarget* aTarget, gfxFont* aFont)
{

Просмотреть файл

@ -496,11 +496,6 @@ public:
static bool BufferRotationEnabled();
static void DisableBufferRotation();
/**
* Check to see if we should use double buffered content client
*/
bool CanUseDoubleBufferedContent(mozilla::layers::LayersBackend aBackend) const;
/**
* Are we going to try color management?
*/
@ -573,8 +568,7 @@ public:
*/
static PRLogModuleInfo* GetLog(eGfxLog aWhichLog);
int GetScreenDepth() const { return mScreenDepth; }
mozilla::gfx::IntSize GetScreenSize() const { return mScreenSize; }
virtual int GetScreenDepth() const;
/**
* Return the layer debugging options to use browser-wide.
@ -768,11 +762,6 @@ private:
*/
void ComputeTileSize();
/**
* This uses nsIScreenManager to determine the screen size and color depth
*/
void PopulateScreenInfo();
nsRefPtr<gfxASurface> mScreenReferenceSurface;
nsTArray<uint32_t> mCJKPrefLangs;
nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
@ -800,9 +789,6 @@ private:
// Backend that we are compositing with. NONE, if no compositor has been
// created yet.
mozilla::layers::LayersBackend mCompositorBackend;
int32_t mScreenDepth;
mozilla::gfx::IntSize mScreenSize;
};
#endif /* GFX_PLATFORM_H */

Просмотреть файл

@ -363,6 +363,24 @@ gfxPlatformGtk::GetOffscreenFormat()
return gfxImageFormat::RGB24;
}
static int sDepth = 0;
int
gfxPlatformGtk::GetScreenDepth() const
{
if (!sDepth) {
GdkScreen *screen = gdk_screen_get_default();
if (screen) {
sDepth = gdk_visual_get_depth(gdk_visual_get_system());
} else {
sDepth = 24;
}
}
return sDepth;
}
void
gfxPlatformGtk::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
{

Просмотреть файл

@ -122,6 +122,8 @@ public:
virtual gfxImageFormat GetOffscreenFormat() override;
virtual int GetScreenDepth() const override;
bool SupportsApzWheelInput() const override {
return true;
}

Просмотреть файл

@ -53,8 +53,8 @@ gfxQtPlatform::gfxQtPlatform()
if (!sFontconfigUtils)
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
int32_t depth = GetScreenDepth();
if (depth == 16) {
mScreenDepth = qApp->primaryScreen()->depth();
if (mScreenDepth == 16) {
sOffscreenFormat = gfxImageFormat::RGB16_565;
}
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO) | BackendTypeBit(BackendType::SKIA);
@ -195,6 +195,12 @@ gfxQtPlatform::GetOffscreenFormat()
return sOffscreenFormat;
}
int
gfxQtPlatform::GetScreenDepth() const
{
return mScreenDepth;
}
already_AddRefed<ScaledFont>
gfxQtPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont* aFont)
{

Просмотреть файл

@ -82,6 +82,8 @@ public:
static Screen* GetXScreen(QWindow* aWindow = 0);
#endif
virtual int GetScreenDepth() const override;
bool AccelerateLayersByDefault() override {
return true;
}

Просмотреть файл

@ -1595,6 +1595,26 @@ gfxWindowsPlatform::IsOptimus()
return knowIsOptimus;
}
int
gfxWindowsPlatform::GetScreenDepth() const
{
// if the system doesn't have all displays with the same
// pixel format, just return 24 and move on with life.
if (!GetSystemMetrics(SM_SAMEDISPLAYFORMAT))
return 24;
HDC hdc = GetDC(nullptr);
if (!hdc)
return 24;
int depth = GetDeviceCaps(hdc, BITSPIXEL) *
GetDeviceCaps(hdc, PLANES);
ReleaseDC(nullptr, hdc);
return depth;
}
IDXGIAdapter1*
gfxWindowsPlatform::GetDXGIAdapter()
{

Просмотреть файл

@ -139,6 +139,8 @@ public:
RENDER_MODE_MAX
};
int GetScreenDepth() const;
RenderMode GetRenderMode() { return mRenderMode; }
void SetRenderMode(RenderMode rmode) { mRenderMode = rmode; }

Просмотреть файл

@ -81,7 +81,6 @@ import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
@ -108,7 +107,6 @@ import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.Surface;
import android.view.SurfaceView;
@ -2673,10 +2671,4 @@ public class GeckoAppShell
}
return 0;
}
@WrapForJNI
static Rect getScreenSize() {
Display disp = getGeckoInterface().getActivity().getWindowManager().getDefaultDisplay();
return new Rect(0, 0, disp.getWidth(), disp.getHeight());
}
}

Просмотреть файл

@ -393,14 +393,6 @@ auto GeckoAppShell::GetScreenOrientationWrapper() -> int16_t
return mozilla::jni::Method<GetScreenOrientationWrapper_t>::Call(nullptr, nullptr);
}
constexpr char GeckoAppShell::GetScreenSize_t::name[];
constexpr char GeckoAppShell::GetScreenSize_t::signature[];
auto GeckoAppShell::GetScreenSize() -> mozilla::jni::Object::LocalRef
{
return mozilla::jni::Method<GetScreenSize_t>::Call(nullptr, nullptr);
}
constexpr char GeckoAppShell::GetShowPasswordSetting_t::name[];
constexpr char GeckoAppShell::GetShowPasswordSetting_t::signature[];

Просмотреть файл

@ -944,23 +944,6 @@ public:
static auto GetScreenOrientationWrapper() -> int16_t;
public:
struct GetScreenSize_t {
typedef GeckoAppShell Owner;
typedef mozilla::jni::Object::LocalRef ReturnType;
typedef mozilla::jni::Object::Param SetterType;
typedef mozilla::jni::Args<> Args;
static constexpr char name[] = "getScreenSize";
static constexpr char signature[] =
"()Landroid/graphics/Rect;";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
static auto GetScreenSize() -> mozilla::jni::Object::LocalRef;
public:
struct GetShowPasswordSetting_t {
typedef GeckoAppShell Owner;

Просмотреть файл

@ -1,2 +0,0 @@
android.graphics.Rect
android.graphics.RectF

Просмотреть файл

@ -24,7 +24,6 @@ sdk_processor := \
# We'd like these to be defined in a future GENERATED_EXPORTS list.
bindings_exports_FILES := \
AndroidRect.h \
Bundle.h \
MediaCodec.h \
SurfaceTexture.h \

Просмотреть файл

@ -7,10 +7,9 @@
# List of stems to generate .cpp and .h files for. To add a stem, add it to
# this list and ensure that $(stem)-classes.txt exists in this directory.
generated = [
'AndroidRect',
'Bundle',
'MediaCodec',
'SurfaceTexture'
'SurfaceTexture',
]
SOURCES += ['!%s.cpp' % stem for stem in generated]

Просмотреть файл

@ -8,9 +8,6 @@
#include "nsScreenManagerAndroid.h"
#include "nsWindow.h"
#include "AndroidBridge.h"
#include "GeneratedJNIWrappers.h"
#include "AndroidRect.h"
#include <mozilla/jni/Refs.h>
using namespace mozilla;
@ -32,11 +29,13 @@ nsScreenAndroid::GetId(uint32_t *outId)
NS_IMETHODIMP
nsScreenAndroid::GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
{
widget::sdk::Rect::LocalRef rect = widget::GeckoAppShell::GetScreenSize();
rect->Left(outLeft);
rect->Top(outTop);
rect->Width(outWidth);
rect->Height(outHeight);
gfxIntSize sz = nsWindow::GetAndroidScreenBounds();
*outLeft = 0;
*outTop = 0;
*outWidth = sz.width;
*outHeight = sz.height;
return NS_OK;
}

Просмотреть файл

@ -99,11 +99,6 @@ nsScreenManagerGtk :: EnsureInit()
return NS_OK;
mRootWindow = gdk_get_default_root_window();
if (!mRootWindow) {
// Sometimes we don't initial X (e.g., xpcshell)
return NS_OK;
}
g_object_ref(mRootWindow);
// GDK_PROPERTY_CHANGE_MASK ==> PropertyChangeMask, for PropertyNotify