interfaces: Import SbwcDecompService
* From https://gitlab.com/Linaro/96boards/e850-96/platform/vendor/samsung_slsi/-/tree/8263c898ccfbbee41e30b405b1f858c5a417ff33/hardware/SbwcDecompService
Change-Id: I5326b6f188018df56ac0e7c6620c46a975214885
diff --git a/Android.bp b/Android.bp
index 00f7daa..e28f1a0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2,3 +2,8 @@
name: "vendor.samsung_slsi.hardware.epic",
path: "hardware/samsung_slsi-linaro/interfaces/epic",
}
+
+hidl_package_root {
+ name: "vendor.samsung_slsi.hardware.SbwcDecompService",
+ path: "hardware/samsung_slsi-linaro/interfaces/SbwcDecompService",
+}
diff --git a/SbwcDecompService/1.0/Android.bp b/SbwcDecompService/1.0/Android.bp
new file mode 100644
index 0000000..dad4a84
--- /dev/null
+++ b/SbwcDecompService/1.0/Android.bp
@@ -0,0 +1,13 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "vendor.samsung_slsi.hardware.SbwcDecompService@1.0",
+ root: "vendor.samsung_slsi.hardware.SbwcDecompService",
+ srcs: [
+ "ISbwcDecompService.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
diff --git a/SbwcDecompService/1.0/ISbwcDecompService.hal b/SbwcDecompService/1.0/ISbwcDecompService.hal
new file mode 100644
index 0000000..b82180e
--- /dev/null
+++ b/SbwcDecompService/1.0/ISbwcDecompService.hal
@@ -0,0 +1,25 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2016 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.
+ */
+
+package vendor.samsung_slsi.hardware.SbwcDecompService@1.0;
+
+interface ISbwcDecompService {
+ decode(handle srcHandle, handle dstHandle, uint32_t attr) generates (int32_t error);
+ decodeWithFramerate(handle srcHandle, handle dstHandle, uint32_t attr, uint32_t framerate) generates (int32_t error);
+ decodeWithCrop(handle srcHandle, handle dstHandle, uint32_t attr, uint32_t cropWidth, uint32_t cropHeight) generates (int32_t error);
+ decodeWithCropAndFps(handle srcHandle, handle dstHandle, uint32_t attr, uint32_t cropWidth, uint32_t cropHeight, uint32_t framerate) generates (int32_t error);
+};
diff --git a/SbwcDecompService/1.0/default/Android.bp b/SbwcDecompService/1.0/default/Android.bp
new file mode 100644
index 0000000..e0c021b
--- /dev/null
+++ b/SbwcDecompService/1.0/default/Android.bp
@@ -0,0 +1,43 @@
+//
+// Copyright Samsung Electronics Co.,LTD.
+// Copyright (C) 2016 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.
+
+cc_binary {
+ name: "vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service",
+ init_rc: ["vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service.rc",],
+ relative_install_path: "hw",
+ proprietary: true,
+ srcs: [
+ "SbwcDecompService.cpp",
+ "service.cpp",
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidlmemory",
+ "libutils",
+ "libcutils",
+ "libbinder",
+ "liblog",
+ "libui",
+ "libion",
+ "libexynosgraphicbuffer",
+ "vendor.samsung_slsi.hardware.SbwcDecompService@1.0",
+ "libsbwcwrapper",
+ ],
+ static_libs: [
+ "libsbwc",
+ ],
+ header_libs: ["libexynos_headers"],
+}
diff --git a/SbwcDecompService/1.0/default/SbwcDecompService.cpp b/SbwcDecompService/1.0/default/SbwcDecompService.cpp
new file mode 100644
index 0000000..ef28ff4
--- /dev/null
+++ b/SbwcDecompService/1.0/default/SbwcDecompService.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2016 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 <memory>
+
+#include <mutex>
+
+#include <ExynosGraphicBuffer.h>
+#include <hardware/exynos/sbwcwrapper.h>
+#include "SbwcDecompService.h"
+
+#define DEFAULT_FRAMERATE 1000
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
+
+namespace vendor {
+namespace samsung_slsi {
+namespace hardware {
+namespace SbwcDecompService {
+namespace V1_0 {
+namespace implementation {
+
+using ::vendor::graphics::ExynosGraphicBufferMeta;
+
+// Methods from ::vendor::samsung_slsi::hardware::SbwcDecompService::V1_0::ISbwcDecompService follow.
+
+Return<int32_t> SbwcDecompService::decode(const hidl_handle &srcHandle, const hidl_handle &dstHandle,
+ uint32_t attr)
+{
+ return decodeWithFramerate(srcHandle, dstHandle, attr, DEFAULT_FRAMERATE);
+}
+
+Return<int32_t> SbwcDecompService::decodeWithFramerate(const hidl_handle &srcHandle, const hidl_handle &dstHandle,
+ uint32_t attr, uint32_t framerate)
+{
+ auto *srcBH = static_cast<buffer_handle_t>(const_cast<native_handle_t*>(srcHandle.getNativeHandle()));
+ if (!srcBH)
+ return android::BAD_VALUE;
+
+ return decodeWithCropAndFps(srcHandle, dstHandle, attr,
+ static_cast<unsigned int>(ExynosGraphicBufferMeta::get_width(srcBH)),
+ static_cast<unsigned int>(ExynosGraphicBufferMeta::get_height(srcBH)), framerate);
+}
+
+Return<int32_t> SbwcDecompService::decodeWithCrop(const hidl_handle &srcHandle, const hidl_handle &dstHandle,
+ uint32_t attr, uint32_t cropWidth, uint32_t cropHeight)
+{
+ return decodeWithCropAndFps(srcHandle, dstHandle, attr, cropWidth, cropHeight, DEFAULT_FRAMERATE);
+}
+
+Return<int32_t> SbwcDecompService::decodeWithCropAndFps(const hidl_handle &srcHandle, const hidl_handle &dstHandle,
+ uint32_t attr, uint32_t cropWidth, uint32_t cropHeight, uint32_t framerate)
+{
+ static std::mutex mDecompMutex;
+
+ ATRACE_CALL();
+
+ std::lock_guard<std::mutex> lock(mDecompMutex);
+
+ static SbwcWrapper *decoder;
+
+ if (!decoder) {
+ decoder = new SbwcWrapper();
+ if (!decoder)
+ return android::NO_MEMORY;
+ }
+
+ auto *srcBH = const_cast<native_handle_t*>(srcHandle.getNativeHandle());
+ if (!srcBH)
+ return android::BAD_VALUE;
+
+ auto *dstBH = const_cast<native_handle_t*>(dstHandle.getNativeHandle());
+ if (!dstBH)
+ return android::BAD_VALUE;
+
+ if (!decoder->decode(static_cast<void*>(srcBH), static_cast<void*>(dstBH), attr, cropWidth, cropHeight, framerate)) {
+ ALOGE("decode is failed");
+ return android::BAD_VALUE;
+ }
+
+ return android::NO_ERROR;
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+//
+} // namespace implementation
+} // namespace V1_0
+} // namespace SbwcDecompService
+} // namespace hardware
+} // namespace samsung_slsi
+} // namespace vendor
diff --git a/SbwcDecompService/1.0/default/SbwcDecompService.h b/SbwcDecompService/1.0/default/SbwcDecompService.h
new file mode 100644
index 0000000..c2d7775
--- /dev/null
+++ b/SbwcDecompService/1.0/default/SbwcDecompService.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2016 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 VENDOR_SAMSUNG_SLSI_HARDWARE_SBWCDECOMPSERVICE_V1_0_SBWCDECOMPSERVICE_H
+#define VENDOR_SAMSUNG_SLSI_HARDWARE_SBWCDECOMPSERVICE_V1_0_SBWCDECOMPSERVICE_H
+
+#include <vendor/samsung_slsi/hardware/SbwcDecompService/1.0/ISbwcDecompService.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <log/log.h>
+
+namespace vendor {
+namespace samsung_slsi {
+namespace hardware {
+namespace SbwcDecompService {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::hidl_handle;
+using ::android::hardware::Return;
+
+struct SbwcDecompService : public ISbwcDecompService {
+ // Methods from ::vendor::samsung_slsi::hardware::SbwcDecompService::V1_0::ISbwcDecompService follow.
+ Return<int32_t> decode(const hidl_handle &srcHandle, const hidl_handle &dstHandle, uint32_t attr) override;
+ Return<int32_t> decodeWithFramerate(const hidl_handle &srcHandle, const hidl_handle &dstHandle, uint32_t attr, uint32_t framerate) override;
+ Return<int32_t> decodeWithCrop(const hidl_handle &srcHandle, const hidl_handle &dstHandle, uint32_t attr, uint32_t cropWidth, uint32_t cropHeight) override;
+ Return<int32_t> decodeWithCropAndFps(const hidl_handle &srcHandle, const hidl_handle &dstHandle, uint32_t attr, uint32_t cropWidth, uint32_t cropHeight, uint32_t framerate) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+
+};
+
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace SbwcDecompService
+} // namespace hardware
+} // namespace samsung_slsi
+} // namespace vendor
+
+#endif
diff --git a/SbwcDecompService/1.0/default/service.cpp b/SbwcDecompService/1.0/default/service.cpp
new file mode 100644
index 0000000..89bc532
--- /dev/null
+++ b/SbwcDecompService/1.0/default/service.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2016 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.
+ */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "SbwcDecompService"
+
+#include <android/log.h>
+#include <hidl/HidlTransportSupport.h>
+#include "SbwcDecompService.h"
+
+using vendor::samsung_slsi::hardware::SbwcDecompService::V1_0::ISbwcDecompService;
+using vendor::samsung_slsi::hardware::SbwcDecompService::V1_0::implementation::SbwcDecompService;
+
+int main() {
+ int res;
+
+ ALOGD("SbwcDecompService start");
+
+ android::hardware::configureRpcThreadpool(
+ 1 /* maxThreads */,
+ true /* callerWillJoin */
+ );
+
+ android::sp<ISbwcDecompService> service = new SbwcDecompService();
+
+ if (service != nullptr) {
+ res = service->registerAsService();
+ if(res != 0)
+ ALOGE("Can't register instance of SbwcDecompService");
+ } else {
+ ALOGE("Can't create instance of SbwcDecompService");
+ }
+
+ android::hardware::joinRpcThreadpool();
+
+ return 0; // should never get here
+
+}
diff --git a/SbwcDecompService/1.0/default/vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service.rc b/SbwcDecompService/1.0/default/vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service.rc
new file mode 100644
index 0000000..9f01ed9
--- /dev/null
+++ b/SbwcDecompService/1.0/default/vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service.rc
@@ -0,0 +1,4 @@
+service SbwcDecompService /vendor/bin/hw/vendor.samsung_slsi.hardware.SbwcDecompService@1.0-service
+ class hal
+ user system
+ group graphics drmrpc
diff --git a/SbwcDecompService/current.txt b/SbwcDecompService/current.txt
new file mode 100644
index 0000000..b95a4af
--- /dev/null
+++ b/SbwcDecompService/current.txt
@@ -0,0 +1 @@
+383d6ba29f881d159fc61c8e7b2c0ef56fe2f4acdc4b914860551d8ced38828f vendor.samsung_slsi.hardware.SbwcDecompService@1.0::ISbwcDecompService
diff --git a/SbwcDecompService/update-makefiles.sh b/SbwcDecompService/update-makefiles.sh
new file mode 100755
index 0000000..af4d22b
--- /dev/null
+++ b/SbwcDecompService/update-makefiles.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+options="-r vendor.samsung_slsi.hardware:vendor/samsung_slsi/hardware \
+ -r android.hidl:system/libhidl/transport \
+ -r android.hardware:hardware/interfaces"
+
+outputs="vendor/samsung_slsi/hardware/SbwcDecompService/1.0/default"
+
+#./out/host/linux-x86/bin/hidl-gen -L c++-headers -o $outputs $options vendor.samsung_slsi.hardware.SbwcDecompService@1.0;
+#./out/host/linux-x86/bin/hidl-gen -Lmakefile $options vendor.samsung_slsi.hardware.SbwcDecompService@1.0;
+./out/host/linux-x86/bin/hidl-gen -Landroidbp $options -o . vendor.samsung_slsi.hardware.SbwcDecompService@1.0;
+
+#./out/host/linux-x86/bin/hidl-gen -L androidbp-impl -o $outputs $options vendor.samsung_slsi.hardware.SbwcDecompService@1.0;
+
+#./out/host/linux-x86/bin/hidl-gen -L hash $options vendor.samsung_slsi.hardware.SbwcDecompService@1.0
+#./out/host/linux-x86/bin/hidl-gen -L c++-impl -o $outputs $options vendor.samsung_slsi.hardware.SbwcDecompService@1.0;