Files
BPI-CM9-Linux/aml-comp/vendor/amlogic/meson_videoserver/displayadapter.cpp
T
2026-08-24 10:03:24 +08:00

120 lines
3.3 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 <memory>
#include <map>
#include <mutex>
#include <DrmTypes.h>
#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);
}
// get drm vsync latency
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);
}
// switch videoplane to main
int32_t dispAdptSetVideoDisplaytoMainplane(int32_t displayId)
{
std::unique_lock<std::mutex> lock(mMutex);
BinderClient& binder = BinderFactory::getInstance();
return binder.setToMainPlane(displayId);
}
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 -1;
std::unique_lock<std::mutex> lock(mMutex);
BinderClient& binder = BinderFactory::getInstance();
return binder.getUiSize(displayId, *width, *height);
}