Squashed commit of the following:

commit 35cc68814a9537c31fde146e171e7b0bbdfe211e
Author: Andreas Huber <andih@google.com>
Date:   Mon Aug 16 08:48:42 2010 -0700

    Only enable support for yuv to yuv conversion on passion, where it's available, use the slower yuv->rgb565 path everywhere else.

commit d8ac5a8814103e60d11d2acf61997fc31a1dc58d
Author: Andreas Huber <andih@google.com>
Date:   Fri Aug 13 13:56:44 2010 -0700

    The software renderer takes over all rendering, converting from yuv to yuv if possible and rgb565 otherwise.

commit 684972074b74318bdcb826ed9b5b0864d2d2e273
Author: Andreas Huber <andih@google.com>
Date:   Fri Aug 13 09:34:35 2010 -0700

    A first shot at supporting the new rendering APIs.

Change-Id: Iea9b32856da46950501f1a700f616b5feac710fd
This commit is contained in:
Andreas Huber 2010-08-16 08:49:37 -07:00
parent 76c043ad04
commit 8b42e8a5d8
3 changed files with 24 additions and 20 deletions

View File

@ -178,6 +178,7 @@ private:
// MediaPlayer needs access to ISurface for display // MediaPlayer needs access to ISurface for display
friend class MediaPlayer; friend class MediaPlayer;
friend class IOMX; friend class IOMX;
friend class SoftwareRenderer;
// this is just to be able to write some unit tests // this is just to be able to write some unit tests
friend class Test; friend class Test;

View File

@ -22,7 +22,7 @@ LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
ifeq ($(TARGET_BOARD_PLATFORM), omap3) ifeq ($(TARGET_BOARD_PLATFORM), omap3)
LOCAL_CFLAGS += -DNO_RGBX_8888 LOCAL_CFLAGS += -DNO_RGBX_8888 -DHAS_PUSH_BUFFERS
endif endif
# need "-lrt" on Linux simulator to pick up clock_gettime # need "-lrt" on Linux simulator to pick up clock_gettime

View File

