Skip to content

Commit

Permalink
work on multimonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorg71 committed Oct 4, 2023
1 parent 9b5e888 commit b4f6704
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
25 changes: 16 additions & 9 deletions module/rdpCapture.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,8 @@ rdpCopyBox_a8r8g8b8_to_yuv444_709fr(rdpClientCon *clientCon,
/******************************************************************************/
static Bool
rdpCopyBoxList(rdpClientCon *clientCon, PixmapPtr dstPixmap,
BoxPtr out_rects, int num_out_rects)
BoxPtr out_rects, int num_out_rects,
int mon_left, int mon_top)
{
PixmapPtr hwPixmap;
BoxPtr pbox;
Expand Down Expand Up @@ -852,7 +853,9 @@ rdpCopyBoxList(rdpClientCon *clientCon, PixmapPtr dstPixmap,
copyGC->ops->CopyArea(&(hwPixmap->drawable),
&(dstPixmap->drawable),
copyGC, left, top,
width, height, left, top);
width, height,
left - mon_left,
top - mon_top);
}
}
FreeScratchGC(copyGC);
Expand Down Expand Up @@ -921,7 +924,7 @@ rdpCapture0(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
{
/* copy vmem to smem */
if (!rdpCopyBoxList(clientCon, clientCon->dev->screenSwPixmap,
*out_rects, *num_out_rects))
*out_rects, *num_out_rects, id->left, id->top))
{
return FALSE;
}
Expand Down Expand Up @@ -1077,7 +1080,7 @@ rdpCapture1(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
{
/* copy vmem to smem */
if (!rdpCopyBoxList(clientCon, clientCon->dev->screenSwPixmap,
*out_rects, *num_out_rects))
*out_rects, *num_out_rects, id->left, id->top))
{
return FALSE;
}
Expand Down Expand Up @@ -1171,7 +1174,8 @@ rdpCapture2(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
{
/* copy vmem to smem */
if (!rdpCopyBoxList(clientCon, clientCon->dev->screenSwPixmap,
REGION_RECTS(in_reg), REGION_NUM_RECTS(in_reg)))
REGION_RECTS(in_reg), REGION_NUM_RECTS(in_reg),
id->left, id->top))
{
return FALSE;
}
Expand Down Expand Up @@ -1327,6 +1331,7 @@ rdpCapture3(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
int src_stride;
int dst_stride;
int dst_format;
int monitor_index;

LLOGLN(10, ("rdpCapture3:"));

Expand Down Expand Up @@ -1381,11 +1386,13 @@ rdpCapture3(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
*out_rects = lout_rects;
*num_out_rects = num_rects;

if (clientCon->helperPixmaps[0] != NULL)
monitor_index = (id->flags >> 28) & 0xF;
if (clientCon->helperPixmaps[monitor_index] != NULL)
{
/* copy vmem to vmem */
rv = rdpCopyBoxList(clientCon, clientCon->helperPixmaps[0],
*out_rects, *num_out_rects);
rv = rdpCopyBoxList(clientCon,
clientCon->helperPixmaps[monitor_index],
*out_rects, *num_out_rects, id->left, id->top);
id->flags |= 1;
return rv;
/* helper will do the rest */
Expand All @@ -1394,7 +1401,7 @@ rdpCapture3(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects,
{
/* copy vmem to smem */
rv = rdpCopyBoxList(clientCon, clientCon->dev->screenSwPixmap,
*out_rects, *num_out_rects);
*out_rects, *num_out_rects, id->left, id->top);
}

src = id->pixels;
Expand Down
27 changes: 17 additions & 10 deletions module/rdpClientCon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,8 @@ rdpSendHelperMonitors(rdpPtr dev, rdpClientCon *clientCon)
clientCon->count++;
if (dev->monitorCount < 1)
{
width = RDPALIGN(dev->width, XRDP_H264_ALIGN);
height = RDPALIGN(dev->height, XRDP_H264_ALIGN);
width = dev->width;
height = dev->height;
out_uint16_le(clientCon->out_s, 2);
out_uint16_le(clientCon->out_s, 20); /* size */
out_uint16_le(clientCon->out_s, width);
Expand All @@ -1061,8 +1061,8 @@ rdpSendHelperMonitors(rdpPtr dev, rdpClientCon *clientCon)
{
for (index = 0; index < dev->monitorCount; index++)
{
width = RDPALIGN(dev->minfo[index].right - dev->minfo[index].left, XRDP_H264_ALIGN);
height = RDPALIGN(dev->minfo[index].bottom - dev->minfo[index].top, XRDP_H264_ALIGN);
width = dev->minfo[index].right - dev->minfo[index].left + 1;
height = dev->minfo[index].bottom - dev->minfo[index].top + 1;
out_uint16_le(clientCon->out_s, 2);
out_uint16_le(clientCon->out_s, 20); /* size */
out_uint16_le(clientCon->out_s, width);
Expand Down Expand Up @@ -2799,10 +2799,8 @@ rdpClientConSendPaintRectShmFd(rdpPtr dev, rdpClientCon *clientCon,
out_uint16_le(s, id->height);
out_uint16_le(s, clientCon->cap_width);
out_uint16_le(s, clientCon->cap_height);

rdpClientConSendPending(clientCon->dev, clientCon);
g_sck_send_fd_set(clientCon->sck, "int", 4, &(id->shmem_fd), 1);

}
else if (capture_code == 4) /* gfx pro rfx */
{
Expand Down Expand Up @@ -2866,12 +2864,16 @@ rdpClientConSendPaintRectShmFd(rdpPtr dev, rdpClientCon *clientCon,
out_uint32_le(s, end_frame_bytes); /* cmd_bytes */
out_uint32_le(s, clientCon->rect_id); /* frame_id */

out_uint32_le(s, id->shmem_bytes); /* shmem_bytes */
if (id->shmem_bytes > 0)
if ((id->shmem_bytes > 0) && ((id->flags & 1) == 0))
{
out_uint32_le(s, id->shmem_bytes); /* shmem_bytes */
rdpClientConSendPending(clientCon->dev, clientCon);
g_sck_send_fd_set(clientCon->sck, "int", 4, &(id->shmem_fd), 1);
}
else
{
out_uint32_le(s, 0); /* shmem_bytes */
}
}
else if (capture_code == 5) /* gfx h264 */
{
Expand Down Expand Up @@ -2934,12 +2936,16 @@ rdpClientConSendPaintRectShmFd(rdpPtr dev, rdpClientCon *clientCon,
out_uint32_le(s, end_frame_bytes); /* cmd_bytes */
out_uint32_le(s, clientCon->rect_id); /* frame_id */

out_uint32_le(s, id->shmem_bytes); /* shmem_bytes */
if (id->shmem_bytes > 0)
if ((id->shmem_bytes > 0) && ((id->flags & 1) == 0))
{
out_uint32_le(s, id->shmem_bytes); /* shmem_bytes */
rdpClientConSendPending(clientCon->dev, clientCon);
g_sck_send_fd_set(clientCon->sck, "int", 4, &(id->shmem_fd), 1);
}
else
{
out_uint32_le(s, 0); /* shmem_bytes */
}
}

rdpClientConEndUpdate(dev, clientCon);
Expand Down Expand Up @@ -3119,6 +3125,7 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
cap_rect.y1 = clientCon->dev->minfo[index].top;
cap_rect.x2 = clientCon->dev->minfo[index].right + 1;
cap_rect.y2 = clientCon->dev->minfo[index].bottom + 1;
rdpClientConGetScreenImageRect(clientCon->dev, clientCon, &id);
id.left = cap_rect.x1;
id.top = cap_rect.y1;
id.width = cap_rect.x2 - cap_rect.x1;
Expand Down
8 changes: 4 additions & 4 deletions module/rdpLRandR.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ mode ids 33 48
#define LRRNumberRequests 32 /* 1.3 */
#define LRRMaxCrtcs 16
#define LRRMaxOutputs 16
#define LRRMaxOutputNameLength 16
#define LRRMaxOutputNameLength 32
#define LRRMaxModes 16
#define LRRMaxModesNameLength 16
#define LRRMaxModesNameLength 32
#define LRRCrtcStart 1
#define LRROutputStart 17
#define LRRModeStart 33
Expand Down Expand Up @@ -1326,8 +1326,8 @@ rdpLRRSetRdpOutputs(rdpPtr dev)
{
g_crtcs[index].x = dev->minfo[index].left;
g_crtcs[index].y = dev->minfo[index].top;
width = dev->minfo[index].right - dev->minfo[index].left;
height = dev->minfo[index].bottom - dev->minfo[index].top;
width = dev->minfo[index].right - dev->minfo[index].left + 1;
height = dev->minfo[index].bottom - dev->minfo[index].top + 1;
g_crtcs[index].width = width;
g_crtcs[index].height = height;
g_modes[index].width = width;
Expand Down

0 comments on commit b4f6704

Please sign in to comment.