Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/kali' into ics
Browse files Browse the repository at this point in the history
Conflicts:
	libs/gui/SurfaceTextureClient.cpp
	services/surfaceflinger/Layer.cpp
	services/surfaceflinger/SurfaceTextureLayer.cpp

Change-Id: Ib353e7d86411c0a3ceb5ecdb75c40a7b7842da15
  • Loading branch information
rmcc committed May 14, 2012
2 parents f7ca510 + 1f8f448 commit add0200
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 136 deletions.
31 changes: 30 additions & 1 deletion cmds/hdmid/HDMIDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ namespace android {
#define SYSFS_HPD DEVICE_ROOT "/" DEVICE_NODE "/hpd"
#define SYSFS_HDCP_PRESENT DEVICE_ROOT "/" DEVICE_NODE "/hdcp_present"

#ifdef QCOM_HARDWARE
//Should match to the external_display_type HDMI in QComUI
#define EXT_DISPLAY_HDMI 1
#endif

HDMIDaemon::HDMIDaemon() : Thread(false),
mFrameworkSock(-1), mAcceptedConnection(-1), mUeventSock(-1),
mHDMIUeventQueueHead(NULL), fd1(-1), mCurrentID(-1), mNxtMode(-1)
Expand Down Expand Up @@ -525,7 +530,11 @@ void HDMIDaemon::setResolution(int ID)
if (cur->video_format == ID)
mode = cur;
}
#ifdef QCOM_HARDWARE
SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 0);
#else
SurfaceComposerClient::enableHDMIOutput(0);
#endif
ioctl(fd1, FBIOGET_VSCREENINFO, &info);
LOGD("GET Info<ID=%d %dx%d (%d,%d,%d), (%d,%d,%d) %dMHz>",
info.reserved[3], info.xres, info.yres,
Expand All @@ -549,7 +558,11 @@ void HDMIDaemon::setResolution(int ID)
ioctl(fd1, FBIOPAN_DISPLAY, &info);
property_set("hw.hdmiON", "1");
//Inform SF about HDMI
#ifdef QCOM_HARDWARE
SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 1);
#else
SurfaceComposerClient::enableHDMIOutput(1);
#endif
}

int HDMIDaemon::processFrameworkCommand()
Expand All @@ -565,7 +578,9 @@ int HDMIDaemon::processFrameworkCommand()
return -1;

buffer[ret] = 0;

#ifdef QCOM_HARDWARE
char actionsafe[PROPERTY_VALUE_MAX];
#endif
if (!strcmp(buffer, HDMI_CMD_ENABLE_HDMI)) {
if (!openFramebuffer())
return -1;
Expand All @@ -580,20 +595,34 @@ int HDMIDaemon::processFrameworkCommand()
if (!openFramebuffer())
return -1;
property_set("hw.hdmiON", "0");
#ifdef QCOM_HARDWARE
SurfaceComposerClient::enableExternalDisplay(EXT_DISPLAY_HDMI, 0);
#else
SurfaceComposerClient::enableHDMIOutput(0);
#endif
close(fd1);
fd1 = -1;
} else if (!strncmp(buffer, HDMI_CMD_SET_ASWIDTH, strlen(HDMI_CMD_SET_ASWIDTH))) {
float asWidthRatio;
int ret = sscanf(buffer, HDMI_CMD_SET_ASWIDTH "%f", &asWidthRatio);
if(ret==1) {
#ifdef QCOM_HARDWARE
sprintf(actionsafe, "%0.2f", asWidthRatio);
property_set("hw.actionsafe.width", actionsafe);
#else
SurfaceComposerClient::setActionSafeWidthRatio(asWidthRatio);
#endif
}
} else if (!strncmp(buffer, HDMI_CMD_SET_ASHEIGHT, strlen(HDMI_CMD_SET_ASHEIGHT))) {
float asHeightRatio;
int ret = sscanf(buffer, HDMI_CMD_SET_ASHEIGHT "%f", &asHeightRatio);
if(ret==1) {
#ifdef QCOM_HARDWARE
sprintf(actionsafe, "%0.2f", asHeightRatio);
property_set("hw.actionsafe.height", actionsafe);
#else
SurfaceComposerClient::setActionSafeHeightRatio(asHeightRatio);
#endif
}
} else if (!strncmp(buffer, HDMI_CMD_HPDOPTION, strlen(HDMI_CMD_HPDOPTION))) {
int option;
Expand Down
19 changes: 19 additions & 0 deletions core/java/android/webkit/WebViewCore.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007 The Android Open Source Project
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +31,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.SystemProperties;
import android.provider.MediaStore;
import android.util.Log;
import android.util.SparseBooleanArray;
Expand All @@ -46,8 +48,11 @@
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import org.json.*;

import junit.framework.Assert;
import org.codeaurora.Performance;

/**
* @hide
Expand Down Expand Up @@ -671,6 +676,8 @@ private static class WebCoreThread implements Runnable {
private static final int INITIALIZE = 0;
private static final int REDUCE_PRIORITY = 1;
private static final int RESUME_PRIORITY = 2;
private static Performance mPerf = new Performance();
private static final int MIN_FREQ_DURING_SCROLLING = 10;

public void run() {
Looper.prepare();
Expand All @@ -690,11 +697,23 @@ public void handleMessage(Message msg) {
Process.setThreadPriority(
Process.THREAD_PRIORITY_DEFAULT + 3 *
Process.THREAD_PRIORITY_LESS_FAVORABLE);
if (SystemProperties.QCOM_HARDWARE ) {
/* Disable power collapse and setup the min frequency */
/* 0 means disabling power collapse */
mPerf.cpuSetOptions(Performance.CPUOPT_CPU0_PWRCLSP,0);
mPerf.cpuSetOptions(Performance.CPUOPT_CPU0_FREQMIN,MIN_FREQ_DURING_SCROLLING);
}
break;

