зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1210189 - Use nsScreenGonk in nsWindow::StartRemoteDrawing() r=mwu
This commit is contained in:
Родитель
318ee7ff3b
Коммит
ebcecadcbd
|
@ -359,6 +359,39 @@ nsScreenGonk::BringToTop(nsWindow* aWindow)
|
|||
mTopWindows.InsertElementAt(0, aWindow);
|
||||
}
|
||||
|
||||
ANativeWindowBuffer*
|
||||
nsScreenGonk::DequeueBuffer()
|
||||
{
|
||||
ANativeWindowBuffer* buf = nullptr;
|
||||
#if ANDROID_VERSION >= 17
|
||||
int fenceFd = -1;
|
||||
mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf, &fenceFd);
|
||||
android::sp<android::Fence> fence(new android::Fence(fenceFd));
|
||||
#if ANDROID_VERSION == 17
|
||||
fence->waitForever(1000, "nsScreenGonk_DequeueBuffer");
|
||||
// 1000 is what Android uses. It is a warning timeout in ms.
|
||||
// This timeout was removed in ANDROID_VERSION 18.
|
||||
#else
|
||||
fence->waitForever("nsScreenGonk_DequeueBuffer");
|
||||
#endif
|
||||
#else
|
||||
mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf);
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool
|
||||
nsScreenGonk::QueueBuffer(ANativeWindowBuffer* buf)
|
||||
{
|
||||
#if ANDROID_VERSION >= 17
|
||||
int ret = mNativeWindow->queueBuffer(mNativeWindow.get(), buf, -1);
|
||||
return ret == 0;
|
||||
#else
|
||||
int ret = mNativeWindow->queueBuffer(mNativeWindow.get(), buf);
|
||||
return ret == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ANDROID_VERSION >= 17
|
||||
android::DisplaySurface*
|
||||
nsScreenGonk::GetDisplaySurface()
|
||||
|
|
|
@ -74,6 +74,9 @@ public:
|
|||
ScreenConfiguration GetConfiguration();
|
||||
bool IsPrimaryScreen();
|
||||
|
||||
ANativeWindowBuffer* DequeueBuffer();
|
||||
bool QueueBuffer(ANativeWindowBuffer* buf);
|
||||
|
||||
#if ANDROID_VERSION >= 17
|
||||
android::DisplaySurface* GetDisplaySurface();
|
||||
int GetPrevDispAcquireFd();
|
||||
|
|
|
@ -654,8 +654,7 @@ HalFormatToSurfaceFormat(int aHalFormat, int* bytepp)
|
|||
already_AddRefed<DrawTarget>
|
||||
nsWindow::StartRemoteDrawing()
|
||||
{
|
||||
GonkDisplay* display = GetGonkDisplay();
|
||||
mFramebuffer = display->DequeueBuffer();
|
||||
mFramebuffer = mScreen->DequeueBuffer();
|
||||
int width = mFramebuffer->width, height = mFramebuffer->height;
|
||||
void *vaddr;
|
||||
if (gralloc_module()->lock(gralloc_module(), mFramebuffer->handle,
|
||||
|
@ -667,7 +666,7 @@ nsWindow::StartRemoteDrawing()
|
|||
return nullptr;
|
||||
}
|
||||
int bytepp;
|
||||
SurfaceFormat format = HalFormatToSurfaceFormat(display->surfaceformat,
|
||||
SurfaceFormat format = HalFormatToSurfaceFormat(mScreen->GetSurfaceFormat(),
|
||||
&bytepp);
|
||||
mFramebufferTarget = Factory::CreateDrawTargetForData(
|
||||
BackendType::CAIRO, (uint8_t*)vaddr,
|
||||
|
@ -696,7 +695,7 @@ nsWindow::EndRemoteDrawing()
|
|||
gralloc_module()->unlock(gralloc_module(), mFramebuffer->handle);
|
||||
}
|
||||
if (mFramebuffer) {
|
||||
GetGonkDisplay()->QueueBuffer(mFramebuffer);
|
||||
mScreen->QueueBuffer(mFramebuffer);
|
||||
}
|
||||
mFramebuffer = nullptr;
|
||||
mFramebufferTarget = nullptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче