From 59b4d76727d3ed68dcadb018c121b6b9d80cfb7b Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Wed, 20 May 2015 15:24:39 +0200 Subject: Set proper blanking mode for DOZE In order to support Ambient mode with new HWC 1.4 coming with Diamond, blanking mode should properly set in setPowerMode implementation. When setting HWC_POWER_MODE_DOZE, display should not blank as other modes with display on (HWC_POWER_MODE_NORMAL & HWC_POWER_MODE_DOZE_SUSPEND). Change-Id: I24409ea6e57159c10fb425de0b66ba334810118f Tracked-On: https://jira01.devtools.intel.com/browse/MARVIN-650 Signed-off-by: Victor Tasayco Loarte Reviewed-on: https://android.intel.com:443/370542 --- merrifield/common/devices/PhysicalDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merrifield/common/devices/PhysicalDevice.cpp b/merrifield/common/devices/PhysicalDevice.cpp index a7e52cd..dc72a00 100644 --- a/merrifield/common/devices/PhysicalDevice.cpp +++ b/merrifield/common/devices/PhysicalDevice.cpp @@ -514,8 +514,8 @@ bool PhysicalDevice::setPowerMode(int mode) // TODO: set proper blanking modes for HWC 1.4 modes switch (mode) { case HWC_POWER_MODE_OFF: - case HWC_POWER_MODE_DOZE: return blank(true); + case HWC_POWER_MODE_DOZE: case HWC_POWER_MODE_NORMAL: case HWC_POWER_MODE_DOZE_SUSPEND: return blank(false); -- cgit v1.2.3 From 79c344ae1eb6191da37b143c78ad0cd439a2a646 Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Wed, 20 May 2015 15:24:39 +0200 Subject: Set proper blanking mode for DOZE In order to support Ambient mode with new HWC 1.4 coming with Diamond, blanking mode should properly set in setPowerMode implementation. When setting HWC_POWER_MODE_DOZE, display should not blank as other modes with display on (HWC_POWER_MODE_NORMAL & HWC_POWER_MODE_DOZE_SUSPEND). Change-Id: I24409ea6e57159c10fb425de0b66ba334810118f Tracked-On: https://jira01.devtools.intel.com/browse/MARVIN-650 Signed-off-by: Victor Tasayco Loarte Reviewed-on: https://android.intel.com:443/370542 --- merrifield/common/devices/PhysicalDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merrifield/common/devices/PhysicalDevice.cpp b/merrifield/common/devices/PhysicalDevice.cpp index a7e52cd..dc72a00 100644 --- a/merrifield/common/devices/PhysicalDevice.cpp +++ b/merrifield/common/devices/PhysicalDevice.cpp @@ -514,8 +514,8 @@ bool PhysicalDevice::setPowerMode(int mode) // TODO: set proper blanking modes for HWC 1.4 modes switch (mode) { case HWC_POWER_MODE_OFF: - case HWC_POWER_MODE_DOZE: return blank(true); + case HWC_POWER_MODE_DOZE: case HWC_POWER_MODE_NORMAL: case HWC_POWER_MODE_DOZE_SUSPEND: return blank(false); -- cgit v1.2.3 From 040739aeaee679e4a570d51d8c081c61b7da3271 Mon Sep 17 00:00:00 2001 From: Saadi Maalem Date: Wed, 17 Jun 2015 15:37:08 +0800 Subject: Hwcomposer: Enable VirtualDisplay feature JIRA: MARVIN-68 Fixed fd leaks issues with VirtualDisplays. Due to removal of WIDI, the VirtualDisplay feature got removed and we end up with a file descriptor leakage when using extensively the VirtualDisplay feature. Add back VirtualDisplay feature without WIDI support. Change-Id: Ief60aac960585c0f09312e2cc7e5629969f3f448 Signed-off-by: Liang Weilong Signed-off-by: Guillaume Ranquet Reviewed-on: https://android.intel.com/380907 Reviewed-by: Tasayco Loarte, VictorX Reviewed-by: Liu, Kevin Reviewed-by: jenkins_ndg Reviewed-by: Akue, LoicX Reviewed-by: Ledentec, AlexandreX Reviewed-by: Maalem, Saadi Tested-by: Tasayco Loarte, VictorX --- merrifield/common/base/DisplayAnalyzer.cpp | 9 --- merrifield/common/base/VsyncManager.cpp | 2 - merrifield/common/devices/VirtualDevice.cpp | 89 +++++++++++++++++----- merrifield/include/IDisplayDevice.h | 2 - merrifield/include/VirtualDevice.h | 23 ++++-- merrifield/ips/tangier/TngDisplayContext.cpp | 4 - merrifield/platforms/merrifield/Android.mk | 8 +- merrifield/platforms/merrifield/PlatFactory.cpp | 4 - merrifield/platforms/merrifield_plus/Android.mk | 9 +-- .../platforms/merrifield_plus/PlatFactory.cpp | 2 - 10 files changed, 93 insertions(+), 59 deletions(-) diff --git a/merrifield/common/base/DisplayAnalyzer.cpp b/merrifield/common/base/DisplayAnalyzer.cpp index 5da7403..a0b9ffd 100755 --- a/merrifield/common/base/DisplayAnalyzer.cpp +++ b/merrifield/common/base/DisplayAnalyzer.cpp @@ -24,9 +24,7 @@ #include #include #include -#ifdef INTEL_WIDI_MERRIFIELD #include -#endif namespace android { namespace intel { @@ -136,19 +134,12 @@ void DisplayAnalyzer::checkVideoExtMode() Hwcomposer *hwc = &Hwcomposer::getInstance(); ExternalDevice *eDev = static_cast(hwc->getDisplayDevice(IDisplayDevice::DEVICE_EXTERNAL)); -#ifdef INTEL_WIDI_MERRIFIELD VirtualDevice *vDev = static_cast(hwc->getDisplayDevice(IDisplayDevice::DEVICE_VIRTUAL)); if ((!eDev || !eDev->isConnected()) && (!vDev || !vDev->isFrameServerActive())) { mVideoExtModeEligible = false; return; } -#else - if (!eDev || !eDev->isConnected()) { - mVideoExtModeEligible = false; - return; - } -#endif /*INTEL_WIDI_MERRIFIELD*/ bool geometryChanged = false; int activeDisplays = 0; diff --git a/merrifield/common/base/VsyncManager.cpp b/merrifield/common/base/VsyncManager.cpp index 56e935e..37fa0e7 100644 --- a/merrifield/common/base/VsyncManager.cpp +++ b/merrifield/common/base/VsyncManager.cpp @@ -156,7 +156,6 @@ int VsyncManager::getCandidate() return IDisplayDevice::DEVICE_EXTERNAL; } -#ifdef INTEL_WIDI_MERRIFIELD // use vsync from virtual display when video extended mode is entered if (Hwcomposer::getInstance().getDisplayAnalyzer()->isVideoExtModeActive()) { device = getDisplayDevice(IDisplayDevice::DEVICE_VIRTUAL); @@ -165,7 +164,6 @@ int VsyncManager::getCandidate() } WTRACE("Could not use vsync from secondary device"); } -#endif return IDisplayDevice::DEVICE_PRIMARY; } diff --git a/merrifield/common/devices/VirtualDevice.cpp b/merrifield/common/devices/VirtualDevice.cpp index a4396d7..965c633 100755 --- a/merrifield/common/devices/VirtualDevice.cpp +++ b/merrifield/common/devices/VirtualDevice.cpp @@ -480,26 +480,34 @@ struct VirtualDevice::BlitTask : public VirtualDevice::RenderTask { struct VirtualDevice::FrameTypeChangedTask : public VirtualDevice::Task { virtual void run(VirtualDevice& vd) { +#ifdef INTEL_WIDI typeChangeListener->frameTypeChanged(inputFrameInfo); ITRACE("Notify frameTypeChanged: %dx%d in %dx%d @ %d fps", inputFrameInfo.contentWidth, inputFrameInfo.contentHeight, inputFrameInfo.bufferWidth, inputFrameInfo.bufferHeight, inputFrameInfo.contentFrameRateN); +#endif } +#ifdef INTEL_WIDI sp typeChangeListener; FrameInfo inputFrameInfo; +#endif }; struct VirtualDevice::BufferInfoChangedTask : public VirtualDevice::Task { virtual void run(VirtualDevice& vd) { +#ifdef INTEL_WIDI typeChangeListener->bufferInfoChanged(outputFrameInfo); ITRACE("Notify bufferInfoChanged: %dx%d in %dx%d @ %d fps", outputFrameInfo.contentWidth, outputFrameInfo.contentHeight, outputFrameInfo.bufferWidth, outputFrameInfo.bufferHeight, outputFrameInfo.contentFrameRateN); +#endif } +#ifdef INTEL_WIDI sp typeChangeListener; FrameInfo outputFrameInfo; +#endif }; struct VirtualDevice::OnFrameReadyTask : public VirtualDevice::Task { @@ -513,7 +521,7 @@ struct VirtualDevice::OnFrameReadyTask : public VirtualDevice::Task { //from the vector properly even if the notifyBufferReturned call acquires mHeldBuffersLock first. vd.mHeldBuffers.add(handle, heldBuffer); } - +#ifdef INTEL_WIDI // FIXME: we could remove this casting once onFrameReady receives // a buffer_handle_t handle status_t result = frameListener->onFrameReady((uint32_t)handle, handleType, renderTimestamp, mediaTimestamp); @@ -521,12 +529,18 @@ struct VirtualDevice::OnFrameReadyTask : public VirtualDevice::Task { Mutex::Autolock _l(vd.mHeldBuffersLock); vd.mHeldBuffers.removeItem(handle); } +#else + Mutex::Autolock _l(vd.mHeldBuffersLock); + vd.mHeldBuffers.removeItem(handle); +#endif } sp renderTask; sp heldBuffer; - sp frameListener; buffer_handle_t handle; +#ifdef INTEL_WIDI + sp frameListener; HWCBufferHandleType handleType; +#endif int64_t renderTimestamp; int64_t mediaTimestamp; }; @@ -642,7 +656,9 @@ VirtualDevice::VirtualDevice(Hwcomposer& hwc) mDecHeight(0) { CTRACE(); +#ifdef INTEL_WIDI mNextConfig.frameServerActive = false; +#endif } VirtualDevice::~VirtualDevice() @@ -686,7 +702,7 @@ bool VirtualDevice::threadLoop() return true; } - +#ifdef INTEL_WIDI status_t VirtualDevice::start(sp typeChangeListener) { ITRACE(); @@ -730,12 +746,17 @@ status_t VirtualDevice::stop(bool isConnected) } return NO_ERROR; } +#endif bool VirtualDevice::isFrameServerActive() const { +#ifdef INTEL_WIDI return mCurrentConfig.frameServerActive; +#endif + return false; } +#ifdef INTEL_WIDI /* TODO: 64-bit - this handle of size 32-bit is a problem for 64-bit */ status_t VirtualDevice::notifyBufferReturned(int handle) { @@ -759,7 +780,7 @@ status_t VirtualDevice::setResolution(const FrameProcessingPolicy& policy, sphwLayers[display->numHwLayers-1]; @@ -792,11 +813,12 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) mVspInUse = false; mExpectAcquireFences = false; mIsForceCloneMode = false; - +#ifdef INTEL_WIDI { Mutex::Autolock _l(mConfigLock); mCurrentConfig = mNextConfig; } +#endif bool shouldBeConnected = (display != NULL); if (shouldBeConnected != mLastConnectionStatus) { @@ -822,12 +844,17 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) return true; } +#ifdef INTEL_WIDI if (!mCurrentConfig.frameServerActive) { // We're done with CSC buffers, since we blit to outbuf in this mode. // We want to keep mappings cached, so we don't clear mMappedBufferCache. Mutex::Autolock _l(mTaskLock); mCscBuffers.clear(); } +#else + Mutex::Autolock _l(mTaskLock); + mCscBuffers.clear(); +#endif // by default send the FRAMEBUFFER_TARGET layer (composited image) const ssize_t fbTarget = display->numHwLayers-1; @@ -837,7 +864,7 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) DisplayAnalyzer *analyzer = mHwc.getDisplayAnalyzer(); mProtectedMode = false; - +#ifdef INTEL_WIDI if (mCurrentConfig.typeChangeListener != NULL && !analyzer->isOverlayAllowed() && analyzer->getVideoInstances() <= 1) { @@ -879,13 +906,14 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) break; } } +#endif if (mYuvLayer == -1) { mFirstVideoFrame = true; mDecWidth = 0; mDecHeight = 0; } - +#ifdef INTEL_WIDI if (mCurrentConfig.frameServerActive && mCurrentConfig.extendedModeEnabled && mYuvLayer != -1) { if (handleExtendedMode(display)) { mYuvLayer = -1; @@ -903,7 +931,7 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) mIsForceCloneMode = true; mYuvLayer = -1; } - +#endif if (mYuvLayer == 0 && fbTarget == 1) { // No RGB layer, so tell queueCompose to use blank RGB in fbtarget. mRgbLayer = -1; @@ -933,10 +961,11 @@ bool VirtualDevice::prepare(hwc_display_contents_1_t *display) // This has no effect when the video is the bottommost layer. display->hwLayers[mYuvLayer].hints |= HWC_HINT_CLEAR_FB; +#ifdef INTEL_WIDI // we're streaming fbtarget, so send onFramePrepare and wait for composition to happen if (mCurrentConfig.frameListener != NULL) mCurrentConfig.frameListener->onFramePrepare(mRenderTimestamp, -1); - +#endif return true; } @@ -1003,7 +1032,11 @@ bool VirtualDevice::queueCompose(hwc_display_contents_1_t *display) ETRACE("No video handle"); return false; } +#ifdef INTEL_WIDI if (!mCurrentConfig.frameServerActive && display->outbuf == NULL) { +#else + if (display->outbuf == NULL) { +#endif ETRACE("No outbuf"); return true; // fallback would be pointless } @@ -1021,6 +1054,7 @@ bool VirtualDevice::queueCompose(hwc_display_contents_1_t *display) composeTask->outHeight = fbTarget.sourceCropf.bottom - fbTarget.sourceCropf.top; bool scaleRgb = false; +#ifdef INTEL_WIDI if (mCurrentConfig.frameServerActive) { if (mVspUpscale) { composeTask->outWidth = mCurrentConfig.policy.scaledWidth; @@ -1039,6 +1073,9 @@ bool VirtualDevice::queueCompose(hwc_display_contents_1_t *display) } else { composeTask->outputHandle = display->outbuf; } +#else + composeTask->outputHandle = display->outbuf; +#endif vspPrepare(composeTask->outWidth, composeTask->outHeight); @@ -1258,7 +1295,7 @@ bool VirtualDevice::queueCompose(hwc_display_contents_1_t *display) mTasks.push_back(composeTask); mRequestQueued.signal(); - +#ifdef INTEL_WIDI if (mCurrentConfig.frameServerActive) { FrameInfo inputFrameInfo; @@ -1315,6 +1352,9 @@ bool VirtualDevice::queueCompose(hwc_display_contents_1_t *display) else { display->retireFenceFd = dup(retireFd); } +#else + display->retireFenceFd = dup(retireFd); +#endif return true; } @@ -1376,7 +1416,7 @@ bool VirtualDevice::queueColorConvert(hwc_display_contents_1_t *display) // Framebuffer after BlitTask::run() calls sw_sync_timeline_inc(). layer.releaseFenceFd = sw_sync_fence_create(mSyncTimelineFd, "widi_blit_retire", mNextSyncPoint); mNextSyncPoint++; - +#ifdef INTEL_WIDI if (mCurrentConfig.frameServerActive) { blitTask->destHandle = mCscBuffers.get(blitTask->destRect.w, blitTask->destRect.h, &heldBuffer); blitTask->destAcquireFenceFd = -1; @@ -1394,7 +1434,13 @@ bool VirtualDevice::queueColorConvert(hwc_display_contents_1_t *display) display->outbufAcquireFenceFd = -1; display->retireFenceFd = dup(layer.releaseFenceFd); } - +#else + blitTask->destHandle = display->outbuf; + blitTask->destAcquireFenceFd = display->outbufAcquireFenceFd; + // don't let TngDisplayContext::commitEnd() close this + display->outbufAcquireFenceFd = -1; + display->retireFenceFd = dup(layer.releaseFenceFd); +#endif if (blitTask->destHandle == NULL) { WTRACE("Out of CSC buffers, dropping frame"); return false; @@ -1402,7 +1448,7 @@ bool VirtualDevice::queueColorConvert(hwc_display_contents_1_t *display) mTasks.push_back(blitTask); mRequestQueued.signal(); - +#ifdef INTEL_WIDI if (mCurrentConfig.frameServerActive) { FrameInfo inputFrameInfo; memset(&inputFrameInfo, 0, sizeof(inputFrameInfo)); @@ -1444,10 +1490,10 @@ bool VirtualDevice::queueColorConvert(hwc_display_contents_1_t *display) mTasks.push_back(frameReadyTask); } } - +#endif return true; } - +#ifdef INTEL_WIDI bool VirtualDevice::handleExtendedMode(hwc_display_contents_1_t *display) { FrameInfo inputFrameInfo; @@ -1689,6 +1735,7 @@ void VirtualDevice::queueBufferInfo(const FrameInfo& outputFrameInfo) mTasks.push_back(notifyTask); } } +#endif void VirtualDevice::colorSwap(buffer_handle_t src, buffer_handle_t dest, uint32_t pixelCount) { @@ -2169,6 +2216,9 @@ bool VirtualDevice::compositionComplete() bool VirtualDevice::initialize() { + mRgbLayer = -1; + mYuvLayer = -1; +#ifdef INTEL_WIDI // Add initialization codes here. If init fails, invoke DEINIT_AND_RETURN_FALSE(); mNextConfig.typeChangeListener = NULL; mNextConfig.policy.scaledWidth = 0; @@ -2180,12 +2230,10 @@ bool VirtualDevice::initialize() mNextConfig.forceNotifyFrameType = false; mNextConfig.forceNotifyBufferInfo = false; mCurrentConfig = mNextConfig; - mRgbLayer = -1; - mYuvLayer = -1; memset(&mLastInputFrameInfo, 0, sizeof(mLastInputFrameInfo)); memset(&mLastOutputFrameInfo, 0, sizeof(mLastOutputFrameInfo)); - +#endif mPayloadManager = mHwc.getPlatFactory()->createVideoPayloadManager(); if (!mPayloadManager) { @@ -2204,6 +2252,7 @@ bool VirtualDevice::initialize() mThread = new WidiBlitThread(this); mThread->run("WidiBlit", PRIORITY_URGENT_DISPLAY); +#ifdef INTEL_WIDI // Publish frame server service with service manager status_t ret = defaultServiceManager()->addService(String16("hwc.widi"), this); if (ret == NO_ERROR) { @@ -2213,7 +2262,9 @@ bool VirtualDevice::initialize() ETRACE("Could not register hwc.widi with service manager, error = %d", ret); deinitialize(); } - +#else + mInitialized = true; +#endif mVspEnabled = false; mVspInUse = false; mVspWidth = 0; diff --git a/merrifield/include/IDisplayDevice.h b/merrifield/include/IDisplayDevice.h index d9a6ac2..ad99a2f 100644 --- a/merrifield/include/IDisplayDevice.h +++ b/merrifield/include/IDisplayDevice.h @@ -55,9 +55,7 @@ public: enum { DEVICE_PRIMARY = HWC_DISPLAY_PRIMARY, DEVICE_EXTERNAL = HWC_DISPLAY_EXTERNAL, -#ifdef INTEL_WIDI_MERRIFIELD DEVICE_VIRTUAL = HWC_DISPLAY_VIRTUAL, -#endif DEVICE_COUNT, }; enum { diff --git a/merrifield/include/VirtualDevice.h b/merrifield/include/VirtualDevice.h index 2af3c6b..a2ae7d4 100755 --- a/merrifield/include/VirtualDevice.h +++ b/merrifield/include/VirtualDevice.h @@ -22,9 +22,10 @@ #include #include #include - +#include +#ifdef INTEL_WIDI #include "IFrameServer.h" - +#endif #include #include @@ -36,7 +37,11 @@ class DisplayPlaneManager; class IVideoPayloadManager; class SoftVsyncObserver; +#ifdef INTEL_WIDI class VirtualDevice : public IDisplayDevice, public BnFrameServer { +#else +class VirtualDevice : public IDisplayDevice, public RefBase{ +#endif protected: class VAMappedHandle; class VAMappedHandleObject; @@ -54,6 +59,7 @@ protected: android::sp vd; android::sp cachedBuffer; }; +#ifdef INTEL_WIDI struct Configuration { sp typeChangeListener; sp frameListener; @@ -63,6 +69,7 @@ protected: bool forceNotifyFrameType; bool forceNotifyBufferInfo; }; +#endif class BufferList { public: BufferList(VirtualDevice& vd, const char* name, uint32_t limit, uint32_t format, uint32_t usage); @@ -91,8 +98,10 @@ protected: struct OnFrameReadyTask; Mutex mConfigLock; +#ifdef INTEL_WIDI Configuration mCurrentConfig; Configuration mNextConfig; +#endif ssize_t mRgbLayer; ssize_t mYuvLayer; bool mProtectedMode; @@ -114,10 +123,10 @@ protected: int mSyncTimelineFd; unsigned mNextSyncPoint; bool mExpectAcquireFences; - +#ifdef INTEL_WIDI FrameInfo mLastInputFrameInfo; FrameInfo mLastOutputFrameInfo; - +#endif int32_t mVideoFramerate; android::KeyedVector > mMappedBufferCache; @@ -147,11 +156,12 @@ private: bool sendToWidi(hwc_display_contents_1_t *display); bool queueCompose(hwc_display_contents_1_t *display); bool queueColorConvert(hwc_display_contents_1_t *display); +#ifdef INTEL_WIDI bool handleExtendedMode(hwc_display_contents_1_t *display); void queueFrameTypeInfo(const FrameInfo& inputFrameInfo); void queueBufferInfo(const FrameInfo& outputFrameInfo); - +#endif void colorSwap(buffer_handle_t src, buffer_handle_t dest, uint32_t pixelCount); void vspPrepare(uint32_t width, uint32_t height); void vspEnable(uint32_t width, uint32_t height); @@ -189,13 +199,14 @@ public: virtual int getType() const; virtual void onVsync(int64_t timestamp); virtual void dump(Dump& d); - +#ifdef INTEL_WIDI // IFrameServer methods virtual android::status_t start(sp frameTypeChangeListener); virtual android::status_t stop(bool isConnected); /* TODO: 64-bit - this handle of size 32-bit is a problem for 64-bit */ virtual android::status_t notifyBufferReturned(int handle); virtual android::status_t setResolution(const FrameProcessingPolicy& policy, android::sp listener); +#endif virtual bool setPowerMode(int mode); virtual int getActiveConfig(); virtual bool setActiveConfig(int index); diff --git a/merrifield/ips/tangier/TngDisplayContext.cpp b/merrifield/ips/tangier/TngDisplayContext.cpp index 7f94185..90218d4 100644 --- a/merrifield/ips/tangier/TngDisplayContext.cpp +++ b/merrifield/ips/tangier/TngDisplayContext.cpp @@ -219,19 +219,15 @@ bool TngDisplayContext::commitEnd(size_t numDisplays, hwc_display_contents_1_t * displays[i]->hwLayers[j].releaseFenceFd); } -#ifdef INTEL_WIDI_MERRIFIELD // retireFence is used for SurfaceFlinger to do DispSync; // dup releaseFenceFd for physical displays and ignore virtual // display; we don't distinguish between release and retire, and all // physical displays are using a single releaseFence; for virtual // display, fencing is handled by the VirtualDisplay class if (i < IDisplayDevice::DEVICE_VIRTUAL) { -#endif displays[i]->retireFenceFd = (releaseFenceFd != -1) ? dup(releaseFenceFd) : -1; -#ifdef INTEL_WIDI_MERRIFIELD } -#endif } // close original release fence fd diff --git a/merrifield/platforms/merrifield/Android.mk b/merrifield/platforms/merrifield/Android.mk index 98e1d3d..6db9243 100644 --- a/merrifield/platforms/merrifield/Android.mk +++ b/merrifield/platforms/merrifield/Android.mk @@ -37,6 +37,7 @@ LOCAL_SRC_FILES := \ ../../common/devices/PhysicalDevice.cpp \ ../../common/devices/PrimaryDevice.cpp \ ../../common/devices/ExternalDevice.cpp \ + ../../common/devices/VirtualDevice.cpp \ ../../common/observers/UeventObserver.cpp \ ../../common/observers/VsyncEventObserver.cpp \ ../../common/observers/SoftVsyncObserver.cpp \ @@ -115,12 +116,9 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM) LOCAL_CFLAGS += -DLINUX -ifeq ($(INTEL_WIDI_MERRIFIELD), true) -LOCAL_SRC_FILES += \ - ../../common/devices/VirtualDevice.cpp - +ifeq ($(INTEL_WIDI), true) LOCAL_SHARED_LIBRARIES += libhwcwidi libbinder - LOCAL_CFLAGS += -DINTEL_WIDI_MERRIFIELD + LOCAL_CFLAGS += -DINTEL_WIDI endif ifeq ($(TARGET_HAS_MULTIPLE_DISPLAY),true) diff --git a/merrifield/platforms/merrifield/PlatFactory.cpp b/merrifield/platforms/merrifield/PlatFactory.cpp index 7530225..45b7ade 100644 --- a/merrifield/platforms/merrifield/PlatFactory.cpp +++ b/merrifield/platforms/merrifield/PlatFactory.cpp @@ -21,9 +21,7 @@ #include #include #include -#ifdef INTEL_WIDI_MERRIFIELD #include -#endif #include #include #include @@ -76,10 +74,8 @@ IDisplayDevice* PlatFactory::createDisplayDevice(int disp) return new PrimaryDevice(hwc, new PlatDeviceControlFactory()); case IDisplayDevice::DEVICE_EXTERNAL: return new ExternalDevice(hwc, new PlatDeviceControlFactory()); -#ifdef INTEL_WIDI_MERRIFIELD case IDisplayDevice::DEVICE_VIRTUAL: return new VirtualDevice(hwc); -#endif default: ETRACE("invalid display device %d", disp); return NULL; diff --git a/merrifield/platforms/merrifield_plus/Android.mk b/merrifield/platforms/merrifield_plus/Android.mk index 2f5f63d..0a85355 100644 --- a/merrifield/platforms/merrifield_plus/Android.mk +++ b/merrifield/platforms/merrifield_plus/Android.mk @@ -37,6 +37,7 @@ LOCAL_SRC_FILES := \ ../../common/devices/PhysicalDevice.cpp \ ../../common/devices/PrimaryDevice.cpp \ ../../common/devices/ExternalDevice.cpp \ + ../../common/devices/VirtualDevice.cpp \ ../../common/observers/UeventObserver.cpp \ ../../common/observers/VsyncEventObserver.cpp \ ../../common/observers/SoftVsyncObserver.cpp \ @@ -118,13 +119,9 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM) LOCAL_CFLAGS += -DLINUX -#$(error local path is: $(LOCAL_C_INCLUDES)) -ifeq ($(INTEL_WIDI_MERRIFIELD), true) -LOCAL_SRC_FILES += \ - ../../common/devices/VirtualDevice.cpp - +ifeq ($(INTEL_WIDI), true) LOCAL_SHARED_LIBRARIES += libhwcwidi libbinder - LOCAL_CFLAGS += -DINTEL_WIDI_MERRIFIELD + LOCAL_CFLAGS += -DINTEL_WIDI endif ifeq ($(TARGET_HAS_MULTIPLE_DISPLAY),true) diff --git a/merrifield/platforms/merrifield_plus/PlatFactory.cpp b/merrifield/platforms/merrifield_plus/PlatFactory.cpp index 095a4a1..d35635b 100644 --- a/merrifield/platforms/merrifield_plus/PlatFactory.cpp +++ b/merrifield/platforms/merrifield_plus/PlatFactory.cpp @@ -74,10 +74,8 @@ IDisplayDevice* PlatFactory::createDisplayDevice(int disp) return new PrimaryDevice(hwc, new PlatDeviceControlFactory()); case IDisplayDevice::DEVICE_EXTERNAL: return new ExternalDevice(hwc, new PlatDeviceControlFactory()); -#ifdef INTEL_WIDI_MERRIFIELD case IDisplayDevice::DEVICE_VIRTUAL: return new VirtualDevice(hwc); -#endif default: ETRACE("invalid display device %d", disp); return NULL; -- cgit v1.2.3 From 219b6962f08cc66bd6227f4647388c26f486a4dd Mon Sep 17 00:00:00 2001 From: Saadi Maalem Date: Mon, 13 Jul 2015 15:54:07 +0800 Subject: Display: power consumption saving JIRA: MARVIN-142 implement hwc setPowerMode for display power saving. Change-Id: Ia7c5d3da733f674cbb977fc443cd17c0cf81a2f8 Signed-off-by: Sophia Gong Reviewed-on: https://android.intel.com/386435 Tested-by: Ledentec, AlexandreX Reviewed-by: Maalem, Saadi --- merrifield/common/devices/PhysicalDevice.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/merrifield/common/devices/PhysicalDevice.cpp b/merrifield/common/devices/PhysicalDevice.cpp index dc72a00..601b63e 100644 --- a/merrifield/common/devices/PhysicalDevice.cpp +++ b/merrifield/common/devices/PhysicalDevice.cpp @@ -511,18 +511,20 @@ void PhysicalDevice::dump(Dump& d) bool PhysicalDevice::setPowerMode(int mode) { - // TODO: set proper blanking modes for HWC 1.4 modes - switch (mode) { - case HWC_POWER_MODE_OFF: - return blank(true); - case HWC_POWER_MODE_DOZE: - case HWC_POWER_MODE_NORMAL: - case HWC_POWER_MODE_DOZE_SUSPEND: - return blank(false); - default: - return false; + // TODO: set proper power modes for HWC 1.4 + ATRACE("mode = %d", mode); + + bool ret; + int arg = mode; + + Drm *drm = Hwcomposer::getInstance().getDrm(); + ret = drm->writeIoctl(DRM_PSB_PM_SET, &arg, sizeof(arg)); + if (ret == false) { + ETRACE("psb power mode set fail"); + return false; } - return false; + + return true; } int PhysicalDevice::getActiveConfig() -- cgit v1.2.3 From a47d9a7b7ea142998a482aa2fdce70a5ca4fe152 Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Sat, 11 Jul 2015 23:12:34 -0700 Subject: Fix M Upgrade Compilation issues Change-Id: I24113f420e1180dbaf03efc3af2181cd6dd7eaf5 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-1012 Signed-off-by: Stephen Woo Signed-off-by: Victor Tasayco Loarte --- merrifield/common/utils/HwcTrace.h | 10 +++++----- merrifield/ips/common/WsbmWrapper.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/merrifield/common/utils/HwcTrace.h b/merrifield/common/utils/HwcTrace.h index 83151c6..2eb47a2 100644 --- a/merrifield/common/utils/HwcTrace.h +++ b/merrifield/common/utils/HwcTrace.h @@ -26,11 +26,11 @@ extern "C" { #endif // Helper to automatically preappend classname::functionname to the log message -#define VTRACE(fmt,...) ALOGV("%s: "fmt, __func__, ##__VA_ARGS__) -#define DTRACE(fmt,...) ALOGD("%s: "fmt, __func__, ##__VA_ARGS__) -#define ITRACE(fmt,...) ALOGI("%s: "fmt, __func__, ##__VA_ARGS__) -#define WTRACE(fmt,...) ALOGW("%s: "fmt, __func__, ##__VA_ARGS__) -#define ETRACE(fmt,...) ALOGE("%s: "fmt, __func__, ##__VA_ARGS__) +#define VTRACE(fmt,...) ALOGV("%s: " fmt, __func__, ##__VA_ARGS__) +#define DTRACE(fmt,...) ALOGD("%s: " fmt, __func__, ##__VA_ARGS__) +#define ITRACE(fmt,...) ALOGI("%s: " fmt, __func__, ##__VA_ARGS__) +#define WTRACE(fmt,...) ALOGW("%s: " fmt, __func__, ##__VA_ARGS__) +#define ETRACE(fmt,...) ALOGE("%s: " fmt, __func__, ##__VA_ARGS__) // Function call tracing diff --git a/merrifield/ips/common/WsbmWrapper.c b/merrifield/ips/common/WsbmWrapper.c index 5e4161e..5e050a4 100644 --- a/merrifield/ips/common/WsbmWrapper.c +++ b/merrifield/ips/common/WsbmWrapper.c @@ -14,6 +14,7 @@ // limitations under the License. */ +#include #include #include #include -- cgit v1.2.3 From ec73412f0d53f46a50d1ea4ca3ffc07022f91197 Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Mon, 30 Nov 2015 14:31:25 +0100 Subject: DrmConfig: Change DRM_MODE_ENCODER_MIPI to DRM_MODE_ENCODER_DSI To be consistent with upstream naming. Change-Id: I69bfcc3cfdbbb222a01f16323e2ea468f5916cc7 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-1012 Signed-off-by: Sean Paul Signed-off-by: Victor Tasayco Loarte --- merrifield/ips/common/DrmConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/merrifield/ips/common/DrmConfig.cpp b/merrifield/ips/common/DrmConfig.cpp index 59b1c72..f1c119b 100644 --- a/merrifield/ips/common/DrmConfig.cpp +++ b/merrifield/ips/common/DrmConfig.cpp @@ -30,7 +30,7 @@ const char* DrmConfig::getDrmPath() uint32_t DrmConfig::getDrmConnector(int device) { if (device == IDisplayDevice::DEVICE_PRIMARY) - return DRM_MODE_CONNECTOR_MIPI; + return DRM_MODE_CONNECTOR_DSI; else if (device == IDisplayDevice::DEVICE_EXTERNAL) return DRM_MODE_CONNECTOR_DVID; return DRM_MODE_CONNECTOR_Unknown; @@ -39,7 +39,7 @@ uint32_t DrmConfig::getDrmConnector(int device) uint32_t DrmConfig::getDrmEncoder(int device) { if (device == IDisplayDevice::DEVICE_PRIMARY) - return DRM_MODE_ENCODER_MIPI; + return DRM_MODE_ENCODER_DSI; else if (device == IDisplayDevice::DEVICE_EXTERNAL) return DRM_MODE_ENCODER_TMDS; return DRM_MODE_ENCODER_NONE; -- cgit v1.2.3 From f2c6d3afbd534f727b060bf41c383c99bec8b893 Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Mon, 30 Nov 2015 11:58:51 +0100 Subject: hwc: Enabling ION - HWC Calling a libwsbm function with fd value (-1) Orig-Author: Randy Xu Change-Id: Ie3a5765faca3f71c58ba604bd96d2e88261eb616 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-1017 Signed-off-by: Dale Stimson Signed-off-by: Victor Tasayco Loarte --- merrifield/ips/common/WsbmWrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/merrifield/ips/common/WsbmWrapper.c b/merrifield/ips/common/WsbmWrapper.c index 5e050a4..98d8557 100644 --- a/merrifield/ips/common/WsbmWrapper.c +++ b/merrifield/ips/common/WsbmWrapper.c @@ -178,7 +178,7 @@ int psbWsbmAllocateFromUB(uint32_t size, uint32_t align, void ** buf, void *user ret = wsbmBODataUB(wsbmBuf, align_to(size, 4096), NULL, NULL, 0, - user_pt); + user_pt, -1); if(ret) { ETRACE("wsbmBOData failed with error code %d", ret); @@ -297,7 +297,7 @@ int psbWsbmCreateFromUB(void *buf, uint32_t size, void *vaddr) } wsbmBuf = (struct _WsbmBufferObject *)buf; - ret = wsbmBODataUB(wsbmBuf, size, NULL, NULL, 0, vaddr); + ret = wsbmBODataUB(wsbmBuf, size, NULL, NULL, 0, vaddr, -1); if (ret) { ETRACE("wsbmBODataUB failed with error code %d", ret); return ret; -- cgit v1.2.3 From 37c6cdcd54c21a85d14a168cb6905b9e2dd15ba1 Mon Sep 17 00:00:00 2001 From: Victor Tasayco Loarte Date: Mon, 30 Nov 2015 11:49:40 +0100 Subject: IMG HWC: DDK1.5 upgrade for Merrifield Based on following patches: https://android.intel.com/#/c/394225/ https://android.intel.com/#/c/408229/ https://android.intel.com/#/c/394226/ Change-Id: Iead2940d0f033b3a0c91a42a58dc9898ae5cb6ec Orig-Tracked-On: https://jira01.devtools.intel.com/browse/IMINAN-43707 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-1017 Signed-off-by: Jia, Lin A Signed-off-by: Tong, Bo Signed-off-by: Victor Tasayco Loarte --- merrifield/include/pvr/hal/hal_public.h | 249 ++--------------- merrifield/include/pvr/hal/img_gralloc_public.h | 302 +++++++++++++++++++++ merrifield/ips/tangier/TngDisplayContext.cpp | 2 +- merrifield/ips/tangier/TngDisplayContext.h | 14 + merrifield/ips/tangier/TngGrallocBufferMapper.cpp | 35 ++- merrifield/ips/tangier/TngGrallocBufferMapper.h | 2 +- merrifield/platforms/merrifield/Android.mk | 4 +- .../platforms/merrifield/PlatfBufferManager.cpp | 11 +- merrifield/platforms/merrifield_plus/Android.mk | 4 +- .../merrifield_plus/PlatfBufferManager.cpp | 11 +- 10 files changed, 389 insertions(+), 245 deletions(-) create mode 100644 merrifield/include/pvr/hal/img_gralloc_public.h diff --git a/merrifield/include/pvr/hal/hal_public.h b/merrifield/include/pvr/hal/hal_public.h index 9cd6db2..5575719 100644 --- a/merrifield/include/pvr/hal/hal_public.h +++ b/merrifield/include/pvr/hal/hal_public.h @@ -21,237 +21,38 @@ * THE SOFTWARE. */ -#ifndef HAL_PUBLIC_H -#define HAL_PUBLIC_H - -/* Authors of third party hardware composer (HWC) modules will need to include - * this header to access functionality in the gralloc HAL. - */ +#ifndef __HAL_PUBLIC_H +#define __HAL_PUBLIC_H #define PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC -#include -#include - -#define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L)) -#define HW_ALIGN 32 -#define CAMERA_ALIGN 64 - -/** YV12 specific (to handle different alignment) ****************************/ - -/* We must align YV12 to a multiple of 32bytes as NEON optimizations - * in stagefright require the YV12 planes to be 128bit aligned. - * while display controller requires 64 bytes alignement - */ -#define YV12_ALIGN 128 - -#define HAL_PIXEL_FORMAT_BGRX_8888 0x101 // Keep consistent with android_utils.h -enum { - HAL_PIXEL_FORMAT_NV12 = 0x3231564E, // YCrCb 4:2:0 SP - HAL_PIXEL_FORMAT_NV21 = 0x3132564E, // YCrCb 4:2:0 SP - HAL_PIXEL_FORMAT_I420 = 0x30323449, - HAL_PIXEL_FORMAT_YUY2 = 0x32595559, - HAL_PIXEL_FORMAT_UYVY = 0x59565955, - - // Intel video decode formats - HAL_PIXEL_FORMAT_NV12_VED = 0x7FA00E00, //OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar - HAL_PIXEL_FORMAT_NV12_VEDT = 0x7FA00F00, //OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled - - HAL_PIXEL_FORMAT_YCbCr_422_P = 0x12, // IYUV - HAL_PIXEL_FORMAT_YCbCr_420_P = 0x13, // YUV9 - HAL_PIXEL_FORMAT_YCbCr_420_I = 0x15, - - HAL_PIXEL_FORMAT_INTEL_UYVY = 0x107, - HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x108, - HAL_PIXEL_FORMAT_ZSL = 0x109, -}; - -/* This can be tuned down as appropriate for the SOC. - * - * IMG formats are usually a single sub-alloc. - * Some OEM video formats are two sub-allocs (Y, UV planes). - * Future OEM video formats might be three sub-allocs (Y, U, V planes). - */ -#define MAX_SUB_ALLOCS 3 - - -/* This defines the maximum server sync objects used per allocation. */ - -/* Note: It's unfortunate that we have to change the handle size dependent - * on a build option, but we have no choice because 'fd' fields must all - * be utilized so they are valid to be dup'ed, and we don't need some of - * the extra fds in a native_fence_sync build. - */ -#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) -#define MAX_SRV_SYNC_OBJS 2 -#else -#define MAX_SRV_SYNC_OBJS 4 -#endif - -typedef struct -{ - native_handle_t base; - - /* These fields can be sent cross process. They are also valid - * to duplicate within the same process. - * - * A table is stored within psPrivateData on gralloc_module_t (this - * is obviously per-process) which maps stamps to a mapped - * PVRSRV_MEMDESC in that process. Each map entry has a lock - * count associated with it, satisfying the requirements of the - * Android API. This also prevents us from leaking maps/allocations. - * - * This table has entries inserted either by alloc() - * (alloc_device_t) or map() (gralloc_module_t). Entries are removed - * by free() (alloc_device_t) and unmap() (gralloc_module_t). - */ - -#define IMG_NATIVE_HANDLE_NUMFDS (MAX_SRV_SYNC_OBJS + MAX_SUB_ALLOCS) - /* The `syncfd' field is used to export PVRSRV_CLIENT_SYNC_PRIM to - * another process. Its producer/consumer rules should match the - * PVRSRV_MEMDESC handles, except that there is only one sync - * per N memdesc objects. - * - * This should be listed before `fd' because it is not variable - * width. The problem with variable width is that in the case we - * export framebuffer allocations, we may want to patch some of - * the fds to (unused) ints, so we can't leave gaps. - */ - int aiSyncFD[MAX_SRV_SYNC_OBJS]; - - /* The `fd' field is used to "export" a meminfo to another process. - * Therefore, it is allocated by alloc_device_t, and consumed by - * gralloc_module_t. - */ - int fd[MAX_SUB_ALLOCS]; - -#define IMG_NATIVE_HANDLE_NUMINTS ((sizeof(unsigned long long) / sizeof(int)) + 5) - /* A KERNEL unique identifier for any exported kernel meminfo. Each - * exported kernel meminfo will have a unique stamp, but note that in - * userspace, several meminfos across multiple processes could have - * the same stamp. As the native_handle can be dup(2)'d, there could be - * multiple handles with the same stamp but different file descriptors. - */ - unsigned long long ui64Stamp; - - /* This is used for buffer usage validation when locking a buffer, - * and also in WSEGL (for the composition bypass feature). - */ - int usage; +#include "img_gralloc_public.h" - /* In order to do efficient cache flushes we need the buffer dimensions - * and format. These are available on the ANativeWindowBuffer, - * but the platform doesn't pass them down to the graphics HAL. - * - * These fields are also used in the composition bypass. In this - * capacity, these are the "real" values for the backing allocation. - */ - int iWidth; - int iHeight; - int iFormat; - unsigned int uiBpp; -} -__attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t; - -typedef struct -{ - int l, t, w, h; -} -IMG_write_lock_rect_t; - -/* Keep this in sync with SGX */ -typedef int (*IMG_buffer_format_compute_params_pfn)( - unsigned int uiPlane, int *piWidth, int *piHeight, int *piStride, - int *piVStride, unsigned long *pulPlaneOffset); - -#define IMG_BFF_YUV (1 << 0) -#define IMG_BFF_UVCbCrORDERING (1 << 1) -#define IMG_BFF_CPU_CLEAR (1 << 2) -#define IMG_BFF_DONT_GPU_CLEAR (1 << 3) -#define IMG_BFF_PARTIAL_ALLOC (1 << 4) -#define IMG_BFF_NEVER_COMPRESS (1 << 5) - -/* Keep this in sync with SGX */ -typedef struct IMG_buffer_format_public_t -{ - /* Buffer formats are returned as a linked list */ - struct IMG_buffer_format_public_t *psNext; - - /* HAL_PIXEL_FORMAT_... enumerant */ - int iHalPixelFormat; - - /* IMG_PIXFMT_... enumerant */ - int iIMGPixelFormat; - - /* Friendly name for format */ - const char *const szName; - - /* Bits (not bytes) per pixel */ - unsigned int uiBpp; +#undef HAL_PIXEL_FORMAT_NV12 - /* Supported HW usage bits. If this is GRALLOC_USAGE_HW_MASK, all usages - * are supported. Used for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED. - */ - int iSupportedUsage; - - /* Allocation description flags */ - unsigned int uiFlags; - - /* Utility function for adjusting YUV per-plane parameters */ - IMG_buffer_format_compute_params_pfn pfnComputeParams; -} -IMG_buffer_format_public_t; - -typedef struct +typedef struct _IMG_gralloc_module_ { - /* The original hwc layer */ - hwc_layer_1_t *psLayer; - - /* Custom data for the display engine */ - unsigned long custom; + IMG_gralloc_module_public_t base; + void *(*GetDisplayDevice)(struct _IMG_gralloc_module_ *psGrallocModule); + int (*GetDisplayStatus)(struct _IMG_gralloc_module_ *psGrallocModule, + buffer_handle_t handle, uint32_t *pui32Status); + int (*GetBufferCPUAddresses)(gralloc_module_t const* module, + buffer_handle_t buffer, + void **ppvCpuVirtAddr, size_t *puSize); + int (*PutBufferCPUAddresses)(gralloc_module_t const* module, + buffer_handle_t buffer); } -IMG_hwc_layer_t; - -typedef struct IMG_display_device_public_t { - int (*post)(struct IMG_display_device_public_t *dev, IMG_hwc_layer_t *layers, - int num_layers, int *releaseFenceFd); -} IMG_display_device_public_t; +IMG_gralloc_module_t; -typedef struct IMG_gralloc_module_public_t -{ - gralloc_module_t base; - IMG_display_device_public_t *psDisplayDevice; - - /* Gets the head of the linked list of all registered formats */ - const IMG_buffer_format_public_t *(*GetBufferFormats)(void); - - /* Functionality before this point should be in sync with SGX. - * After this point will be different. - */ +#define HAL_PIXEL_FORMAT_UYVY 0x107 +#define HAL_PIXEL_FORMAT_INTEL_ZSL 0x109 +#define HAL_PIXEL_FORMAT_NV12 0x3231564E +#define HAL_PIXEL_FORMAT_NV21 0x3132564E +#define HAL_PIXEL_FORMAT_I420 0x30323449 +#define HAL_PIXEL_FORMAT_YUY2 0x32595559 +#define HAL_PIXEL_FORMAT_NV12_VED 0x7FA00E00 +#define HAL_PIXEL_FORMAT_NV12_VEDT 0x7FA00F00 - /* Custom-blit components in lieu of overlay hardware */ - int (*Blit)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t src, buffer_handle_t dest, - int w, int h, int x, int y, - int filter, - int transform, - int async); - - int (*Blit3)(struct IMG_gralloc_module_public_t const *module, - unsigned long long ui64SrcStamp, int iSrcWidth, - int iSrcHeight, int iSrcFormat, int eSrcRotation, - buffer_handle_t dest, int eDestRotation); - - /* Walk the above list and return only the specified format */ - const IMG_buffer_format_public_t *(*GetBufferFormat)(int iFormat); -/* intel hwc extension */ - int (*getCpuAddress)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t handle, - void **virt, uint32_t *size); - int (*putCpuAddress)(struct IMG_gralloc_module_public_t const *module, - buffer_handle_t handle); - IMG_display_device_public_t *(*getDisplayDevice)(struct IMG_gralloc_module_public_t *module); -} -IMG_gralloc_module_public_t; +#define GRALLOC_MODULE_GET_DISPLAY_STATUS_IMG 1001 -#endif /* HAL_PUBLIC_H */ +#endif /* __HAL_PUBLIC_H */ diff --git a/merrifield/include/pvr/hal/img_gralloc_public.h b/merrifield/include/pvr/hal/img_gralloc_public.h new file mode 100644 index 0000000..1b6ca50 --- /dev/null +++ b/merrifield/include/pvr/hal/img_gralloc_public.h @@ -0,0 +1,302 @@ +/* Copyright (c) Imagination Technologies Ltd. + * + * The contents of this file are subject to the MIT license as set out below. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef HAL_PUBLIC_H +#define HAL_PUBLIC_H + +/* Authors of third party hardware composer (HWC) modules will need to include + * this header to access functionality in the gralloc HAL. + */ + +#include + +#define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L)) +#define HW_ALIGN 32 + +/* Use bits [0-3] of "vendor format" bits as real format. Customers should + * use *only* the unassigned bits below for custom pixel formats, YUV or RGB. + * + * If there are no bits set in this part of the field, or other bits are set + * in the format outside of the "vendor format" mask, the non-extension format + * is used instead. Reserve 0 for this purpose. + */ + +#define HAL_PIXEL_FORMAT_VENDOR_EXT(fmt) (0x100 | (fmt & 0xF)) + +/* Reserved ** DO NOT USE ** HAL_PIXEL_FORMAT_VENDOR_EXT(0) */ +#define HAL_PIXEL_FORMAT_BGRX_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(1) +#define HAL_PIXEL_FORMAT_sBGR_A_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(2) +#define HAL_PIXEL_FORMAT_sBGR_X_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(3) +/* HAL_PIXEL_FORMAT_RGB_565 HAL_PIXEL_FORMAT_VENDOR_EXT(4) */ +/* HAL_PIXEL_FORMAT_BGRA_8888 HAL_PIXEL_FORMAT_VENDOR_EXT(5) */ +#define HAL_PIXEL_FORMAT_NV12 HAL_PIXEL_FORMAT_VENDOR_EXT(6) +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(7) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(8) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(9) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(10) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(11) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(12) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(13) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(14) */ +/* Free for customer use HAL_PIXEL_FORMAT_VENDOR_EXT(15) */ + +/* One of the below compression modes is OR'ed into bits [4-6] of the 8 bit + * "vendor format" field. If no bits are set in this "compression mask", the + * normal memory format for the pixel format is used. Otherwise the pixel + * data will be compressed in memory with the Rogue framebuffer compressor. + */ + +#define HAL_FB_COMPRESSION_NONE 0 +#define HAL_FB_COMPRESSION_DIRECT_8x8 1 +#define HAL_FB_COMPRESSION_DIRECT_16x4 2 +#define HAL_FB_COMPRESSION_DIRECT_32x2 3 +#define HAL_FB_COMPRESSION_INDIRECT_8x8 4 +#define HAL_FB_COMPRESSION_INDIRECT_16x4 5 +#define HAL_FB_COMPRESSION_INDIRECT_4TILE_8x8 6 +#define HAL_FB_COMPRESSION_INDIRECT_4TILE_16x4 7 + +/* The memory layout is OR'ed into bit 7 (top bit) of the 8 bit "vendor + * format" field. Only STRIDED and TWIDDLED are supported; there is no space + * for PAGETILED. + */ +#define HAL_FB_MEMLAYOUT_STRIDED 0 +#define HAL_FB_MEMLAYOUT_TWIDDLED 1 + +/* This can be tuned down as appropriate for the SOC. + * + * IMG formats are usually a single sub-alloc. + * Some OEM video formats are two sub-allocs (Y, UV planes). + * Future OEM video formats might be three sub-allocs (Y, U, V planes). + */ +#define MAX_SUB_ALLOCS (3) + +typedef struct +{ + native_handle_t base; + + /* These fields can be sent cross process. They are also valid + * to duplicate within the same process. + * + * A table is stored within psPrivateData on gralloc_module_t (this + * is obviously per-process) which maps stamps to a mapped + * PVRSRV_MEMDESC in that process. Each map entry has a lock + * count associated with it, satisfying the requirements of the + * Android API. This also prevents us from leaking maps/allocations. + * + * This table has entries inserted either by alloc() + * (alloc_device_t) or map() (gralloc_module_t). Entries are removed + * by free() (alloc_device_t) and unmap() (gralloc_module_t). + */ + +#define IMG_NATIVE_HANDLE_NUMFDS (MAX_SUB_ALLOCS) + /* The `fd' field is used to "export" a meminfo to another process. + * Therefore, it is allocated by alloc_device_t, and consumed by + * gralloc_module_t. + */ + int fd[IMG_NATIVE_HANDLE_NUMFDS]; + + /* This define should represent the number of packed 'int's required to + * represent the fields following it. If you add a data type that is + * 64-bit, for example using 'unsigned long long', you should write that + * as "sizeof(unsigned long long) / sizeof(int)". Please keep the order + * of the additions the same as the defined field order. + */ +#define IMG_NATIVE_HANDLE_NUMINTS \ + (sizeof(unsigned long long) / sizeof(int) + \ + 6 + MAX_SUB_ALLOCS + MAX_SUB_ALLOCS + \ + sizeof(unsigned long long) / sizeof(int) * MAX_SUB_ALLOCS + \ + 1) + /* A KERNEL unique identifier for any exported kernel meminfo. Each + * exported kernel meminfo will have a unique stamp, but note that in + * userspace, several meminfos across multiple processes could have + * the same stamp. As the native_handle can be dup(2)'d, there could be + * multiple handles with the same stamp but different file descriptors. + */ + unsigned long long ui64Stamp; + + /* This is used for buffer usage validation */ + int usage; + + /* In order to do efficient cache flushes we need the buffer dimensions, + * format and bits per pixel. There are ANativeWindow queries for the + * width, height and format, but the graphics HAL might have remapped the + * request to different values at allocation time. These are the 'true' + * values of the buffer allocation. + */ + int iWidth; + int iHeight; + int iFormat; + unsigned int uiBpp; + + /* Planes are not the same as the `fd' suballocs. A multi-planar YUV + * allocation has different planes (interleaved = 1, semi-planar = 2, + * fully-planar = 3) but might be spread across 1, 2 or 3 independent + * memory allocations (or not). + */ + int iPlanes; + + /* For multi-planar allocations, there will be multiple hstrides */ + int aiStride[MAX_SUB_ALLOCS]; + + /* For multi-planar allocations, there will be multiple vstrides */ + int aiVStride[MAX_SUB_ALLOCS]; + + /* These byte offsets are reconciled with the number of sub-allocs used + * for a multi-planar allocation. If there is a 1:1 mapping between the + * number of planes and the number of sub-allocs, these will all be zero. + * + * Otherwise, normally the zeroth entry will be zero, and the latter + * entries will be non-zero. + */ + unsigned long long aulPlaneOffset[MAX_SUB_ALLOCS]; + + /* This records the number of MAX_SUB_ALLOCS fds actually used by the + * buffer allocation. File descriptors up to fd[iNumSubAllocs - 1] are + * guaranteed to be valid. (This does not have any bearing on the aiStride, + * aiVStride or aulPlaneOffset fields, as `iPlanes' of those arrays should + * be initialized, not `iNumSubAllocs'.) + */ + int iNumSubAllocs; +} +__attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t; + +typedef struct +{ + int l, t, w, h; +} +IMG_write_lock_rect_t; + +#define IMG_BFF_YUV (1 << 0) +#define IMG_BFF_UVCbCrORDERING (1 << 1) +#define IMG_BFF_CPU_CLEAR (1 << 2) +#define IMG_BFF_DONT_GPU_CLEAR (1 << 3) +#define IMG_BFF_PARTIAL_ALLOC (1 << 4) +#define IMG_BFF_NEVER_COMPRESS (1 << 5) + +/* Keep this in sync with SGX */ +typedef struct IMG_buffer_format_public_t +{ + /* Buffer formats are returned as a linked list */ + struct IMG_buffer_format_public_t *psNext; + + /* HAL_PIXEL_FORMAT_... enumerant */ + int iHalPixelFormat; + + /* IMG_PIXFMT_... enumerant */ + int iIMGPixelFormat; + + /* Friendly name for format */ + const char *const szName; + + /* Bits (not bytes) per pixel */ + unsigned int uiBpp; + + /* Supported HW usage bits. If this is GRALLOC_USAGE_HW_MASK, all usages + * are supported. Used for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED. + */ + int iSupportedUsage; + + /* Allocation description flags */ + unsigned int uiFlags; +} +IMG_buffer_format_public_t; + +/* NOTE: This interface is deprecated. Use module->perform() instead. */ +typedef struct IMG_gralloc_module_public_t +{ + gralloc_module_t base; + + /* Gets the head of the linked list of all registered formats */ + const IMG_buffer_format_public_t *(*GetBufferFormats)(void); + + /* Custom-blit components in lieu of overlay hardware */ + int (*Blit)(struct IMG_gralloc_module_public_t const *module, + buffer_handle_t src, buffer_handle_t dest, + int w, int h, int x, int y, int transform, + int iInputFenceFd, int *piOutputFenceFd); + + int (*Blit3)(struct IMG_gralloc_module_public_t const *module, + unsigned long long ui64SrcStamp, int iSrcWidth, + int iSrcHeight, int iSrcFormat, int iSrcStrideInPixels, + int eSrcRotation, buffer_handle_t dest, int eDestRotation, + int iInputFenceFd, int *piOutputFenceFd); + + /* Walk the above list and return only the specified format */ + const IMG_buffer_format_public_t *(*GetBufferFormat)(int iFormat); +} +IMG_gralloc_module_public_t; + +/* Helpers for using the non-type-safe perform() extension functions. Use + * these helpers instead of calling perform() directly in your application. + */ + +#define GRALLOC_MODULE_GET_BUFFER_FORMAT_IMG 1 +#define GRALLOC_MODULE_GET_BUFFER_FORMATS_IMG 2 +#define GRALLOC_MODULE_BLIT_HANDLE_TO_HANDLE_IMG 3 +#define GRALLOC_MODULE_BLIT_STAMP_TO_HANDLE_IMG 4 + +static inline int +gralloc_module_get_buffer_format_img(const gralloc_module_t *module, + int format, + const IMG_buffer_format_public_t **v) +{ + return module->perform(module, GRALLOC_MODULE_GET_BUFFER_FORMAT_IMG, + format, v); +} + +static inline int +gralloc_module_get_buffer_formats_img(const gralloc_module_t *module, + const IMG_buffer_format_public_t **v) +{ + return module->perform(module, GRALLOC_MODULE_GET_BUFFER_FORMATS_IMG, v); +} + +static inline int +gralloc_module_blit_handle_to_handle_img(const gralloc_module_t *module, + buffer_handle_t src, + buffer_handle_t dest, + int w, int h, int x, int y, + int transform, int input_fence, + int *output_fence) +{ + return module->perform(module, GRALLOC_MODULE_BLIT_HANDLE_TO_HANDLE_IMG, + src, dest, w, h, x, y, transform, input_fence, + output_fence); +} + +static inline int +gralloc_module_blit_stamp_to_handle(const gralloc_module_t *module, + unsigned long long src_stamp, + int src_width, int src_height, + int src_format, int src_stride_in_pixels, + int src_rotation, buffer_handle_t dest, + int dest_rotation, int input_fence, + int *output_fence) +{ + return module->perform(module, GRALLOC_MODULE_BLIT_STAMP_TO_HANDLE_IMG, + src_stamp, src_width, src_height, src_format, + src_stride_in_pixels, src_rotation, dest, + dest_rotation, input_fence, output_fence); +} + +#endif /* HAL_PUBLIC_H */ diff --git a/merrifield/ips/tangier/TngDisplayContext.cpp b/merrifield/ips/tangier/TngDisplayContext.cpp index 90218d4..fc759dc 100644 --- a/merrifield/ips/tangier/TngDisplayContext.cpp +++ b/merrifield/ips/tangier/TngDisplayContext.cpp @@ -51,7 +51,7 @@ bool TngDisplayContext::initialize() } // init IMG display device - mIMGDisplayDevice = (((IMG_gralloc_module_public_t *)module)->getDisplayDevice((IMG_gralloc_module_public_t *)module)); + mIMGDisplayDevice = (IMG_display_device_public_t *)(((IMG_gralloc_module_t *)module)->GetDisplayDevice((IMG_gralloc_module_t *)module)); if (!mIMGDisplayDevice) { ETRACE("failed to get display device"); return false; diff --git a/merrifield/ips/tangier/TngDisplayContext.h b/merrifield/ips/tangier/TngDisplayContext.h index fa526d7..6a2b1cb 100644 --- a/merrifield/ips/tangier/TngDisplayContext.h +++ b/merrifield/ips/tangier/TngDisplayContext.h @@ -19,6 +19,20 @@ #include #include +typedef struct +{ + hwc_layer_1_t *psLayer; + uint32_t custom; +} +IMG_hwc_layer_t; + +typedef struct IMG_display_device_public +{ + int (*post)(struct IMG_display_device_public *dev, + IMG_hwc_layer_t *layers, int num_layers, int *releaseFenceFd); +} +IMG_display_device_public_t; + namespace android { namespace intel { diff --git a/merrifield/ips/tangier/TngGrallocBufferMapper.cpp b/merrifield/ips/tangier/TngGrallocBufferMapper.cpp index fcf40e7..ed43f25 100644 --- a/merrifield/ips/tangier/TngGrallocBufferMapper.cpp +++ b/merrifield/ips/tangier/TngGrallocBufferMapper.cpp @@ -25,7 +25,7 @@ namespace intel { TngGrallocBufferMapper::TngGrallocBufferMapper(IMG_gralloc_module_public_t& module, DataBuffer& buffer) : GrallocBufferMapperBase(buffer), - mIMGGrallocModule(module), + mIMGGrallocModule(reinterpret_cast(module)), mBufferObject(0) { CTRACE(); @@ -122,10 +122,11 @@ bool TngGrallocBufferMapper::map() CTRACE(); // get virtual address - err = mIMGGrallocModule.getCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle, - vaddr, - size); + err = mIMGGrallocModule.GetBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle, + vaddr, + size); if (err) { ETRACE("failed to map. err = %d", err); return false; @@ -161,8 +162,9 @@ bool TngGrallocBufferMapper::map() } } - err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); return false; } @@ -182,8 +184,9 @@ bool TngGrallocBufferMapper::unmap() mSize[i] = 0; } - err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); if (err) { ETRACE("failed to unmap. err = %d", err); } @@ -236,10 +239,11 @@ buffer_handle_t TngGrallocBufferMapper::getFbHandle(int subIndex) } // get virtual address - err = mIMGGrallocModule.getCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle, - vaddr, - size); + err = mIMGGrallocModule.GetBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle, + vaddr, + size); if (err) { ETRACE("failed to map. err = %d", err); return 0; @@ -250,8 +254,9 @@ buffer_handle_t TngGrallocBufferMapper::getFbHandle(int subIndex) void TngGrallocBufferMapper::putFbHandle() { - int err = mIMGGrallocModule.putCpuAddress(&mIMGGrallocModule, - (buffer_handle_t)mClonedHandle); + int err = mIMGGrallocModule.PutBufferCPUAddresses( + (gralloc_module_t const*)&mIMGGrallocModule, + (buffer_handle_t)mClonedHandle); if (err) { ETRACE("failed to unmap. err = %d", err); } diff --git a/merrifield/ips/tangier/TngGrallocBufferMapper.h b/merrifield/ips/tangier/TngGrallocBufferMapper.h index d72005e..8360e02 100644 --- a/merrifield/ips/tangier/TngGrallocBufferMapper.h +++ b/merrifield/ips/tangier/TngGrallocBufferMapper.h @@ -41,7 +41,7 @@ private: bool mapKhandle(); private: - IMG_gralloc_module_public_t& mIMGGrallocModule; + IMG_gralloc_module_t& mIMGGrallocModule; void* mBufferObject; native_handle_t* mClonedHandle; }; diff --git a/merrifield/platforms/merrifield/Android.mk b/merrifield/platforms/merrifield/Android.mk index 6db9243..f671d82 100644 --- a/merrifield/platforms/merrifield/Android.mk +++ b/merrifield/platforms/merrifield/Android.mk @@ -126,7 +126,9 @@ ifeq ($(TARGET_HAS_MULTIPLE_DISPLAY),true) LOCAL_CFLAGS += -DTARGET_HAS_MULTIPLE_DISPLAY endif -LOCAL_COPY_HEADERS := ../../include/pvr/hal/hal_public.h +LOCAL_COPY_HEADERS := \ + ../../include/pvr/hal/hal_public.h \ + ../../include/pvr/hal/img_gralloc_public.h LOCAL_COPY_HEADERS_TO := pvr/hal ifneq ($(TARGET_BUILD_VARIANT),user) diff --git a/merrifield/platforms/merrifield/PlatfBufferManager.cpp b/merrifield/platforms/merrifield/PlatfBufferManager.cpp index 1dd72c6..13df1a5 100644 --- a/merrifield/platforms/merrifield/PlatfBufferManager.cpp +++ b/merrifield/platforms/merrifield/PlatfBufferManager.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace android { namespace intel { @@ -63,13 +64,21 @@ bool PlatfBufferManager::blit(buffer_handle_t srcHandle, buffer_handle_t destHan { IMG_gralloc_module_public_t *imgGrallocModule = (IMG_gralloc_module_public_t *) mGrallocModule; + int fenceFd; + if (imgGrallocModule->Blit(imgGrallocModule, srcHandle, destHandle, destRect.w, destRect.h, destRect.x, - destRect.y, filter, 0, async)) { + destRect.y, 0, -1, &fenceFd)) { ETRACE("Blit failed"); return false; } + + if (!async) { + sync_wait(fenceFd, -1); + } + close(fenceFd); + return true; } diff --git a/merrifield/platforms/merrifield_plus/Android.mk b/merrifield/platforms/merrifield_plus/Android.mk index 0a85355..3f8b886 100644 --- a/merrifield/platforms/merrifield_plus/Android.mk +++ b/merrifield/platforms/merrifield_plus/Android.mk @@ -129,7 +129,9 @@ ifeq ($(TARGET_HAS_MULTIPLE_DISPLAY),true) LOCAL_CFLAGS += -DTARGET_HAS_MULTIPLE_DISPLAY endif -LOCAL_COPY_HEADERS := ../../include/pvr/hal/hal_public.h +LOCAL_COPY_HEADERS := \ + ../../include/pvr/hal/hal_public.h \ + ../../include/pvr/hal/img_gralloc_public.h LOCAL_COPY_HEADERS_TO := pvr/hal ifneq ($(TARGET_BUILD_VARIANT),user) diff --git a/merrifield/platforms/merrifield_plus/PlatfBufferManager.cpp b/merrifield/platforms/merrifield_plus/PlatfBufferManager.cpp index 1dd72c6..13df1a5 100644 --- a/merrifield/platforms/merrifield_plus/PlatfBufferManager.cpp +++ b/merrifield/platforms/merrifield_plus/PlatfBufferManager.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace android { namespace intel { @@ -63,13 +64,21 @@ bool PlatfBufferManager::blit(buffer_handle_t srcHandle, buffer_handle_t destHan { IMG_gralloc_module_public_t *imgGrallocModule = (IMG_gralloc_module_public_t *) mGrallocModule; + int fenceFd; + if (imgGrallocModule->Blit(imgGrallocModule, srcHandle, destHandle, destRect.w, destRect.h, destRect.x, - destRect.y, filter, 0, async)) { + destRect.y, 0, -1, &fenceFd)) { ETRACE("Blit failed"); return false; } + + if (!async) { + sync_wait(fenceFd, -1); + } + close(fenceFd); + return true; } -- cgit v1.2.3 From f65be044aecd54f462dd0f42b07c238fd3c4aab5 Mon Sep 17 00:00:00 2001 From: mahongpe Date: Mon, 7 Dec 2015 02:38:15 +0800 Subject: Use default csc mode and video range setting for HDMI. Update VideoPayloadBuffer to align with palyload in video driver Bug: 25936176 Change-Id: I5b0ad4d7aa107f4dc4ecca38659ec94c3799447e Signed-off-by: mahongpe --- moorefield_hdmi/ips/common/OverlayPlaneBase.cpp | 6 ++++-- moorefield_hdmi/ips/common/VideoPayloadBuffer.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/moorefield_hdmi/ips/common/OverlayPlaneBase.cpp b/moorefield_hdmi/ips/common/OverlayPlaneBase.cpp index 173f194..5ba55c8 100755 --- a/moorefield_hdmi/ips/common/OverlayPlaneBase.cpp +++ b/moorefield_hdmi/ips/common/OverlayPlaneBase.cpp @@ -1122,6 +1122,9 @@ bool OverlayPlaneBase::colorSetup(BufferMapper& mapper) return false; } + if (mPipeConfig == (0x2 << 6)) + return true; + uint32_t format = mapper.getFormat(); if (format != OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar && format != OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled) { @@ -1147,8 +1150,7 @@ bool OverlayPlaneBase::colorSetup(BufferMapper& mapper) backBuffer->OCONFIG &= ~(1 << 5); backBuffer->OCONFIG |= (payload->csc_mode << 5); - // no level expansion for video on HDMI - if (payload->video_range || mPipeConfig == (0x2 << 6)) { + if (payload->video_range) { // full range, no need to do level expansion backBuffer->OCLRC0 = 0x1000000; backBuffer->OCLRC1 = 0x80; diff --git a/moorefield_hdmi/ips/common/VideoPayloadBuffer.h b/moorefield_hdmi/ips/common/VideoPayloadBuffer.h index e6b1879..e7f0750 100644 --- a/moorefield_hdmi/ips/common/VideoPayloadBuffer.h +++ b/moorefield_hdmi/ips/common/VideoPayloadBuffer.h @@ -63,6 +63,8 @@ struct VideoPayloadBuffer { uint32_t coded_width; uint32_t coded_height; + uint32_t initialized; + uint32_t csc_mode; uint32_t video_range; }; -- cgit v1.2.3