mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1042947 - Remove Framebuffer.cpp, r=sotaro
This commit is contained in:
parent
878ea184cf
commit
47a05df1cb
@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et ft=cpp : */
|
||||
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Framebuffer.h"
|
||||
|
||||
#include "android/log.h"
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "nsSize.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args)
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace mozilla {
|
||||
namespace Framebuffer {
|
||||
|
||||
static size_t sMappedSize;
|
||||
static struct fb_var_screeninfo sVi;
|
||||
static gfxIntSize *sScreenSize = nullptr;
|
||||
|
||||
bool
|
||||
GetSize(nsIntSize *aScreenSize) {
|
||||
// If the framebuffer has been opened, we should always have the size.
|
||||
if (sScreenSize) {
|
||||
*aScreenSize = *sScreenSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
ScopedClose fd(open("/dev/graphics/fb0", O_RDWR));
|
||||
if (0 > fd.get()) {
|
||||
LOG("Error opening framebuffer device");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 > ioctl(fd.get(), FBIOGET_VSCREENINFO, &sVi)) {
|
||||
LOG("Error getting variable screeninfo");
|
||||
return false;
|
||||
}
|
||||
|
||||
sScreenSize = new gfxIntSize(sVi.xres, sVi.yres);
|
||||
*aScreenSize = *sScreenSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Framebuffer
|
||||
} // namespace mozilla
|
@ -1,28 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et ft=cpp : */
|
||||
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class nsIntSize;
|
||||
|
||||
namespace mozilla {
|
||||
namespace Framebuffer {
|
||||
|
||||
// Return true if the fbdev was successfully opened or the size was
|
||||
// already cached.
|
||||
bool GetSize(nsIntSize *aScreenSize);
|
||||
|
||||
} // namespace Framebuffer
|
||||
} // namespace mozilla
|
@ -18,7 +18,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "libdisplay/GonkDisplay.h"
|
||||
#include "Framebuffer.h"
|
||||
#include "HwcUtils.h"
|
||||
#include "HwcComposer2D.h"
|
||||
#include "LayerScope.h"
|
||||
@ -98,8 +97,10 @@ HwcComposer2D::Init(hwc_display_t dpy, hwc_surface_t sur, gl::GLContext* aGLCont
|
||||
|
||||
nsIntSize screenSize;
|
||||
|
||||
mozilla::Framebuffer::GetSize(&screenSize);
|
||||
mScreenRect = nsIntRect(nsIntPoint(0, 0), screenSize);
|
||||
ANativeWindow *win = GetGonkDisplay()->GetNativeWindow();
|
||||
win->query(win, NATIVE_WINDOW_WIDTH, &screenSize.width);
|
||||
win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height);
|
||||
mScreenRect = nsIntRect(nsIntPoint(0, 0), screenSize);
|
||||
|
||||
#if ANDROID_VERSION >= 17
|
||||
int supported = 0;
|
||||
|
@ -44,7 +44,6 @@ SOURCES += ['libui/' + src for src in [
|
||||
]]
|
||||
|
||||
SOURCES += [
|
||||
'Framebuffer.cpp',
|
||||
'GfxInfo.cpp',
|
||||
'GonkMemoryPressureMonitoring.cpp',
|
||||
'GonkPermission.cpp',
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "Framebuffer.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxUtils.h"
|
||||
@ -126,43 +125,47 @@ displayEnabledCallback(bool enabled)
|
||||
|
||||
nsWindow::nsWindow()
|
||||
{
|
||||
if (!sScreenInitialized) {
|
||||
sScreenOnEvent = new ScreenOnOffEvent(true);
|
||||
ClearOnShutdown(&sScreenOnEvent);
|
||||
sScreenOffEvent = new ScreenOnOffEvent(false);
|
||||
ClearOnShutdown(&sScreenOffEvent);
|
||||
GetGonkDisplay()->OnEnabled(displayEnabledCallback);
|
||||
if (sScreenInitialized)
|
||||
return;
|
||||
|
||||
nsIntSize screenSize;
|
||||
bool gotFB = Framebuffer::GetSize(&screenSize);
|
||||
if (!gotFB) {
|
||||
NS_RUNTIMEABORT("Failed to get size from framebuffer, aborting...");
|
||||
}
|
||||
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
|
||||
sScreenOnEvent = new ScreenOnOffEvent(true);
|
||||
ClearOnShutdown(&sScreenOnEvent);
|
||||
sScreenOffEvent = new ScreenOnOffEvent(false);
|
||||
ClearOnShutdown(&sScreenOffEvent);
|
||||
GetGonkDisplay()->OnEnabled(displayEnabledCallback);
|
||||
|
||||
char propValue[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.sf.hwrotation", propValue, "0");
|
||||
sPhysicalScreenRotation = atoi(propValue) / 90;
|
||||
nsIntSize screenSize;
|
||||
|
||||
sVirtualBounds = gScreenBounds;
|
||||
ANativeWindow *win = GetGonkDisplay()->GetNativeWindow();
|
||||
|
||||
sScreenInitialized = true;
|
||||
|
||||
nsAppShell::NotifyScreenInitialized();
|
||||
|
||||
// This is a hack to force initialization of the compositor
|
||||
// resources, if we're going to use omtc.
|
||||
//
|
||||
// NB: GetPlatform() will create the gfxPlatform, which wants
|
||||
// to know the color depth, which asks our native window.
|
||||
// This has to happen after other init has finished.
|
||||
gfxPlatform::GetPlatform();
|
||||
if (!ShouldUseOffMainThreadCompositing()) {
|
||||
MOZ_CRASH("How can we render apps, then?");
|
||||
}
|
||||
//Update sUsingHwc whenever layers.composer2d.enabled changes
|
||||
Preferences::AddBoolVarCache(&sUsingHwc, "layers.composer2d.enabled");
|
||||
if (win->query(win, NATIVE_WINDOW_WIDTH, &screenSize.width) ||
|
||||
win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height)) {
|
||||
NS_RUNTIMEABORT("Failed to get native window size, aborting...");
|
||||
}
|
||||
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
|
||||
|
||||
char propValue[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.sf.hwrotation", propValue, "0");
|
||||
sPhysicalScreenRotation = atoi(propValue) / 90;
|
||||
|
||||
sVirtualBounds = gScreenBounds;
|
||||
|
||||
sScreenInitialized = true;
|
||||
|
||||
nsAppShell::NotifyScreenInitialized();
|
||||
|
||||
// This is a hack to force initialization of the compositor
|
||||
// resources, if we're going to use omtc.
|
||||
//
|
||||
// NB: GetPlatform() will create the gfxPlatform, which wants
|
||||
// to know the color depth, which asks our native window.
|
||||
// This has to happen after other init has finished.
|
||||
gfxPlatform::GetPlatform();
|
||||
if (!ShouldUseOffMainThreadCompositing()) {
|
||||
MOZ_CRASH("How can we render apps, then?");
|
||||
}
|
||||
// Update sUsingHwc whenever layers.composer2d.enabled changes
|
||||
Preferences::AddBoolVarCache(&sUsingHwc, "layers.composer2d.enabled");
|
||||
}
|
||||
|
||||
nsWindow::~nsWindow()
|
||||
|
Loading…
Reference in New Issue
Block a user