case RESUME_PRIORITY:
Process.setThreadPriority(
Process.THREAD_PRIORITY_DEFAULT);
if (SystemProperties.QCOM_HARDWARE ) {
/* Enable power collapse and reset the min frequency */
/* 1 means enabling power collapse */
mPerf.cpuSetOptions(Performance.CPUOPT_CPU0_PWRCLSP,1);
mPerf.cpuSetOptions(Performance.CPUOPT_CPU0_FREQMIN,0);
}
break;

case EventHub.ADD_PACKAGE_NAME:
Expand Down
50 changes: 50 additions & 0 deletions core/java/com/android/internal/app/ShutdownThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
import android.view.WindowManager;
import android.view.KeyEvent;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;

public final class ShutdownThread extends Thread {
// constants
private static final String TAG = "ShutdownThread";
Expand All @@ -68,6 +73,9 @@ public final class ShutdownThread extends Thread {
public static final String SHUTDOWN_ACTION_PROPERTY = "sys.shutdown.requested";
public static final String RADIO_SHUTDOWN_PROPERTY = "sys.radio.shutdown";

private static final String SYSFS_MSM_EFS_SYNC_COMPLETE = "/sys/devices/platform/rs300000a7.65536/sync_sts";
private static final String SYSFS_MDM_EFS_SYNC_COMPLETE = "/sys/devices/platform/rs300100a7.65536/sync_sts";

// static instance of this thread
private static final ShutdownThread sInstance = new ShutdownThread();

Expand Down Expand Up @@ -281,6 +289,7 @@ void actionDone() {
public void run() {
boolean bluetoothOff;
boolean radioOff;
boolean msmEfsSyncDone = false, mdmEfsSyncDone = false;

BroadcastReceiver br = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
Expand Down Expand Up @@ -366,6 +375,47 @@ public void run() {
}

SystemProperties.set(RADIO_SHUTDOWN_PROPERTY, "true");

if (SystemProperties.QCOM_HARDWARE) {
Log.i(TAG, "Waiting for radio file system sync to complete ...");

// Wait a max of 8 seconds
for (int i = 0; i < MAX_NUM_PHONE_STATE_READS; i++) {
if (!msmEfsSyncDone) {
try {
FileInputStream fis = new FileInputStream(SYSFS_MSM_EFS_SYNC_COMPLETE);
int result = fis.read();
fis.close();
if (result == '1') {
msmEfsSyncDone = true;
}
} catch (Exception ex) {
Log.e(TAG, "Exception during msmEfsSyncDone", ex);
msmEfsSyncDone = true;
}
}
if (!mdmEfsSyncDone) {
try {
FileInputStream fis = new FileInputStream(SYSFS_MDM_EFS_SYNC_COMPLETE);
int result = fis.read();
fis.close();
if (result == '1') {
mdmEfsSyncDone = true;
}
} catch (Exception ex) {
Log.e(TAG, "Exception during mdmEfsSyncDone", ex);
mdmEfsSyncDone = true;
}
}
if (msmEfsSyncDone && mdmEfsSyncDone) {
Log.i(TAG, "Radio file system sync complete.");
break;
}
Log.i(TAG, "Radio file system sync incomplete - retry.");
SystemClock.sleep(PHONE_STATE_POLL_SLEEP_MSEC);
}
}

Log.i(TAG, "Waiting for Bluetooth and Radio...");

// Wait a max of 32 seconds for clean shutdown
Expand Down
9 changes: 0 additions & 9 deletions include/gui/SurfaceTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ class SurfaceTexture : public BnSurfaceTexture {
//
// This call may only be made while the OpenGL ES context to which the
// target texture belongs is bound to the calling thread.
#ifndef QCOM_HARDWARE
status_t updateTexImage();
#else
//
status_t updateTexImage(bool isComposition = false);
#endif

// setBufferCountServer set the buffer count. If the client has requested
// a buffer count using setBufferCount, the server-buffer count will
Expand Down Expand Up @@ -511,11 +506,7 @@ class SurfaceTexture : public BnSurfaceTexture {
// glCopyTexSubImage to read from the texture. This is a hack to work
// around a GL driver limitation on the number of FBO attachments, which the
// browser's tile cache exceeds.
#ifdef QCOM_HARDWARE
GLenum mTexTarget;
#else
const GLenum mTexTarget;
#endif

// mFrameCounter is the free running counter, incremented for every buffer queued
// with the surface Texture.
Expand Down
10 changes: 3 additions & 7 deletions include/surfaceflinger/ISurfaceComposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ class ISurfaceComposer : public IInterface
const sp<ISurfaceTexture>& surface) const = 0;

#ifdef QCOM_HDMI_OUT
//HDMI SPecific functions
virtual void enableHDMIOutput(int enable) = 0;
virtual void setActionSafeWidthRatio(float asWidthRatio) = 0;
virtual void setActionSafeHeightRatio(float asHeightRatio) = 0;
//External display specific functions
virtual void enableExternalDisplay(int disp_type, int enable) = 0;
#endif

};
Expand All @@ -160,9 +158,7 @@ class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
TURN_ELECTRON_BEAM_ON,
AUTHENTICATE_SURFACE,
#ifdef QCOM_HDMI_OUT
ENABLE_HDMI_OUTPUT,
SET_ACTIONSAFE_WIDTH_RATIO,
SET_ACTIONSAFE_HEIGHT_RATIO
EXTERNAL_DISPLAY,
#endif
};

Expand Down
8 changes: 4 additions & 4 deletions include/surfaceflinger/SurfaceComposerClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ class SurfaceComposerClient : public RefBase

//! Open a composer transaction on all active SurfaceComposerClients.
static void openGlobalTransaction();

//! Close a composer transaction on all active SurfaceComposerClients.
static void closeGlobalTransaction(bool synchronous = false);

//! Freeze the specified display but not transactions.
static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0);

//! Resume updates on the specified display.
static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0);

Expand All @@ -137,7 +137,7 @@ class SurfaceComposerClient : public RefBase

#ifdef QCOM_HDMI_OUT
//HDMI SPecific functions
static void enableHDMIOutput(int enable);
static void enableExternalDisplay(int disp_type, int enable);
static void setActionSafeWidthRatio(float asWidthRatio);
static void setActionSafeHeightRatio(float asHeightRatio);
#endif
Expand Down
36 changes: 6 additions & 30 deletions libs/gui/ISurfaceComposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,13 @@ class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
}

