--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ 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.
+-->
+<!-- Adds the feature indicating support for the Bluetooth Low Energy API -->
+<permissions>
+ <feature name="android.hardware.bluetooth_le" />
+</permissions>
// dump our state in a String
virtual void dump(String8& result) const;
- virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
+ virtual void dump(String8& result, const char* prefix) const;
// public facing structure for BufferSlot
struct BufferItem {
// their state to the dump by overriding the dumpLocked method, which is
// called by these methods after locking the mutex.
void dump(String8& result) const;
- void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
+ void dump(String8& result, const char* prefix) const;
// setFrameAvailableListener sets the listener object that will be notified
// when a new frame becomes available.
// should call ConsumerBase::dumpLocked.
//
// This method must be called with mMutex locked.
- virtual void dumpLocked(String8& result, const char* prefix, char* buffer,
- size_t size) const;
+ virtual void dumpLocked(String8& result, const char* prefix) const;
// acquireBufferLocked fetches the next buffer from the BufferQueue and
// updates the buffer slot for the buffer returned.
// dumpLocked overrides the ConsumerBase method to dump GLConsumer-
// specific info in addition to the ConsumerBase behavior.
- virtual void dumpLocked(String8& result, const char* prefix, char* buffer,
- size_t size) const;
+ virtual void dumpLocked(String8& result, const char* prefix) const;
// acquireBufferLocked overrides the ConsumerBase method to update the
// mEglSlots array in addition to the ConsumerBase behavior.
uint32_t mCurrentTransform;
// mCurrentScalingMode is the scaling mode for the current texture. It gets
- // set to each time updateTexImage is called.
+ // set each time updateTexImage is called.
uint32_t mCurrentScalingMode;
// mCurrentFence is the fence received from BufferQueue in updateTexImage.
return err;
}
-void BufferQueue::dump(String8& result) const
-{
- char buffer[1024];
- BufferQueue::dump(result, "", buffer, 1024);
+void BufferQueue::dump(String8& result) const {
+ BufferQueue::dump(result, "");
}
-void BufferQueue::dump(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const
-{
+void BufferQueue::dump(String8& result, const char* prefix) const {
Mutex::Autolock _l(mMutex);
String8 fifo;
int fifoSize = 0;
Fifo::const_iterator i(mQueue.begin());
while (i != mQueue.end()) {
- snprintf(buffer, SIZE, "%02d ", *i++);
- fifoSize++;
- fifo.append(buffer);
+ fifo.appendFormat("%02d ", *i++);
+ fifoSize++;
}
int maxBufferCount = getMaxBufferCountLocked();
- snprintf(buffer, SIZE,
+ result.appendFormat(
"%s-BufferQueue maxBufferCount=%d, mSynchronousMode=%d, default-size=[%dx%d], "
"default-format=%d, transform-hint=%02x, FIFO(%d)={%s}\n",
prefix, maxBufferCount, mSynchronousMode, mDefaultWidth,
mDefaultHeight, mDefaultBufferFormat, mTransformHint,
fifoSize, fifo.string());
- result.append(buffer);
-
struct {
const char * operator()(int state) const {
for (int i=0 ; i<maxBufferCount ; i++) {
const BufferSlot& slot(mSlots[i]);
- snprintf(buffer, SIZE,
+ result.appendFormat(
"%s%s[%02d] "
"state=%-8s, crop=[%d,%d,%d,%d], "
"xform=0x%02x, time=%#llx, scale=%s",
slot.mCrop.bottom, slot.mTransform, slot.mTimestamp,
scalingModeName(slot.mScalingMode)
);
- result.append(buffer);
const sp<GraphicBuffer>& buf(slot.mGraphicBuffer);
if (buf != NULL) {
- snprintf(buffer, SIZE,
+ result.appendFormat(
", %p [%4ux%4u:%4u,%3X]",
buf->handle, buf->width, buf->height, buf->stride,
buf->format);
- result.append(buffer);
}
result.append("\n");
}
}
void ConsumerBase::dump(String8& result) const {
- char buffer[1024];
- dump(result, "", buffer, 1024);
+ dump(result, "");
}
-void ConsumerBase::dump(String8& result, const char* prefix,
- char* buffer, size_t size) const {
+void ConsumerBase::dump(String8& result, const char* prefix) const {
Mutex::Autolock _l(mMutex);
- dumpLocked(result, prefix, buffer, size);
+ dumpLocked(result, prefix);
}
-void ConsumerBase::dumpLocked(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const {
- snprintf(buffer, SIZE, "%smAbandoned=%d\n", prefix, int(mAbandoned));
- result.append(buffer);
+void ConsumerBase::dumpLocked(String8& result, const char* prefix) const {
+ result.appendFormat("%smAbandoned=%d\n", prefix, int(mAbandoned));
if (!mAbandoned) {
- mBufferQueue->dump(result, prefix, buffer, SIZE);
+ mBufferQueue->dump(result, prefix);
}
}
GLenum texTarget, bool useFenceSync, const sp<BufferQueue> &bufferQueue) :
ConsumerBase(bufferQueue == 0 ? new BufferQueue(allowSynchronousMode) : bufferQueue),
mCurrentTransform(0),
+ mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mCurrentFence(Fence::NO_FENCE),
mCurrentTimestamp(0),
+ mDefaultWidth(1),
+ mDefaultHeight(1),
mFilteringEnabled(true),
mTexName(tex),
mUseFenceSync(useFenceSync),
return mBufferQueue->setSynchronousMode(enabled);
}
-void GLConsumer::dumpLocked(String8& result, const char* prefix,
- char* buffer, size_t size) const
+void GLConsumer::dumpLocked(String8& result, const char* prefix) const
{
- snprintf(buffer, size,
+ result.appendFormat(
"%smTexName=%d mCurrentTexture=%d\n"
"%smCurrentCrop=[%d,%d,%d,%d] mCurrentTransform=%#x\n",
prefix, mTexName, mCurrentTexture, prefix, mCurrentCrop.left,
mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
mCurrentTransform);
- result.append(buffer);
- ConsumerBase::dumpLocked(result, prefix, buffer, size);
+ ConsumerBase::dumpLocked(result, prefix);
}
static void mtxMul(float out[16], const float a[16], const float b[16]) {
if (sscanf(line, "%u %u %s", &dpy, &impl, tag) == 3) {
//ALOGD(">>> %u %u %s", dpy, impl, tag);
// We only load the h/w accelerated implementation
- if (tag != String8("android")) {
+ if (String8("android") != tag) {
mDriverTag = tag;
}
}
--- /dev/null
+/*
+ * Copyright 2013 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef ANDROID_SURFACE_FLINGER_COLORIZER_H
+#define ANDROID_SURFACE_FLINGER_COLORIZER_H
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+class Colorizer {
+ bool mEnabled;
+public:
+ enum color {
+ RED = 31,
+ GREEN = 32,
+ YELLOW = 33,
+ BLUE = 34,
+ MAGENTA = 35,
+ CYAN = 36,
+ WHITE = 37
+ };
+
+ Colorizer(bool enabled)
+ : mEnabled(enabled) {
+ }
+
+ void colorize(String8& out, color c) {
+ if (mEnabled) {
+ out.appendFormat("\e[%dm", c);
+ }
+ }
+
+ void bold(String8& out) {
+ if (mEnabled) {
+ out.append("\e[1m");
+ }
+ }
+
+ void reset(String8& out) {
+ if (mEnabled) {
+ out.append("\e[0m");
+ }
+ }
+};
+
+// ---------------------------------------------------------------------------
+
+}; // namespace android
+
+
+#endif /* ANDROID_SURFACE_FLINGER_COLORIZER_H */
mFrame = frame;
}
-void DisplayDevice::dump(String8& result, char* buffer, size_t SIZE) const {
+void DisplayDevice::dump(String8& result) const {
const Transform& tr(mGlobalTransform);
- snprintf(buffer, SIZE,
+ result.appendFormat(
"+ DisplayDevice: %s\n"
" type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
"flips=%u, isSecure=%d, secureVis=%d, acquired=%d, numLayers=%u\n"
tr[0][1], tr[1][1], tr[2][1],
tr[0][2], tr[1][2], tr[2][2]);
- result.append(buffer);
-
String8 surfaceDump;
mDisplaySurface->dump(surfaceDump);
result.append(surfaceDump);
* Debugging
*/
uint32_t getPageFlipCount() const;
- void dump(String8& result, char* buffer, size_t SIZE) const;
+ void dump(String8& result) const;
private:
/*
ConsumerBase::dump(result);
}
-void FramebufferSurface::dumpLocked(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const
+void FramebufferSurface::dumpLocked(String8& result, const char* prefix) const
{
mHwc.fbDump(result);
- ConsumerBase::dumpLocked(result, prefix, buffer, SIZE);
+ ConsumerBase::dumpLocked(result, prefix);
}
// ----------------------------------------------------------------------------
virtual void onFrameAvailable();
virtual void freeBufferLocked(int slotIndex);
- virtual void dumpLocked(String8& result, const char* prefix,
- char* buffer, size_t SIZE) const;
+ virtual void dumpLocked(String8& result, const char* prefix) const;
// nextBuffer waits for and then latches the next buffer from the
// BufferQueue and releases the previously latched buffer to the
// triggers a Surface::queueBuffer() on some
// devices (!?) -- log and ignore.
ALOGE("HWComposer: framebufferTarget is null");
-// CallStack stack;
-// stack.update();
-// stack.dump("");
return NO_ERROR;
}
return getLayerIterator(id, numLayers);
}
-void HWComposer::dump(String8& result, char* buffer, size_t SIZE) const {
+void HWComposer::dump(String8& result) const {
if (mHwc) {
result.appendFormat("Hardware Composer state (version %8x):\n", hwcApiVersion(mHwc));
result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
}
if (mHwc && mHwc->dump) {
+ const size_t SIZE = 4096;
+ char buffer[SIZE];
mHwc->dump(mHwc, buffer, SIZE);
result.append(buffer);
}
friend class VSyncThread;
// for debugging ----------------------------------------------------------
- void dump(String8& out, char* scratch, size_t SIZE) const;
+ void dump(String8& out) const;
private:
void loadHwcModule();
mDebugVsyncEnabled = false;
}
-void EventThread::dump(String8& result, char* buffer, size_t SIZE) const {
+void EventThread::dump(String8& result) const {
Mutex::Autolock _l(mLock);
result.appendFormat("VSYNC state: %s\n",
mDebugVsyncEnabled?"enabled":"disabled");
Vector< sp<EventThread::Connection> > waitForEvent(
DisplayEventReceiver::Event* event);
- void dump(String8& result, char* buffer, size_t SIZE) const;
+ void dump(String8& result) const;
private:
virtual bool threadLoop();
#include <gui/Surface.h>
#include "clz.h"
+#include "Colorizer.h"
#include "DisplayDevice.h"
#include "GLExtensions.h"
#include "Layer.h"
// debugging
// ----------------------------------------------------------------------------
-void Layer::dump(String8& result, char* buffer, size_t SIZE) const
+void Layer::dump(String8& result, Colorizer& colorizer) const
{
const Layer::State& s(drawingState());
- snprintf(buffer, SIZE,
+ colorizer.colorize(result, Colorizer::GREEN);
+ result.appendFormat(
"+ %s %p (%s)\n",
getTypeId(), this, getName().string());
- result.append(buffer);
+ colorizer.reset(result);
s.activeTransparentRegion.dump(result, "transparentRegion");
visibleRegion.dump(result, "visibleRegion");
sp<Client> client(mClientRef.promote());
- snprintf(buffer, SIZE,
- " "
+ result.appendFormat( " "
"layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), "
"isOpaque=%1d, invalidate=%1d, "
"alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n"
s.transform[0][0], s.transform[0][1],
s.transform[1][0], s.transform[1][1],
client.get());
- result.append(buffer);
sp<const GraphicBuffer> buf0(mActiveBuffer);
uint32_t w0=0, h0=0, s0=0, f0=0;
s0 = buf0->getStride();
f0 = buf0->format;
}
- snprintf(buffer, SIZE,
+ result.appendFormat(
" "
"format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
" queued-frames=%d, mRefreshPending=%d\n",
mFormat, w0, h0, s0,f0,
mQueuedFrames, mRefreshPending);
- result.append(buffer);
-
if (mSurfaceFlingerConsumer != 0) {
- mSurfaceFlingerConsumer->dump(result, " ", buffer, SIZE);
+ mSurfaceFlingerConsumer->dump(result, " ");
}
}
-
-void Layer::shortDump(String8& result, char* scratch, size_t size) const {
- Layer::dump(result, scratch, size);
-}
-
-void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const {
+void Layer::dumpStats(String8& result) const {
mFrameTracker.dump(result);
}
// ---------------------------------------------------------------------------
class Client;
+class Colorizer;
class DisplayDevice;
class GraphicBuffer;
class SurfaceFlinger;
/* always call base class first */
- virtual void dump(String8& result, char* scratch, size_t size) const;
- virtual void shortDump(String8& result, char* scratch, size_t size) const;
- virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const;
+ virtual void dump(String8& result, Colorizer& colorizer) const;
+ virtual void dumpStats(String8& result) const;
virtual void clearStats();
protected:
#include <private/android_filesystem_config.h>
#include <private/gui/SyncFeatures.h>
+#include "Client.h"
#include "clz.h"
+#include "Colorizer.h"
#include "DdmConnection.h"
#include "DisplayDevice.h"
-#include "Client.h"
#include "EventThread.h"
#include "GLExtensions.h"
#include "Layer.h"
status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
{
- const size_t SIZE = 4096;
- char buffer[SIZE];
String8 result;
-
IPCThreadState* ipc = IPCThreadState::self();
const int pid = ipc->getCallingPid();
const int uid = ipc->getCallingUid();
if ((uid != AID_SHELL) &&
!PermissionCache::checkPermission(sDump, pid, uid)) {
- snprintf(buffer, SIZE, "Permission Denial: "
+ result.appendFormat("Permission Denial: "
"can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid);
- result.append(buffer);
} else {
// Try to get the main lock, but don't insist if we can't
// (this would indicate SF is stuck, but we want to be able to
}
const bool locked(retry >= 0);
if (!locked) {
- snprintf(buffer, SIZE,
+ result.append(
"SurfaceFlinger appears to be unresponsive, "
"dumping anyways (no locks held)\n");
- result.append(buffer);
}
bool dumpAll = true;
if ((index < numArgs) &&
(args[index] == String16("--list"))) {
index++;
- listLayersLocked(args, index, result, buffer, SIZE);
+ listLayersLocked(args, index, result);
dumpAll = false;
}
if ((index < numArgs) &&
(args[index] == String16("--latency"))) {
index++;
- dumpStatsLocked(args, index, result, buffer, SIZE);
+ dumpStatsLocked(args, index, result);
dumpAll = false;
}
if ((index < numArgs) &&
(args[index] == String16("--latency-clear"))) {
index++;
- clearStatsLocked(args, index, result, buffer, SIZE);
+ clearStatsLocked(args, index, result);
dumpAll = false;
}
}
if (dumpAll) {
- dumpAllLocked(result, buffer, SIZE);
+ dumpAllLocked(args, index, result);
}
if (locked) {
}
void SurfaceFlinger::listLayersLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const
+ String8& result) const
{
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
const size_t count = currentLayers.size();
for (size_t i=0 ; i<count ; i++) {
const sp<Layer>& layer(currentLayers[i]);
- snprintf(buffer, SIZE, "%s\n", layer->getName().string());
- result.append(buffer);
+ result.appendFormat("%s\n", layer->getName().string());
}
}
void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const
+ String8& result) const
{
String8 name;
if (index < args.size()) {
for (size_t i=0 ; i<count ; i++) {
const sp<Layer>& layer(currentLayers[i]);
if (name == layer->getName()) {
- layer->dumpStats(result, buffer, SIZE);
+ layer->dumpStats(result);
}
}
}
}
void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE)
+ String8& result)
{
String8 name;
if (index < args.size()) {
result.append(config);
}
-void SurfaceFlinger::dumpAllLocked(
- String8& result, char* buffer, size_t SIZE) const
+void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index,
+ String8& result) const
{
+ bool colorize = false;
+ if (index < args.size()
+ && (args[index] == String16("--color"))) {
+ colorize = true;
+ index++;
+ }
+
+ Colorizer colorizer(colorize);
+
// figure out if we're stuck somewhere
const nsecs_t now = systemTime();
const nsecs_t inSwapBuffers(mDebugInSwapBuffers);
/*
* Dump library configuration.
*/
+
+ colorizer.bold(result);
result.append("Build configuration:");
+ colorizer.reset(result);
appendSfConfigString(result);
appendUiConfigString(result);
appendGuiConfigString(result);
result.append("\n");
+ colorizer.bold(result);
result.append("Sync configuration: ");
+ colorizer.reset(result);
result.append(SyncFeatures::getInstance().toString());
result.append("\n");
*/
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
const size_t count = currentLayers.size();
- snprintf(buffer, SIZE, "Visible layers (count = %d)\n", count);
- result.append(buffer);
+ colorizer.bold(result);
+ result.appendFormat("Visible layers (count = %d)\n", count);
+ colorizer.reset(result);
for (size_t i=0 ; i<count ; i++) {
const sp<Layer>& layer(currentLayers[i]);
- layer->dump(result, buffer, SIZE);
+ layer->dump(result, colorizer);
}
/*
* Dump Display state
*/
- snprintf(buffer, SIZE, "Displays (%d entries)\n", mDisplays.size());
- result.append(buffer);
+ colorizer.bold(result);
+ result.appendFormat("Displays (%d entries)\n", mDisplays.size());
+ colorizer.reset(result);
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
const sp<const DisplayDevice>& hw(mDisplays[dpy]);
- hw->dump(result, buffer, SIZE);
+ hw->dump(result);
}
/*
* Dump SurfaceFlinger global state
*/
- snprintf(buffer, SIZE, "SurfaceFlinger global state:\n");
- result.append(buffer);
+ colorizer.bold(result);
+ result.append("SurfaceFlinger global state:\n");
+ colorizer.reset(result);
HWComposer& hwc(getHwComposer());
sp<const DisplayDevice> hw(getDefaultDisplayDevice());
const GLExtensions& extensions(GLExtensions::getInstance());
- snprintf(buffer, SIZE, "EGL implementation : %s\n",
+ colorizer.bold(result);
+ result.appendFormat("EGL implementation : %s\n",
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_VERSION));
- result.append(buffer);
- snprintf(buffer, SIZE, "%s\n",
+ colorizer.reset(result);
+ result.appendFormat("%s\n",
eglQueryStringImplementationANDROID(mEGLDisplay, EGL_EXTENSIONS));
- result.append(buffer);
- snprintf(buffer, SIZE, "GLES: %s, %s, %s\n",
+ colorizer.bold(result);
+ result.appendFormat("GLES: %s, %s, %s\n",
extensions.getVendor(),
extensions.getRenderer(),
extensions.getVersion());
- result.append(buffer);
- snprintf(buffer, SIZE, "%s\n", extensions.getExtension());
- result.append(buffer);
+ colorizer.reset(result);
+ result.appendFormat("%s\n", extensions.getExtension());
hw->undefinedRegion.dump(result, "undefinedRegion");
- snprintf(buffer, SIZE,
- " orientation=%d, canDraw=%d\n",
+ result.appendFormat(" orientation=%d, canDraw=%d\n",
hw->getOrientation(), hw->canDraw());
- result.append(buffer);
- snprintf(buffer, SIZE,
+ result.appendFormat(
" last eglSwapBuffers() time: %f us\n"
" last transaction time : %f us\n"
" transaction-flags : %08x\n"
hwc.getDpiY(HWC_DISPLAY_PRIMARY),
mEGLNativeVisualId,
!mGpuToCpuSupported);
- result.append(buffer);
- snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n",
+ result.appendFormat(" eglSwapBuffers time: %f us\n",
inSwapBuffersDuration/1000.0);
- result.append(buffer);
- snprintf(buffer, SIZE, " transaction time: %f us\n",
+ result.appendFormat(" transaction time: %f us\n",
inTransactionDuration/1000.0);
- result.append(buffer);
/*
* VSYNC state
*/
- mEventThread->dump(result, buffer, SIZE);
+ mEventThread->dump(result);
/*
* Dump HWComposer state
*/
- snprintf(buffer, SIZE, "h/w composer state:\n");
- result.append(buffer);
- snprintf(buffer, SIZE, " h/w composer %s and %s\n",
+ colorizer.bold(result);
+ result.append("h/w composer state:\n");
+ colorizer.reset(result);
+ result.appendFormat(" h/w composer %s and %s\n",
hwc.initCheck()==NO_ERROR ? "present" : "not present",
(mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
- result.append(buffer);
- hwc.dump(result, buffer, SIZE);
+ hwc.dump(result);
/*
* Dump gralloc state
* Debugging & dumpsys
*/
void listLayersLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const;
+ String8& result) const;
void dumpStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE) const;
+ String8& result) const;
void clearStatsLocked(const Vector<String16>& args, size_t& index,
- String8& result, char* buffer, size_t SIZE);
- void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const;
+ String8& result);
+ void dumpAllLocked(const Vector<String16>& args, size_t& index,
+ String8& result) const;
bool startDdmConnection();
static void appendSfConfigString(String8& result);