@ -165,7 +165,7 @@ void SurfaceFlinger::bootFinished()
{ {
const nsecs_t now = systemTime(); const nsecs_t now = systemTime();
const nsecs_t duration = now - mBootTime; const nsecs_t duration = now - mBootTime;
LOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) ); LOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
mBootFinished = true; mBootFinished = true;
property_set("ctl.stop", "bootanim"); property_set("ctl.stop", "bootanim");
} }
@ -201,10 +201,10 @@ status_t SurfaceFlinger::readyToRun()
mServerHeap = new MemoryHeapBase(4096, mServerHeap = new MemoryHeapBase(4096,
MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap"); MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap");
LOGE_IF(mServerHeap==0, "can't create shared memory dealer"); LOGE_IF(mServerHeap==0, "can't create shared memory dealer");
mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase()); mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase());
LOGE_IF(mServerCblk==0, "can't get to shared control block's address"); LOGE_IF(mServerCblk==0, "can't get to shared control block's address");
new(mServerCblk) surface_flinger_cblk_t; new(mServerCblk) surface_flinger_cblk_t;
// initialize primary screen // initialize primary screen
@ -233,7 +233,7 @@ status_t SurfaceFlinger::readyToRun()
// Initialize OpenGL|ES // Initialize OpenGL|ES
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ALIGNMENT, 4);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glShadeModel(GL_FLAT); glShadeModel(GL_FLAT);
@ -267,7 +267,7 @@ status_t SurfaceFlinger::readyToRun()
// start boot animation // start boot animation
property_set("ctl.start", "bootanim"); property_set("ctl.start", "bootanim");
return NO_ERROR; return NO_ERROR;
} }
@ -662,7 +662,7 @@ void SurfaceFlinger::computeVisibleRegions(
// Update aboveOpaqueLayers for next (lower) layer // Update aboveOpaqueLayers for next (lower) layer
aboveOpaqueLayers.orSelf(opaqueRegion); aboveOpaqueLayers.orSelf(opaqueRegion);
// Store the visible region is screen space // Store the visible region is screen space
layer->setVisibleRegion(visibleRegion); layer->setVisibleRegion(visibleRegion);
layer->setCoveredRegion(coveredRegion); layer->setCoveredRegion(coveredRegion);
@ -781,8 +781,8 @@ void SurfaceFlinger::handleRepaint()
glLoadIdentity(); glLoadIdentity();
uint32_t flags = hw.getFlags(); uint32_t flags = hw.getFlags();
if ((flags & DisplayHardware::SWAP_RECTANGLE) || if ((flags & DisplayHardware::SWAP_RECTANGLE) ||
(flags & DisplayHardware::BUFFER_PRESERVED)) (flags & DisplayHardware::BUFFER_PRESERVED))
{ {
// we can redraw only what's dirty, but since SWAP_RECTANGLE only // we can redraw only what's dirty, but since SWAP_RECTANGLE only
// takes a rectangle, we must make sure to update that whole // takes a rectangle, we must make sure to update that whole
@ -1129,7 +1129,7 @@ void SurfaceFlinger::closeGlobalTransaction()
if (android_atomic_dec(&mTransactionCount) == 1) { if (android_atomic_dec(&mTransactionCount) == 1) {
signalEvent(); signalEvent();
// if there is a transaction with a resize, wait for it to // if there is a transaction with a resize, wait for it to
// take effect before returning. // take effect before returning.
Mutex::Autolock _l(mStateLock); Mutex::Autolock _l(mStateLock);
while (mResizeTransationPending) { while (mResizeTransationPending) {
@ -1173,7 +1173,7 @@ status_t SurfaceFlinger::unfreezeDisplay(DisplayID dpy, uint32_t flags)
return NO_ERROR; return NO_ERROR;
} }
int SurfaceFlinger::setOrientation(DisplayID dpy, int SurfaceFlinger::setOrientation(DisplayID dpy,
int orientation, uint32_t flags) int orientation, uint32_t flags)
{ {
if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
@ -1206,14 +1206,17 @@ sp<ISurface> SurfaceFlinger::createSurface(const sp<Client>& client, int pid,
int(w), int(h)); int(w), int(h));
return surfaceHandle; return surfaceHandle;
} }
//LOGD("createSurface for pid %d (%d x %d)", pid, w, h); //LOGD("createSurface for pid %d (%d x %d)", pid, w, h);
sp<Layer> normalLayer; sp<Layer> normalLayer;
switch (flags & eFXSurfaceMask) { switch (flags & eFXSurfaceMask) {
case eFXSurfaceNormal: case eFXSurfaceNormal:
#if HAS_PUSH_BUFFERS
if (UNLIKELY(flags & ePushBuffers)) { if (UNLIKELY(flags & ePushBuffers)) {
layer = createPushBuffersSurface(client, d, w, h, flags); layer = createPushBuffersSurface(client, d, w, h, flags);
} else { } else
#endif
{
normalLayer = createNormalSurface(client, d, w, h, flags, format); normalLayer = createNormalSurface(client, d, w, h, flags, format);
layer = normalLayer; layer = normalLayer;
} }
@ -1232,7 +1235,7 @@ sp<ISurface> SurfaceFlinger::createSurface(const sp<Client>& client, int pid,
ssize_t token = addClientLayer(client, layer); ssize_t token = addClientLayer(client, layer);
surfaceHandle = layer->getSurface(); surfaceHandle = layer->getSurface();
if (surfaceHandle != 0) { if (surfaceHandle != 0) {
params->token = token; params->token = token;
params->identity = surfaceHandle->getIdentity(); params->identity = surfaceHandle->getIdentity();
params->width = w; params->width = w;
@ -1316,7 +1319,7 @@ status_t SurfaceFlinger::removeSurface(const sp<Client>& client, SurfaceID sid)
/* /*
* called by the window manager, when a surface should be marked for * called by the window manager, when a surface should be marked for
* destruction. * destruction.
* *
* The surface is removed from the current and drawing lists, but placed * The surface is removed from the current and drawing lists, but placed
* in the purgatory queue, so it's not destroyed right-away (we need * in the purgatory queue, so it's not destroyed right-away (we need
* to wait for all client's references to go away first). * to wait for all client's references to go away first).
@ -1337,7 +1340,7 @@ status_t SurfaceFlinger::removeSurface(const sp<Client>& client, SurfaceID sid)
status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer) status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer)
{ {
// called by ~ISurface() when all references are gone // called by ~ISurface() when all references are gone
class MessageDestroySurface : public MessageBase { class MessageDestroySurface : public MessageBase {
SurfaceFlinger* flinger; SurfaceFlinger* flinger;
sp<LayerBaseClient> layer; sp<LayerBaseClient> layer;
@ -1350,9 +1353,9 @@ status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer)
layer.clear(); // clear it outside of the lock; layer.clear(); // clear it outside of the lock;
Mutex::Autolock _l(flinger->mStateLock); Mutex::Autolock _l(flinger->mStateLock);
/* /*
* remove the layer from the current list -- chances are that it's * remove the layer from the current list -- chances are that it's
* not in the list anyway, because it should have been removed * not in the list anyway, because it should have been removed
* already upon request of the client (eg: window manager). * already upon request of the client (eg: window manager).
* However, a buggy client could have not done that. * However, a buggy client could have not done that.
* Since we know we don't have any more clients, we don't need * Since we know we don't have any more clients, we don't need
* to use the purgatory. * to use the purgatory.
@ -1467,7 +1470,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
} }
const bool locked(retry >= 0); const bool locked(retry >= 0);
if (!locked) { if (!locked) {
snprintf(buffer, SIZE, snprintf(buffer, SIZE,
"SurfaceFlinger appears to be unresponsive, " "SurfaceFlinger appears to be unresponsive, "
"dumping anyways (no locks held)\n"); "dumping anyways (no locks held)\n");
result.append(buffer); result.append(buffer);