#ifdef QCOM_HDMI_OUT
virtual void enableHDMIOutput(int enable)
virtual void enableExternalDisplay(int disp_type, int enable)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeInt32(disp_type);
data.writeInt32(enable);
remote()->transact(BnSurfaceComposer::ENABLE_HDMI_OUTPUT, data, &reply);
}

virtual void setActionSafeWidthRatio(float asWidthRatio)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeFloat(asWidthRatio);
remote()->transact(BnSurfaceComposer::SET_ACTIONSAFE_WIDTH_RATIO, data, &reply);
}

virtual void setActionSafeHeightRatio(float asHeightRatio)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeFloat(asHeightRatio);
remote()->transact(BnSurfaceComposer::SET_ACTIONSAFE_HEIGHT_RATIO, data, &reply);
remote()->transact(BnSurfaceComposer::EXTERNAL_DISPLAY, data, &reply);
}
#endif

Expand Down Expand Up @@ -282,20 +267,11 @@ status_t BnSurfaceComposer::onTransact(
reply->writeInt32(result);
} break;
#ifdef QCOM_HDMI_OUT
case ENABLE_HDMI_OUTPUT: {
case EXTERNAL_DISPLAY: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
int disp_type = data.readInt32();
int enable = data.readInt32();
enableHDMIOutput(enable);
} break;
case SET_ACTIONSAFE_WIDTH_RATIO: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
float asWidthRatio = data.readFloat();
setActionSafeWidthRatio(asWidthRatio);
} break;
case SET_ACTIONSAFE_HEIGHT_RATIO: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
float asHeightRatio = data.readFloat();
setActionSafeHeightRatio(asHeightRatio);
enableExternalDisplay(disp_type, enable);
} break;
#endif
default:
Expand Down
14 changes: 2 additions & 12 deletions libs/gui/SurfaceComposerClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,10 @@ status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client,
}

#ifdef QCOM_HDMI_OUT
void SurfaceComposerClient::enableHDMIOutput(int enable)
void SurfaceComposerClient::enableExternalDisplay(int disp_type, int enable)
{
sp<ISurfaceComposer> sm(getComposerService());
return sm->enableHDMIOutput(enable);
}

void SurfaceComposerClient::setActionSafeWidthRatio(float asWidthRatio){
sp<ISurfaceComposer> sm(getComposerService());
return sm->setActionSafeWidthRatio(asWidthRatio);
}

void SurfaceComposerClient::setActionSafeHeightRatio(float asHeightRatio){
sp<ISurfaceComposer> sm(getComposerService());
return sm->setActionSafeHeightRatio(asHeightRatio);
return sm->enableExternalDisplay(disp_type, enable);
}
#endif

Expand Down

0 comments on commit add0200

Please sign in to comment.