-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HWCLayer, HWCCallbacks and implement HWC2 layer functionality. Change-Id: Ic7764e72f4cae534e68764df4cf80eb3db982071
- Loading branch information
Showing
22 changed files
with
5,707 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CMakeLists.txt | ||
.idea/ | ||
.editorconfig | ||
.clang-complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortBlocksOnASingleLine: false | ||
ColumnLimit: 100 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
DerivePointerAlignment: false | ||
PointerAlignment: Right | ||
#ReflowComments: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
include $(LOCAL_PATH)/../../../common.mk | ||
|
||
ifeq ($(use_hwc2),true) | ||
|
||
LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM) | ||
LOCAL_MODULE_RELATIVE_PATH := hw | ||
LOCAL_MODULE_TAGS := optional | ||
LOCAL_C_INCLUDES := $(common_includes) | ||
|
||
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \ | ||
-std=c++11 -fcolor-diagnostics\ | ||
-DLOG_TAG=\"SDM\" $(common_flags) \ | ||
-I $(display_top)/sdm/libs/hwc | ||
LOCAL_CLANG := true | ||
|
||
LOCAL_SHARED_LIBRARIES := libsdmcore libqservice libbinder libhardware libhardware_legacy \ | ||
libutils libcutils libsync libmemalloc libqdutils libdl \ | ||
libpowermanager libsdmutils libc++ | ||
|
||
LOCAL_SRC_FILES := hwc_session.cpp \ | ||
hwc_display.cpp \ | ||
hwc_display_primary.cpp \ | ||
hwc_display_external.cpp \ | ||
hwc_display_virtual.cpp \ | ||
../hwc/hwc_debugger.cpp \ | ||
../hwc/hwc_buffer_allocator.cpp \ | ||
../hwc/hwc_buffer_sync_handler.cpp \ | ||
hwc_color_manager.cpp \ | ||
hwc_layers.cpp \ | ||
hwc_callbacks.cpp \ | ||
../hwc/blit_engine_c2d.cpp \ | ||
../hwc/cpuhint.cpp | ||
|
||
include $(BUILD_SHARED_LIBRARY) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (c) 2016, The Linux Foundation. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of The Linux Foundation. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
#include <utils/constants.h> | ||
#include <utils/debug.h> | ||
#include "hwc_callbacks.h" | ||
|
||
#define __CLASS__ "HWCCallbacks" | ||
|
||
namespace sdm { | ||
|
||
void HWCCallbacks::Hotplug(hwc2_display_t display, HWC2::Connection state) { | ||
if (hotplug_) { | ||
hotplug_(hotplug_data_, display, INT32(state)); | ||
} | ||
} | ||
|
||
void HWCCallbacks::Refresh(hwc2_display_t display) { | ||
if (refresh_) { | ||
refresh_(refresh_data_, display); | ||
} | ||
} | ||
|
||
void HWCCallbacks::Vsync(hwc2_display_t display, int64_t timestamp) { | ||
if (vsync_) { | ||
vsync_(vsync_data_, display, timestamp); | ||
} | ||
} | ||
|
||
HWC2::Error HWCCallbacks::Register(HWC2::Callback descriptor, hwc2_callback_data_t callback_data, | ||
hwc2_function_pointer_t pointer) { | ||
switch (descriptor) { | ||
case HWC2::Callback::Hotplug: | ||
hotplug_data_ = callback_data; | ||
hotplug_ = reinterpret_cast<HWC2_PFN_HOTPLUG>(pointer); | ||
break; | ||
case HWC2::Callback::Refresh: | ||
refresh_data_ = callback_data; | ||
refresh_ = reinterpret_cast<HWC2_PFN_REFRESH>(pointer); | ||
break; | ||
case HWC2::Callback::Vsync: | ||
vsync_data_ = callback_data; | ||
vsync_ = reinterpret_cast<HWC2_PFN_VSYNC>(pointer); | ||
break; | ||
default: | ||
return HWC2::Error::BadParameter; | ||
} | ||
return HWC2::Error::None; | ||
} | ||
|
||
} // namespace sdm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2016, The Linux Foundation. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of The Linux Foundation. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef __HWC_CALLBACKS_H__ | ||
#define __HWC_CALLBACKS_H__ | ||
|
||
#define HWC2_INCLUDE_STRINGIFICATION | ||
#define HWC2_USE_CPP11 | ||
#include <hardware/hwcomposer2.h> | ||
#undef HWC2_INCLUDE_STRINGIFICATION | ||
#undef HWC2_USE_CPP11 | ||
|
||
namespace sdm { | ||
|
||
class HWCCallbacks { | ||
public: | ||
void Hotplug(hwc2_display_t display, HWC2::Connection state); | ||
void Refresh(hwc2_display_t display); | ||
void Vsync(hwc2_display_t display, int64_t timestamp); | ||
HWC2::Error Register(HWC2::Callback, hwc2_callback_data_t callback_data, | ||
hwc2_function_pointer_t pointer); | ||
|
||
private: | ||
hwc2_callback_data_t hotplug_data_ = nullptr; | ||
hwc2_callback_data_t refresh_data_ = nullptr; | ||
hwc2_callback_data_t vsync_data_ = nullptr; | ||
|
||
HWC2_PFN_HOTPLUG hotplug_ = nullptr; | ||
HWC2_PFN_REFRESH refresh_ = nullptr; | ||
HWC2_PFN_VSYNC vsync_ = nullptr; | ||
}; | ||
|
||
} // namespace sdm | ||
|
||
#endif // __HWC_CALLBACKS_H__ |
Oops, something went wrong.