Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit add0200d authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Merge remote-tracking branch 'github/kali' into ics

Conflicts:
	libs/gui/SurfaceTextureClient.cpp
	services/surfaceflinger/Layer.cpp
	services/surfaceflinger/SurfaceTextureLayer.cpp

Change-Id: Ib353e7d86411c0a3ceb5ecdb75c40a7b7842da15
parents f7ca5108 1f8f4482
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -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)
@@ -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,
@@ -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()
@@ -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;
@@ -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;
+19 −0
Original line number Diff line number Diff line
/*
 * 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.
@@ -30,6 +31,7 @@ import android.os.Handler;
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;
@@ -46,8 +48,11 @@ import java.util.ArrayList;
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
@@ -671,6 +676,8 @@ public final class WebViewCore {
        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();
@@ -690,11 +697,23 @@ public final class WebViewCore {
                                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:
+50 −0
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@ import android.util.Log;
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";
@@ -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();
    
@@ -281,6 +289,7 @@ public final class ShutdownThread extends Thread {
    public void run() {
        boolean bluetoothOff;
        boolean radioOff;
        boolean msmEfsSyncDone = false, mdmEfsSyncDone = false;

        BroadcastReceiver br = new BroadcastReceiver() {
            @Override public void onReceive(Context context, Intent intent) {
@@ -366,6 +375,47 @@ public final class ShutdownThread extends Thread {
        }

        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
+0 −9
Original line number Diff line number Diff line
@@ -141,12 +141,7 @@ public:
    //
    // 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
@@ -511,11 +506,7 @@ private:
    // 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.
+3 −7
Original line number Diff line number Diff line
@@ -133,10 +133,8 @@ public:
            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

};
@@ -160,9 +158,7 @@ public:
        TURN_ELECTRON_BEAM_ON,
        AUTHENTICATE_SURFACE,
#ifdef QCOM_HDMI_OUT
        ENABLE_HDMI_OUTPUT,
        SET_ACTIONSAFE_WIDTH_RATIO,
        SET_ACTIONSAFE_HEIGHT_RATIO
        EXTERNAL_DISPLAY,
#endif
    };

Loading