129 lines
3.5 KiB
C++
129 lines
3.5 KiB
C++
/*
|
|
* Copyright (C) 2024 Amlogic Corporation.
|
|
*
|
|
* 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 <mutex>
|
|
|
|
#include "MesonTypes.h"
|
|
#include "display_interface.h"
|
|
#include "BinderClient.h"
|
|
|
|
std::mutex mMutex;
|
|
|
|
int32_t dispAdptCreateLayer(int32_t displayId, int32_t *layerId)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.createLayer(displayId, layerId);
|
|
}
|
|
|
|
int32_t dispAdptDestroyLayer(int32_t displayId, int32_t layerId)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.destroyLayer(displayId, layerId);
|
|
}
|
|
|
|
int32_t dispAdptSetTunnelId(int32_t displayId, int32_t layerId, int32_t tunnelId)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setTunnelId(displayId, layerId, tunnelId);
|
|
}
|
|
|
|
int32_t dispAdptSetLayerIndex(int32_t displayId, int32_t layerId, int32_t index)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setLayerIndex(displayId, layerId, index);
|
|
}
|
|
|
|
int32_t dispAdptSetLayerZorder(int32_t displayId, int32_t layerId, int32_t zorder)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setLayerZorder(displayId, layerId, zorder);
|
|
}
|
|
|
|
int32_t dispAdptSetLayerSourceCrop(int32_t displayId, int32_t layerId, struct rect crop)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setSourceCrop(displayId, layerId, crop);
|
|
}
|
|
|
|
int32_t dispAdptSetLayerDispFrame(int32_t displayId, int32_t layerId, struct rect frame)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setDisplayFrame(displayId, layerId, frame);
|
|
}
|
|
|
|
int32_t dispAdptGetVsyncDelayLatency(int32_t displayId, int32_t layerId)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.getDelayLatency(displayId, layerId);
|
|
}
|
|
|
|
int32_t dispAdptSetVideoDisplaytoMainplane(int32_t displayId)
|
|
{
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.setToMainPlane(displayId);
|
|
}
|
|
|
|
int32_t dispAdptRegisterCallback(int32_t displayId, int32_t layerId,
|
|
void *context, meson_callback_t *cb)
|
|
{
|
|
return DISPLAY_RETURN_FAIL;
|
|
}
|
|
|
|
int32_t dispAdptGetVideoDelay(int32_t displayId, int32_t fps)
|
|
{
|
|
return DISPLAY_RETURN_FAIL;
|
|
}
|
|
|
|
int32_t dispAdptWaitVBlank(int32_t displayId)
|
|
{
|
|
return DISPLAY_RETURN_FAIL;
|
|
}
|
|
|
|
int32_t dispAdptDestroyDisplay(int32_t displayId)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int32_t dispAdptGetUiSize(int32_t displayId, int32_t *width, int32_t *height)
|
|
{
|
|
if (width == NULL || height == NULL)
|
|
return DISPLAY_RETURN_FAIL;
|
|
|
|
std::unique_lock<std::mutex> lock(mMutex);
|
|
BinderClient& binder = BinderFactory::getInstance();
|
|
|
|
return binder.getUiSize(displayId, *width, *height);
|
|
}
|