Merge "Use physical memory for software rendering to take a fast path through surface flinger if possible."

This commit is contained in:
Andreas Huber
2010-02-01 13:02:58 -08:00
committed by Android (Google) Code Review

View File

@@ -20,6 +20,7 @@
#include "../include/SoftwareRenderer.h"
#include <binder/MemoryHeapBase.h>
#include <binder/MemoryHeapPmem.h>
#include <media/stagefright/MediaDebug.h>
#include <ui/ISurface.h>
@@ -38,8 +39,16 @@ SoftwareRenderer::SoftwareRenderer(
mDecodedWidth(decodedWidth),
mDecodedHeight(decodedHeight),
mFrameSize(mDecodedWidth * mDecodedHeight * 2), // RGB565
mMemoryHeap(new MemoryHeapBase(2 * mFrameSize)),
mIndex(0) {
// TODO: How do I allocate physical memory on Droid?
mMemoryHeap = new MemoryHeapBase("/dev/pmem_adsp", 2 * mFrameSize);
if (mMemoryHeap->heapID() < 0) {
LOGI("Creating physical memory heap failed, reverting to regular heap.");
mMemoryHeap = new MemoryHeapBase(2 * mFrameSize);
} else {
mMemoryHeap = new MemoryHeapPmem(mMemoryHeap);
}
CHECK(mISurface.get() != NULL);
CHECK(mDecodedWidth > 0);
CHECK(mDecodedHeight > 0);