videoout: support PS5 auxiliary buses

This commit is contained in:
nmzik
2026-08-20 20:53:59 +02:00
parent d5410a93c8
commit 767d0b7da9
+13 -15
View File
@@ -43,6 +43,9 @@ constexpr int VIDEO_OUT_EVENT_PRE_VBLANK_START = 2;
constexpr int VIDEO_OUT_EVENT_SET_MODE = 8; constexpr int VIDEO_OUT_EVENT_SET_MODE = 8;
constexpr int VIDEO_OUT_TRUE = 1; constexpr int VIDEO_OUT_TRUE = 1;
constexpr int VIDEO_OUT_FALSE = 0; constexpr int VIDEO_OUT_FALSE = 0;
constexpr int VIDEO_OUT_BUS_TYPE_MAIN = 0;
constexpr int VIDEO_OUT_BUS_TYPE_OVERLAY = 1;
constexpr int VIDEO_OUT_BUS_TYPE_SUB = 2;
constexpr int VIDEO_OUT_FLIP_MODE_VSYNC = 1; constexpr int VIDEO_OUT_FLIP_MODE_VSYNC = 1;
constexpr int VIDEO_OUT_FLIP_MODE_VSYNC_MULTI = 4; constexpr int VIDEO_OUT_FLIP_MODE_VSYNC_MULTI = 4;
constexpr int VIDEO_OUT_BUFFER_INDEX_BLACK = -2; constexpr int VIDEO_OUT_BUFFER_INDEX_BLACK = -2;
@@ -234,7 +237,7 @@ private:
struct VideoOutDriver::Impl { struct VideoOutDriver::Impl {
public: public:
static constexpr int VIDEO_OUT_NUM_MAX = 2; static constexpr int VIDEO_OUT_NUM_MAX = 4;
Impl(uint32_t width, uint32_t height, Graphics::Presenter& presenter) Impl(uint32_t width, uint32_t height, Graphics::Presenter& presenter)
: m_renderer(presenter.Renderer()), m_presenter(presenter), m_flip_queue(presenter) { : m_renderer(presenter.Renderer()), m_presenter(presenter), m_flip_queue(presenter) {
@@ -245,7 +248,7 @@ public:
~Impl(); ~Impl();
KYTY_CLASS_NO_COPY(Impl); KYTY_CLASS_NO_COPY(Impl);
int Open(); int Open(int bus_type);
bool Close(int handle); bool Close(int handle);
VideoOutConfig* Get(int handle); VideoOutConfig* Get(int handle);
VideoOutConfig* Get(int handle, uint64_t& generation); VideoOutConfig* Get(int handle, uint64_t& generation);
@@ -607,19 +610,11 @@ void VideoOutDriver::Impl::Init(uint32_t width, uint32_t height) {
} }
} }
int VideoOutDriver::Impl::Open() { int VideoOutDriver::Impl::Open(int bus_type) {
Common::LockGuard lock(m_mutex); Common::LockGuard lock(m_mutex);
int handle = -1; const int handle = bus_type + 1;
if (m_video_out_ctx[handle].opened) {
for (int i = 1; i < VIDEO_OUT_NUM_MAX; i++) {
if (!m_video_out_ctx[i].opened) {
handle = i;
break;
}
}
if (handle < 0) {
return -1; return -1;
} }
auto& config = m_video_out_ctx[handle]; auto& config = m_video_out_ctx[handle];
@@ -1173,12 +1168,15 @@ KYTY_SYSV_ABI int VideoOutOpen(int user_id, int bus_type, int index, const void*
PRINT_NAME(); PRINT_NAME();
EXIT_NOT_IMPLEMENTED(user_id != 255 && user_id != 0); EXIT_NOT_IMPLEMENTED(user_id != 255 && user_id != 0);
EXIT_NOT_IMPLEMENTED(bus_type != 0); if (bus_type != VIDEO_OUT_BUS_TYPE_MAIN && bus_type != VIDEO_OUT_BUS_TYPE_OVERLAY &&
bus_type != VIDEO_OUT_BUS_TYPE_SUB) {
return VIDEO_OUT_ERROR_INVALID_VALUE;
}
EXIT_NOT_IMPLEMENTED(index != 0); EXIT_NOT_IMPLEMENTED(index != 0);
LOGF("\t param = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(param)); LOGF("\t param = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(param));
int handle = DriverState().Open(); int handle = DriverState().Open(bus_type);
if (handle < 0) { if (handle < 0) {
return VIDEO_OUT_ERROR_RESOURCE_BUSY; return VIDEO_OUT_ERROR_RESOURCE_BUSY;