Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/ulalaca-xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGyuhwan Park <unstabler@unstabler.pl>2022-10-07 09:00:37 +0300
committerGyuhwan Park <unstabler@unstabler.pl>2022-10-07 09:00:37 +0300
commit51407a6b9cdacfdc7f08069a999def6ee17f060c (patch)
tree02246164a1f21fd43bfd327bc43de55a715e5106
parentac7d15d8d5d5ba6b8a02a938a4bf1c71b285807c (diff)
feature: implement PˆROJECTION_SET_VIEWPORT, PROJECTION_START/STOP
-rw-r--r--IPCConnection.cpp6
-rw-r--r--ProjectionThread.cpp18
-rw-r--r--ProjectionThread.hpp3
-rw-r--r--ulalaca.cpp38
4 files changed, 50 insertions, 15 deletions
diff --git a/IPCConnection.cpp b/IPCConnection.cpp
index 317a27d..f744fa1 100644
--- a/IPCConnection.cpp
+++ b/IPCConnection.cpp
@@ -91,6 +91,7 @@ void IPCConnection::workerLoop() {
bool canWrite = (pollFd.revents & POLLOUT) > 0;
if (canWrite && !_writeTasks.empty()) {
+ std::scoped_lock<std::mutex> scopedWriteTasksLock(_writeTasksLock);
auto &writeTask = _writeTasks.front();
if (_socket.write(writeTask.second.get(), writeTask.first) < 0) {
@@ -102,10 +103,7 @@ void IPCConnection::workerLoop() {
continue;
}
- {
- std::scoped_lock<std::mutex> scopedWriteTasksLock(_writeTasksLock);
- _writeTasks.pop();
- }
+ _writeTasks.pop();
}
if (canRead && !_readTasks.empty()) {
diff --git a/ProjectionThread.cpp b/ProjectionThread.cpp
index eabc558..0e48a2c 100644
--- a/ProjectionThread.cpp
+++ b/ProjectionThread.cpp
@@ -153,6 +153,24 @@ void ProjectionThread::handleEvent(XrdpEvent &event) {
}
}
+void ProjectionThread::setViewport(ULIPCRect rect) {
+ _ipcConnection.writeMessage(TYPE_PROJECTION_SET_VIEWPORT, ULIPCProjectionSetViewport {
+ 0, (uint16_t) rect.width, (uint16_t) rect.height, 0
+ });
+}
+
+void ProjectionThread::setOutputSuppression(bool isOutputSuppressed) {
+ if (isOutputSuppressed) {
+ _ipcConnection.writeMessage(TYPE_PROJECTION_STOP, ULIPCProjectionStop {
+ 0
+ });
+ } else {
+ _ipcConnection.writeMessage(TYPE_PROJECTION_START, ULIPCProjectionStart {
+ 0
+ });
+ }
+}
+
void ProjectionThread::mainLoop() {
while (!_isTerminated) {
auto header = _ipcConnection.nextHeader();
diff --git a/ProjectionThread.hpp b/ProjectionThread.hpp
index c8be1bf..2e4a3b3 100644
--- a/ProjectionThread.hpp
+++ b/ProjectionThread.hpp
@@ -30,6 +30,9 @@ public:
void stop();
void handleEvent(XrdpEvent &event);
+ void setViewport(ULIPCRect rect);
+
+ void setOutputSuppression(bool isOutputSuppressed);
private:
void mainLoop();
diff --git a/ulalaca.cpp b/ulalaca.cpp
index cd3d7b9..e785879 100644
--- a/ulalaca.cpp
+++ b/ulalaca.cpp
@@ -139,6 +139,10 @@ int XrdpUlalaca::lib_mod_connect(XrdpUlalaca *_this) {
);
_this->_projectionThread->start();
+
+ LOG(LOG_LEVEL_TRACE, "sessionSize: %d, %d", _this->_sessionSize.width, _this->_sessionSize.height);
+ _this->_projectionThread->setViewport(_this->_sessionSize);
+ _this->_projectionThread->setOutputSuppression(false);
} catch (SystemCallException &e) {
_this->serverMessage(e.what(), 0);
return 1;
@@ -170,18 +174,17 @@ int XrdpUlalaca::lib_mod_session_change(XrdpUlalaca *_this, int, int) {
int XrdpUlalaca::lib_mod_get_wait_objs(XrdpUlalaca *_this, tbus *read_objs, int *rcount, tbus *write_objs, int *wcount,
int *timeout) {
-
- LOG(LOG_LEVEL_INFO, "lib_mod_get_wait_objs() called");
+ // LOG(LOG_LEVEL_INFO, "lib_mod_get_wait_objs() called");
return 0;
}
int XrdpUlalaca::lib_mod_check_wait_objs(XrdpUlalaca *_this) {
- LOG(LOG_LEVEL_INFO, "lib_mod_check_wait_objs() called");
+ // LOG(LOG_LEVEL_INFO, "lib_mod_check_wait_objs() called");
return 0;
}
int XrdpUlalaca::lib_mod_frame_ack(XrdpUlalaca *_this, int flags, int frame_id) {
- LOG(LOG_LEVEL_INFO, "lib_mod_frame_ack() called: %d", frame_id);
+ LOG(LOG_LEVEL_TRACE, "lib_mod_frame_ack() called: %d", frame_id);
_this->_ackFrameId = frame_id;
return 0;
@@ -255,14 +258,13 @@ int XrdpUlalaca::decideCopyRectSize() const {
bool isH264Codec = _clientInfo.h264_codec_id != 0;
bool isGFXH264Codec = _clientInfo.capture_code & 3;
+ if (isRFXCodec) {
+ return 64;
+ }
if (isH264Codec || isGFXH264Codec) {
return RECT_SIZE_BYPASS_CREATE;
}
-
- if (isRFXCodec || isJPEGCodec) {
- return 64;
- }
return RECT_SIZE_BYPASS_CREATE;
}
@@ -313,12 +315,15 @@ void XrdpUlalaca::addDirtyRect(Rect &rect) {
}
void XrdpUlalaca::commitUpdate(const uint8_t *image, int32_t width, int32_t height) {
- LOG(LOG_LEVEL_TRACE, "commiting screen update: %d, %d", width, height);
+ LOG(LOG_LEVEL_TRACE, "updating screen: %d, %d", width, height);
- std::scoped_lock<std::mutex> scopedCommitLock(_commitUpdateLock);
+ if (!_commitUpdateLock.try_lock()) {
+ _dirtyRects.clear();
+ return;
+ }
if (_sessionSize.width != width || _sessionSize.height != height) {
- server_reset(this, width, height, _bpp);
+ // server_reset(this, width, height, _bpp);
}
if (_frameId > 0 && _dirtyRects.empty()) {
@@ -346,6 +351,15 @@ void XrdpUlalaca::commitUpdate(const uint8_t *image, int32_t width, int32_t heig
auto dirtyRects = std::vector<Rect>{screenRect};
auto copyRects = createCopyRects(dirtyRects, copyRectSize);
+ server_paint_rect(
+ this,
+ screenRect.x, screenRect.y,
+ screenRect.width, screenRect.height,
+ (char *) image,
+ screenRect.width, screenRect.height,
+ 0, 0
+ );
+
server_paint_rects(
this,
dirtyRects.size(), reinterpret_cast<short *>(dirtyRects.data()),
@@ -360,6 +374,8 @@ void XrdpUlalaca::commitUpdate(const uint8_t *image, int32_t width, int32_t heig
_dirtyRects.clear();
server_end_update(this);
+
+ _commitUpdateLock.unlock();
}
void XrdpUlalaca::calculateSessionSize() {