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

Commit 4a3a707b authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4502278 from 96da4649 to pi-release

Change-Id: I13f4facc31f9e983ead7637ffb750bd804b23b7a
parents f73f857e 96da4649
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ cc_library_headers {

cc_library_shared {
    name: "libgui",
    vendor_available: true,
    vendor_available: false,
    vndk: {
        enabled: true,
    },
+0 −2
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ LOCAL_SRC_FILES := \
    DisplayHardware/HWC2.cpp \
    DisplayHardware/HWComposer.cpp \
    DisplayHardware/HWComposerBufferCache.cpp \
    DisplayHardware/PowerHAL.cpp \
    DisplayHardware/VirtualDisplaySurface.cpp \
    Effects/Daltonizer.cpp \
    EventLog/EventLogTags.logtags \
@@ -89,7 +88,6 @@ LOCAL_SHARED_LIBRARIES := \
    libbinder \
    libui \
    libgui \
    libpowermanager \
    libvulkan \
    libsync \
    libprotobuf-cpp-lite \
+0 −55
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 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.
 */

#include <android/hardware/power/1.0/IPower.h>
#include <stdint.h>
#include <sys/types.h>

#include <android/log.h>
#include <utils/Errors.h>

#include <binder/IServiceManager.h>
#include <powermanager/IPowerManager.h>
#include <powermanager/PowerManager.h>

#include "PowerHAL.h"

using android::hardware::power::V1_0::PowerHint;
namespace android {
// ---------------------------------------------------------------------------

status_t PowerHAL::vsyncHint(bool enabled) {
    Mutex::Autolock _l(mlock);
    if (mPowerManager == NULL) {
        const String16 serviceName("power");
        sp<IBinder> bs = defaultServiceManager()->checkService(serviceName);
        if (bs == NULL) {
            return NAME_NOT_FOUND;
        }
        mPowerManager = interface_cast<IPowerManager>(bs);
    }
    status_t status;
    status = mPowerManager->powerHint(static_cast<int>(PowerHint::VSYNC),
            enabled ? 1 : 0);
    if(status == DEAD_OBJECT) {
        mPowerManager = NULL;
    }
    return status;
}

// ---------------------------------------------------------------------------
}; // namespace android
+0 −43
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 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_SF_POWER_HAL_H
#define ANDROID_SF_POWER_HAL_H

#include <stdint.h>
#include <sys/types.h>
#include <utils/Mutex.h>

#include <powermanager/IPowerManager.h>
#include <hardware/power.h>

namespace android {
// ---------------------------------------------------------------------------

class PowerHAL
{
public:
    status_t vsyncHint(bool enabled);

private:
    sp<IPowerManager> mPowerManager;
    Mutex mlock;
};

// ---------------------------------------------------------------------------
}; // namespace android

#endif // ANDROID_SF_POWER_HAL_H
+0 −35
Original line number Diff line number Diff line
@@ -34,14 +34,6 @@
// ---------------------------------------------------------------------------
namespace android {
// ---------------------------------------------------------------------------
// time to wait between VSYNC requests before sending a VSYNC OFF power hint: 40msec.
const long vsyncHintOffDelay = 40000000;

static void vsyncOffCallback(union sigval val) {
    EventThread *ev = (EventThread *)val.sival_ptr;
    ev->sendVsyncHintOff();
    return;
}

EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs)
    : mVSyncSource(src),
@@ -49,7 +41,6 @@ EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bo
      mUseSoftwareVSync(false),
      mVsyncEnabled(false),
      mDebugVsyncEnabled(false),
      mVsyncHintSent(false),
      mInterceptVSyncs(interceptVSyncs) {

    for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
@@ -58,18 +49,6 @@ EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bo
        mVSyncEvent[i].header.timestamp = 0;
        mVSyncEvent[i].vsync.count =  0;
    }
    struct sigevent se;
    se.sigev_notify = SIGEV_THREAD;
    se.sigev_value.sival_ptr = this;
    se.sigev_notify_function = vsyncOffCallback;
    se.sigev_notify_attributes = NULL;
    timer_create(CLOCK_MONOTONIC, &se, &mTimerId);
}

void EventThread::sendVsyncHintOff() {
    Mutex::Autolock _l(mLock);
    mPowerHAL.vsyncHint(false);
    mVsyncHintSent = false;
}

void EventThread::setPhaseOffset(nsecs_t phaseOffset) {
@@ -77,19 +56,6 @@ void EventThread::setPhaseOffset(nsecs_t phaseOffset) {
    mVSyncSource->setPhaseOffset(phaseOffset);
}

void EventThread::sendVsyncHintOnLocked() {
    struct itimerspec ts;
    if(!mVsyncHintSent) {
        mPowerHAL.vsyncHint(true);
        mVsyncHintSent = true;
    }
    ts.it_value.tv_sec = 0;
    ts.it_value.tv_nsec = vsyncHintOffDelay;
    ts.it_interval.tv_sec = 0;
    ts.it_interval.tv_nsec = 0;
    timer_settime(mTimerId, 0, &ts, NULL);
}

void EventThread::onFirstRef() {
    run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
}
@@ -357,7 +323,6 @@ void EventThread::enableVSyncLocked() {
        }
    }
    mDebugVsyncEnabled = true;
    sendVsyncHintOnLocked();
}

void EventThread::disableVSyncLocked() {
Loading