mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Merge latest green fx-team changeset and mozilla-central
This commit is contained in:
commit
6b74f52da8
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"revision": "ca81894022ba9094e24f6f1d233ef0ebb1b59bba",
|
"revision": "acd53f668718d06090805303ed85e36dddf61853",
|
||||||
"repo_path": "/integration/gaia-central"
|
"repo_path": "/integration/gaia-central"
|
||||||
}
|
}
|
||||||
|
@ -1258,6 +1258,10 @@ private:
|
|||||||
class PrepareAdapterRunnable : public nsRunnable
|
class PrepareAdapterRunnable : public nsRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
PrepareAdapterRunnable(const nsAString& aAdapterPath)
|
||||||
|
: mAdapterPath(aAdapterPath)
|
||||||
|
{ }
|
||||||
|
|
||||||
NS_IMETHOD Run()
|
NS_IMETHOD Run()
|
||||||
{
|
{
|
||||||
static const dbus_uint32_t sServices[] = {
|
static const dbus_uint32_t sServices[] = {
|
||||||
@ -1266,14 +1270,23 @@ public:
|
|||||||
BluetoothServiceClass::OBJECT_PUSH
|
BluetoothServiceClass::OBJECT_PUSH
|
||||||
};
|
};
|
||||||
|
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
nsRefPtr<DBusReplyHandler> handler = new AddReservedServiceRecordsReplyHandler();
|
nsRefPtr<RawDBusConnection> threadConnection = gThreadConnection;
|
||||||
MOZ_ASSERT(handler.get());
|
|
||||||
|
if (!threadConnection.get()) {
|
||||||
|
BT_WARNING("%s: DBus connection has been closed.", __FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sAdapterPath = mAdapterPath;
|
||||||
|
|
||||||
|
nsRefPtr<DBusReplyHandler> handler =
|
||||||
|
new AddReservedServiceRecordsReplyHandler();
|
||||||
|
|
||||||
const dbus_uint32_t* services = sServices;
|
const dbus_uint32_t* services = sServices;
|
||||||
|
|
||||||
bool success = dbus_func_args_async(gThreadConnection->GetConnection(), -1,
|
bool success = dbus_func_args_async(threadConnection->GetConnection(), -1,
|
||||||
DBusReplyHandler::Callback, handler.get(),
|
DBusReplyHandler::Callback, handler.get(),
|
||||||
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
NS_ConvertUTF16toUTF8(sAdapterPath).get(),
|
||||||
DBUS_ADAPTER_IFACE, "AddReservedServiceRecords",
|
DBUS_ADAPTER_IFACE, "AddReservedServiceRecords",
|
||||||
@ -1286,30 +1299,9 @@ public:
|
|||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
class PrepareAdapterTask : public nsRunnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PrepareAdapterTask(const nsAString& aPath)
|
|
||||||
: mPath(aPath)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult Run()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
BluetoothService* bs = BluetoothService::Get();
|
|
||||||
NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
|
|
||||||
sAdapterPath = mPath;
|
|
||||||
nsRefPtr<nsRunnable> func(new PrepareAdapterRunnable());
|
|
||||||
bs->DispatchToCommandThread(func);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsString mPath;
|
nsString mAdapterPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SendPlayStatusTask : public nsRunnable
|
class SendPlayStatusTask : public nsRunnable
|
||||||
@ -1517,7 +1509,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
|||||||
errorStr.AssignLiteral("Cannot parse manager path!");
|
errorStr.AssignLiteral("Cannot parse manager path!");
|
||||||
} else {
|
} else {
|
||||||
v = NS_ConvertUTF8toUTF16(str);
|
v = NS_ConvertUTF8toUTF16(str);
|
||||||
NS_DispatchToMainThread(new PrepareAdapterTask(v.get_nsString()));
|
NS_DispatchToMainThread(new PrepareAdapterRunnable(v.get_nsString()));
|
||||||
}
|
}
|
||||||
} else if (dbus_message_is_signal(aMsg, DBUS_MANAGER_IFACE,
|
} else if (dbus_message_is_signal(aMsg, DBUS_MANAGER_IFACE,
|
||||||
"PropertyChanged")) {
|
"PropertyChanged")) {
|
||||||
@ -1671,10 +1663,10 @@ BluetoothDBusService::StartInternal()
|
|||||||
nsAutoString replyError;
|
nsAutoString replyError;
|
||||||
if (!GetDefaultAdapterPath(v, replyError)) {
|
if (!GetDefaultAdapterPath(v, replyError)) {
|
||||||
// Adapter path is not ready yet
|
// Adapter path is not ready yet
|
||||||
// Let's do PrepareAdapterTask when we receive signal 'AdapterAdded'
|
// Let's do PrepareAdapterRunnable when we receive signal 'AdapterAdded'
|
||||||
} else {
|
} else {
|
||||||
// Adapter path has been ready. let's do PrepareAdapterTask now
|
// Adapter path has been ready. let's do PrepareAdapterRunnable now
|
||||||
nsRefPtr<PrepareAdapterTask> b = new PrepareAdapterTask(v.get_nsString());
|
nsRefPtr<PrepareAdapterRunnable> b = new PrepareAdapterRunnable(v.get_nsString());
|
||||||
if (NS_FAILED(NS_DispatchToMainThread(b))) {
|
if (NS_FAILED(NS_DispatchToMainThread(b))) {
|
||||||
NS_WARNING("Failed to dispatch to main thread!");
|
NS_WARNING("Failed to dispatch to main thread!");
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, Laye
|
|||||||
aRoot,
|
aRoot,
|
||||||
// aCompositor is null in gtest scenarios
|
// aCompositor is null in gtest scenarios
|
||||||
aCompositor ? aCompositor->RootLayerTreeId() : 0,
|
aCompositor ? aCompositor->RootLayerTreeId() : 0,
|
||||||
nullptr, nullptr,
|
gfx3DMatrix(), nullptr, nullptr,
|
||||||
aIsFirstPaint, aFirstPaintLayersId,
|
aIsFirstPaint, aFirstPaintLayersId,
|
||||||
&apzcsToDestroy);
|
&apzcsToDestroy);
|
||||||
}
|
}
|
||||||
@ -81,11 +81,15 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, Laye
|
|||||||
AsyncPanZoomController*
|
AsyncPanZoomController*
|
||||||
APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||||
Layer* aLayer, uint64_t aLayersId,
|
Layer* aLayer, uint64_t aLayersId,
|
||||||
|
gfx3DMatrix aTransform,
|
||||||
AsyncPanZoomController* aParent,
|
AsyncPanZoomController* aParent,
|
||||||
AsyncPanZoomController* aNextSibling,
|
AsyncPanZoomController* aNextSibling,
|
||||||
bool aIsFirstPaint, uint64_t aFirstPaintLayersId,
|
bool aIsFirstPaint, uint64_t aFirstPaintLayersId,
|
||||||
nsTArray< nsRefPtr<AsyncPanZoomController> >* aApzcsToDestroy)
|
nsTArray< nsRefPtr<AsyncPanZoomController> >* aApzcsToDestroy)
|
||||||
{
|
{
|
||||||
|
// Accumulate the CSS transform between layers that have an APZC
|
||||||
|
aTransform = aTransform * aLayer->GetTransform();
|
||||||
|
|
||||||
ContainerLayer* container = aLayer->AsContainerLayer();
|
ContainerLayer* container = aLayer->AsContainerLayer();
|
||||||
AsyncPanZoomController* controller = nullptr;
|
AsyncPanZoomController* controller = nullptr;
|
||||||
if (container) {
|
if (container) {
|
||||||
@ -116,13 +120,13 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
|||||||
controller->NotifyLayersUpdated(container->GetFrameMetrics(),
|
controller->NotifyLayersUpdated(container->GetFrameMetrics(),
|
||||||
aIsFirstPaint && (aLayersId == aFirstPaintLayersId));
|
aIsFirstPaint && (aLayersId == aFirstPaintLayersId));
|
||||||
|
|
||||||
gfx3DMatrix transform = container->GetEffectiveTransform();
|
|
||||||
LayerRect visible = container->GetFrameMetrics().mViewport * container->GetFrameMetrics().LayersPixelsPerCSSPixel();
|
LayerRect visible = container->GetFrameMetrics().mViewport * container->GetFrameMetrics().LayersPixelsPerCSSPixel();
|
||||||
gfxRect transformed = transform.TransformBounds(gfxRect(visible.x, visible.y, visible.width, visible.height));
|
controller->SetLayerHitTestData(visible, aTransform);
|
||||||
controller->SetVisibleRegion(transformed);
|
// Reset the accumulated transform once we hit a layer with an APZC
|
||||||
APZC_LOG("Setting rect(%f %f %f %f) as visible region for %p\n", transformed.x, transformed.y,
|
aTransform = gfx3DMatrix();
|
||||||
transformed.width, transformed.height,
|
APZC_LOG("Setting rect(%f %f %f %f) as visible region for APZC %p\n", visible.x, visible.y,
|
||||||
controller);
|
visible.width, visible.height,
|
||||||
|
controller);
|
||||||
|
|
||||||
// Bind the APZC instance into the tree of APZCs
|
// Bind the APZC instance into the tree of APZCs
|
||||||
if (aNextSibling) {
|
if (aNextSibling) {
|
||||||
@ -144,7 +148,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
|||||||
uint64_t childLayersId = (aLayer->AsRefLayer() ? aLayer->AsRefLayer()->GetReferentId() : aLayersId);
|
uint64_t childLayersId = (aLayer->AsRefLayer() ? aLayer->AsRefLayer()->GetReferentId() : aLayersId);
|
||||||
AsyncPanZoomController* next = nullptr;
|
AsyncPanZoomController* next = nullptr;
|
||||||
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
|
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
|
||||||
next = UpdatePanZoomControllerTree(aCompositor, child, childLayersId, aParent, next,
|
next = UpdatePanZoomControllerTree(aCompositor, child, childLayersId, aTransform, aParent, next,
|
||||||
aIsFirstPaint, aFirstPaintLayersId, aApzcsToDestroy);
|
aIsFirstPaint, aFirstPaintLayersId, aApzcsToDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,17 +370,21 @@ APZCTreeManager::FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableL
|
|||||||
AsyncPanZoomController*
|
AsyncPanZoomController*
|
||||||
APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, gfxPoint aHitTestPoint)
|
APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, gfxPoint aHitTestPoint)
|
||||||
{
|
{
|
||||||
|
gfx3DMatrix transform = gfx3DMatrix(aApzc->GetCurrentAsyncTransform()) * aApzc->GetCSSTransform();
|
||||||
|
gfx3DMatrix untransform = transform.Inverse();
|
||||||
|
gfxPoint untransformed = untransform.ProjectPoint(aHitTestPoint);
|
||||||
|
APZC_LOG("Untransformed %f %f to %f %f for APZC %p\n", aHitTestPoint.x, aHitTestPoint.y, untransformed.x, untransformed.y, aApzc);
|
||||||
|
|
||||||
// This walks the tree in depth-first, reverse order, so that it encounters
|
// This walks the tree in depth-first, reverse order, so that it encounters
|
||||||
// APZCs front-to-back on the screen.
|
// APZCs front-to-back on the screen.
|
||||||
ViewTransform apzcTransform = aApzc->GetCurrentAsyncTransform();
|
|
||||||
gfxPoint untransformed = gfx3DMatrix(apzcTransform).Inverse().ProjectPoint(aHitTestPoint);
|
|
||||||
for (AsyncPanZoomController* child = aApzc->GetLastChild(); child; child = child->GetPrevSibling()) {
|
for (AsyncPanZoomController* child = aApzc->GetLastChild(); child; child = child->GetPrevSibling()) {
|
||||||
AsyncPanZoomController* match = GetAPZCAtPoint(child, untransformed);
|
AsyncPanZoomController* match = GetAPZCAtPoint(child, untransformed);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aApzc->VisibleRegionContains(untransformed)) {
|
if (aApzc->VisibleRegionContains(LayerPoint(untransformed.x, untransformed.y))) {
|
||||||
|
APZC_LOG("Successfully matched untransformed point %f %f to visible region for APZC %p\n", untransformed.x, untransformed.y, aApzc);
|
||||||
return aApzc;
|
return aApzc;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -253,6 +253,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
AsyncPanZoomController* UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
AsyncPanZoomController* UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||||
Layer* aLayer, uint64_t aLayersId,
|
Layer* aLayer, uint64_t aLayersId,
|
||||||
|
gfx3DMatrix aTransform,
|
||||||
AsyncPanZoomController* aParent,
|
AsyncPanZoomController* aParent,
|
||||||
AsyncPanZoomController* aNextSibling,
|
AsyncPanZoomController* aNextSibling,
|
||||||
bool aIsFirstPaint,
|
bool aIsFirstPaint,
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "Axis.h"
|
#include "Axis.h"
|
||||||
#include "TaskThrottler.h"
|
#include "TaskThrottler.h"
|
||||||
#include "mozilla/layers/APZCTreeManager.h"
|
#include "mozilla/layers/APZCTreeManager.h"
|
||||||
|
#include "gfx3DMatrix.h"
|
||||||
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
|
|
||||||
@ -641,17 +642,28 @@ private:
|
|||||||
* hit-testing to see which APZC instance should handle touch events.
|
* hit-testing to see which APZC instance should handle touch events.
|
||||||
*/
|
*/
|
||||||
public:
|
public:
|
||||||
void SetVisibleRegion(gfxRect rect) { mVisibleRegion = rect; }
|
void SetLayerHitTestData(const LayerRect& aRect, const gfx3DMatrix& aTransform) {
|
||||||
|
mVisibleRect = aRect;
|
||||||
|
mCSSTransform = aTransform;
|
||||||
|
}
|
||||||
|
|
||||||
bool VisibleRegionContains(const gfxPoint& aPoint) const {
|
gfx3DMatrix GetCSSTransform() const {
|
||||||
return mVisibleRegion.Contains(aPoint.x, aPoint.y);
|
return mCSSTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VisibleRegionContains(const LayerPoint& aPoint) const {
|
||||||
|
return mVisibleRect.Contains(aPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* This is the viewport of the layer that this APZC corresponds to, but
|
/* This is the viewport of the layer that this APZC corresponds to, in
|
||||||
* post-transform. In other words, it is in the coordinate space of its
|
* layer pixels. It position here does not account for any transformations
|
||||||
* parent layer. */
|
* applied to any layers, whether they are CSS transforms or async
|
||||||
gfxRect mVisibleRegion;
|
* transforms. */
|
||||||
|
LayerRect mVisibleRect;
|
||||||
|
/* This is the cumulative layer transform from the parent APZC down to this
|
||||||
|
* one. */
|
||||||
|
gfx3DMatrix mCSSTransform;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -421,20 +421,20 @@ TEST(APZCTreeManager, GetAPZCAtPoint) {
|
|||||||
gfx3DMatrix transform;
|
gfx3DMatrix transform;
|
||||||
transform.ScalePost(0.1, 0.1, 1);
|
transform.ScalePost(0.1, 0.1, 1);
|
||||||
root->SetBaseTransform(transform);
|
root->SetBaseTransform(transform);
|
||||||
root->ComputeEffectiveTransforms(gfx3DMatrix());
|
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
||||||
hit = manager->GetTargetAPZC(ScreenPoint(50, 50)); // This point is now outside the root layer
|
hit = manager->GetTargetAPZC(ScreenPoint(50, 50)); // This point is now outside the root layer
|
||||||
EXPECT_EQ(nullAPZC, hit.get());
|
EXPECT_EQ(nullAPZC, hit.get());
|
||||||
|
|
||||||
|
// This hit test will hit both layers[3] and layers[4]; layers[4] is later in the tree so
|
||||||
|
// it is a better match
|
||||||
hit = manager->GetTargetAPZC(ScreenPoint(2, 2));
|
hit = manager->GetTargetAPZC(ScreenPoint(2, 2));
|
||||||
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||||
// expect hit point at LayerPoint(20, 20)
|
// expect hit point at LayerPoint(20, 20)
|
||||||
|
|
||||||
// Scale layer[4] outside the range
|
// Scale layer[4] outside the range
|
||||||
layers[4]->SetBaseTransform(transform);
|
layers[4]->SetBaseTransform(transform);
|
||||||
// layer 4 effective visible screenrect: (0.05, 0.05, 0.2, 0.2)
|
// layer 4 effective visible screenrect: (0.05, 0.05, 0.2, 0.2)
|
||||||
// Does not contain (2, 2)
|
// Does not contain (2, 2)
|
||||||
root->ComputeEffectiveTransforms(gfx3DMatrix());
|
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
||||||
hit = manager->GetTargetAPZC(ScreenPoint(2, 2));
|
hit = manager->GetTargetAPZC(ScreenPoint(2, 2));
|
||||||
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||||
@ -455,7 +455,6 @@ TEST(APZCTreeManager, GetAPZCAtPoint) {
|
|||||||
translateTransform3.ScalePost(1,15,1);
|
translateTransform3.ScalePost(1,15,1);
|
||||||
layers[7]->SetBaseTransform(translateTransform3);
|
layers[7]->SetBaseTransform(translateTransform3);
|
||||||
|
|
||||||
root->ComputeEffectiveTransforms(gfx3DMatrix());
|
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
|
||||||
// layer 7 effective visible screenrect (0,16,4,60) but clipped by parent layers
|
// layer 7 effective visible screenrect (0,16,4,60) but clipped by parent layers
|
||||||
hit = manager->GetTargetAPZC(ScreenPoint(1, 45));
|
hit = manager->GetTargetAPZC(ScreenPoint(1, 45));
|
||||||
|
@ -524,8 +524,27 @@ AnimationThread(void *)
|
|||||||
display->QueueBuffer(buf);
|
display->QueueBuffer(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(vaddr, frame.buf,
|
|
||||||
frame.width * frame.height * frame.bytepp);
|
if (buf->height == frame.height && buf->width == frame.width) {
|
||||||
|
memcpy(vaddr, frame.buf,
|
||||||
|
frame.width * frame.height * frame.bytepp);
|
||||||
|
} else if (buf->height >= frame.height &&
|
||||||
|
buf->width >= frame.width) {
|
||||||
|
int startx = (buf->width - frame.width) / 2;
|
||||||
|
int starty = (buf->height - frame.height) / 2;
|
||||||
|
|
||||||
|
int src_stride = frame.width * frame.bytepp;
|
||||||
|
int dst_stride = buf->stride * frame.bytepp;
|
||||||
|
|
||||||
|
char *src = frame.buf;
|
||||||
|
char *dst = (char *) vaddr + starty * dst_stride + startx * frame.bytepp;
|
||||||
|
|
||||||
|
for (int i = 0; i < frame.height; i++) {
|
||||||
|
memcpy(dst, src, src_stride);
|
||||||
|
src += src_stride;
|
||||||
|
dst += dst_stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
grmodule->unlock(grmodule, buf->handle);
|
grmodule->unlock(grmodule, buf->handle);
|
||||||
|
|
||||||
gettimeofday(&tv2, nullptr);
|
gettimeofday(&tv2, nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user