Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gfx mainline merge work #2891

Merged
merged 21 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
afa70e4
Initial rfx progressive integration
Nexarian Dec 16, 2023
65137e6
More integration work from mainline_merge_shm
Nexarian Dec 24, 2023
de2c01a
Updating quantization values to remove corruption.
Nexarian Jan 7, 2024
63e963d
Switching encoder logging statements to LOG not LOG_DEVEL
Nexarian Jan 7, 2024
584a894
Add 0 as valid g_obj_wait timeout instead of having it be equivalent …
Nexarian Jan 7, 2024
1b6ca22
Fix memory leak and RFX encoder notify
Nexarian Jan 8, 2024
5293f13
Fix resize-on-the-fly by processing memory allocation complete.
Nexarian Jan 8, 2024
c961563
GFX: sort versions, flags to return the highest version we support in…
jsorg71 Jan 15, 2024
c08cebb
Making SHM read only from xup
Nexarian Jan 17, 2024
2e1f7f1
Adding KEY_FRAME_REQUESTED parameter.
Nexarian Jan 18, 2024
97b2527
Enabling RFX_PRO key frame handling.
Nexarian Jan 22, 2024
3fab31c
GFX: fix multimon login screen drawing
jsorg71 Jan 23, 2024
ccead29
Fix service call filter.
Jan 25, 2024
e5d455d
error-check xrdp_mm_egfx_send_planar_bitmap() paths
matt335672 Jan 24, 2024
d23d147
Don't enable GFX if client doesn't support 32 BPP
matt335672 Jan 23, 2024
d9783a9
Don't pass drdynvc to neutrinoRDP
matt335672 Jan 25, 2024
54acca4
Resize state machine: A fix and a question (#2929)
matt335672 Jan 31, 2024
33539c1
Gfx mainline merge multimon1 (#2933)
jsorg71 Feb 1, 2024
75b41af
Fix crash with resizing
Nexarian Feb 2, 2024
8027a42
More NPE fix
Nexarian Feb 3, 2024
76242bb
GFX: Relegate some logs to LOG_DEVEL (#2939)
metalefty Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
url = https://github.com/neutrinolabs/librfxcodec.git
branch = .
ignore = untracked

[submodule "libpainter"]
path = libpainter
url = https://github.com/neutrinolabs/libpainter.git
Expand Down
2 changes: 1 addition & 1 deletion common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ libcommon_la_SOURCES = \
$(PIXMAN_SOURCES)

libcommon_la_LIBADD = \
-lpthread \
-lpthread -lrt \
$(OPENSSL_LIBS) \
$(DLOPEN_LIBS)
38 changes: 26 additions & 12 deletions common/ms-rdpbcgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,29 @@

/* TS_UD_HEADER: type ((2.2.1.3.1) */
/* TODO: to be renamed */
#define SEC_TAG_CLI_INFO 0xc001 /* CS_CORE? */
#define SEC_TAG_CLI_CRYPT 0xc002 /* CS_SECURITY? */
#define SEC_TAG_CLI_CHANNELS 0xc003 /* CS_CHANNELS? */
#define SEC_TAG_CLI_4 0xc004 /* CS_CLUSTER? */
#define SEC_TAG_CLI_MONITOR 0xc005 /* CS_MONITOR */
#define SEC_TAG_CLI_MONITOR_EX 0xc008 /* CS_MONITOR_EX */
#define SEC_TAG_CLI_INFO 0xc001 /* CS_CORE? */
#define SEC_TAG_CLI_CRYPT 0xc002 /* CS_SECURITY? */
#define SEC_TAG_CLI_CHANNELS 0xc003 /* CS_CHANNELS? */
#define SEC_TAG_CLI_4 0xc004 /* CS_CLUSTER? */
#define SEC_TAG_CLI_MONITOR 0xc005 /* CS_MONITOR */
#define SEC_TAG_CLI_MONITOR_EX 0xc008 /* CS_MONITOR_EX */

/* Client Core Data: colorDepth, postBeta2ColorDepth (2.2.1.3.2) */
#define RNS_UD_COLOR_4BPP 0xCA00
#define RNS_UD_COLOR_8BPP 0xCA01
#define RNS_UD_COLOR_16BPP_555 0xCA02
#define RNS_UD_COLOR_16BPP_565 0xCA03
#define RNS_UD_COLOR_24BPP 0xCA04
#define RNS_UD_COLOR_4BPP 0xCA00
#define RNS_UD_COLOR_8BPP 0xCA01
#define RNS_UD_COLOR_16BPP_555 0xCA02
#define RNS_UD_COLOR_16BPP_565 0xCA03
#define RNS_UD_COLOR_24BPP 0xCA04

/* Client Core Data: supportedColorDepths (2.2.1.3.2) */
#define RNS_UD_24BPP_SUPPORT 0x0001
#define RNS_UD_16BPP_SUPPORT 0x0002
#define RNS_UD_15BPP_SUPPORT 0x0004
#define RNS_UD_32BPP_SUPPORT 0x0008

/* Client Core Data: earlyCapabilityFlags (2.2.1.3.2) */
#define RNS_UD_CS_WANT_32BPP_SESSION 0x0002
#define RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL 0x0100

/* Client Core Data: connectionType (2.2.1.3.2) */
#define CONNECTION_TYPE_MODEM 0x01
Expand All @@ -75,11 +85,15 @@
#define CONNECTION_TYPE_LAN 0x06
#define CONNECTION_TYPE_AUTODETECT 0x07

/* Channel definition structure CHANNEL_DEF (2.2.1.3.4.1) */
/* TS_UD_CS_NET (2.2.1.3.4) */
/* This isn't explicitly named in MS-RDPBCGR */
#define MAX_STATIC_CHANNELS 31

/* Channel definition structure CHANNEL_DEF (2.2.1.3.4.1) */
#define CHANNEL_NAME_LEN 7
/* These names are also not explicitly defined in MS-RDPBCGR */
#define CLIPRDR_SVC_CHANNEL_NAME "cliprdr"
#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc"
#define RAIL_SVC_CHANNEL_NAME "rail"
#define RDPSND_SVC_CHANNEL_NAME "rdpsnd"
#define RDPDR_SVC_CHANNEL_NAME "rdpdr"
Expand Down
12 changes: 10 additions & 2 deletions common/os_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs, int wcount,
handles[j++] = (HANDLE)(write_objs[i]);
}

if (mstimeout < 1)
if (mstimeout < 0)
{
mstimeout = INFINITE;
}
Expand Down Expand Up @@ -2011,7 +2011,7 @@ g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs, int wcount,
}
else
{
if (mstimeout < 1)
if (mstimeout < 0)
{
mstimeout = -1;
}
Expand Down Expand Up @@ -4199,3 +4199,11 @@ g_no_new_privs(void)
return 0;
#endif
}

/*****************************************************************************/
void
g_qsort(void *base, size_t nitems, size_t size,
int (*compar)(const void *, const void *))
{
qsort(base, nitems, size, compar);
}
8 changes: 7 additions & 1 deletion common/os_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,13 @@ int g_delete_wait_obj(tintptr obj);
* @param rcount Number of elements in read_objs
* @param write_objs Array of write objects
* @param rcount Number of elements in write_objs
* @param mstimeout Timeout in milliseconds. <= 0 means an infinite timeout.
* @param mstimeout Timeout in milliseconds. < 0 means an infinite timeout.
*
* @return 0 for success. The objects will need to be polled to
* find out what is readable or writeable.
*
* An mstimeout of zero will return immediately, although
* error conditions may be checked for.
*/
int g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs,
int wcount, int mstimeout);
Expand Down Expand Up @@ -397,6 +400,9 @@ int g_tcp4_bind_address(int sck, const char *port, const char *address);
int g_tcp6_socket(void);
int g_tcp6_bind_address(int sck, const char *port, const char *address);
int g_no_new_privs(void);
void
g_qsort(void *base, size_t nitems, size_t size,
int (*compar)(const void *, const void *));

/* glib-style wrappers */
#define g_new(struct_type, n_structs) \
Expand Down
20 changes: 19 additions & 1 deletion common/xrdp_client_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ struct xrdp_client_info
int no_orders_supported;
int use_cache_glyph_v2;
int rail_enable;
int suppress_output;
// Mask of reasons why output may be suppressed
// (see enum suppress_output_reason)
unsigned int suppress_output_mask;

int enable_token_login;
char domain_user_separator[16];
Expand All @@ -215,8 +217,24 @@ struct xrdp_client_info
unsigned int session_physical_height; /* in mm */

int large_pointer_support_flags;
int gfx;
};

enum xrdp_encoder_flags
{
NONE = 0,
ENCODE_COMPLETE = 1 << 0,
GFX_PROGRESSIVE_RFX = 1 << 1,
GFX_H264 = 1 << 2,
KEY_FRAME_REQUESTED = 1 << 3
};

/*
* Return true if output is suppressed for a particular reason
*/
#define OUTPUT_SUPPRESSED_FOR_REASON(ci,reason) \
(((ci)->suppress_output_mask & (unsigned int)reason) != 0)

/* yyyymmdd of last incompatible change to xrdp_client_info */
/* also used for changes to all the xrdp installed headers */
#define CLIENT_INFO_CURRENT_VERSION 20230425
Expand Down
46 changes: 46 additions & 0 deletions common/xrdp_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,50 @@
#define XR_RDP_SCAN_LSHIFT 42
#define XR_RDP_SCAN_ALT 56

// Since we're not guaranteed to have pixman, copy these directives.
#define XRDP_PIXMAN_TYPE_ARGB 2
#define XRDP_PIXMAN_TYPE_ABGR 3
#define XRDP_PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \
((type) << 16) | \
((a) << 12) | \
((r) << 8) | \
((g) << 4) | \
((b)))

#define XRDP_a8b8g8r8 \
XRDP_PIXMAN_FORMAT(32, XRDP_PIXMAN_TYPE_ABGR, 8, 8, 8, 8)

#define XRDP_a8r8g8b8 \
XRDP_PIXMAN_FORMAT(32, XRDP_PIXMAN_TYPE_ARGB, 8, 8, 8, 8)

#define XRDP_r5g6b5 \
XRDP_PIXMAN_FORMAT(16, XRDP_PIXMAN_TYPE_ARGB, 0, 5, 6, 5)

#define XRDP_a1r5g5b5 \
XRDP_PIXMAN_FORMAT(16, XRDP_PIXMAN_TYPE_ARGB, 1, 5, 5, 5)

#define XRDP_r3g3b2 \
XRDP_PIXMAN_FORMAT(8, XRDP_PIXMAN_TYPE_ARGB, 0, 3, 3, 2)

// The last used constant in pixman is 63, so use 64+
#define XRDP_nv12 \
XRDP_PIXMAN_FORMAT(12, 64, 0, 0, 0, 0)

#define XRDP_i420 \
XRDP_PIXMAN_FORMAT(12, 65, 0, 0, 0, 0)

#define XRDP_nv12_709fr \
XRDP_PIXMAN_FORMAT(12, 66, 0, 0, 0, 0)

#define XRDP_yuv444_709fr \
XRDP_PIXMAN_FORMAT(32, 67, 0, 0, 0, 0)

// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegfx/8131c1bc-1af8-4907-a05a-f72f4581160f
#define XRDP_yuv444_v1_stream_709fr \
XRDP_PIXMAN_FORMAT(32, 68, 0, 0, 0, 0)

// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegfx/781406c3-5e24-4f2b-b6ff-42b76bf64f6d
#define XRDP_yuv444_v2_stream_709fr \
XRDP_PIXMAN_FORMAT(32, 69, 0, 0, 0, 0)

#endif
4 changes: 3 additions & 1 deletion instfiles/xrdp.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ EnvironmentFile=-@sysconfdir@/sysconfig/xrdp
EnvironmentFile=-@sysconfdir@/default/xrdp
ExecStart=@sbindir@/xrdp $XRDP_OPTIONS --nodaemon
SystemCallArchitectures=native
SystemCallFilter=@basic-io @file-system @io-event @ipc @network-io @process @signal ioctl madvise sysinfo uname
SystemCallFilter=@basic-io @file-system @io-event @ipc @network-io @process
SystemCallFilter=@signal @system-service ioctl madvise sysinfo uname
SystemCallErrorNumber=EPERM

[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions libxrdp/libxrdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,12 @@ libxrdp_reset(struct xrdp_session *session,
return 1;
}

/*
* Stop output from the client during the deactivation-reactivation
* sequence [MS-RDPBCGR] 1.3.1.3 */
xrdp_rdp_suppress_output((struct xrdp_rdp *)session->rdp, 1,
XSO_REASON_DEACTIVATE_REACTIVATE, 0, 0, 0, 0);

/* shut down the rdp client
*
* When resetting the lib, disable application input checks, as
Expand Down
29 changes: 29 additions & 0 deletions libxrdp/libxrdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,20 @@ int
xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s);

/* xrdp_rdp.c */

/**
* Reasons why output is being suppressed or restarted
*/
enum suppress_output_reason
{
/// Client has requested suppress via TS_SUPPRESS_OUTPUT_PDU
XSO_REASON_CLIENT_REQUEST = (1 << 0),
/// Deactivation-Reactivation Sequence [MS-RDPBCGR] 1.3.1.3
XSO_REASON_DEACTIVATE_REACTIVATE = (1 << 1),
/// Dynamic resize in progress
XSO_REASON_DYNAMIC_RESIZE = (1 << 2)
};

struct xrdp_rdp *
xrdp_rdp_create(struct xrdp_session *session, struct trans *trans);
void
Expand Down Expand Up @@ -438,6 +452,21 @@ xrdp_rdp_send_deactivate(struct xrdp_rdp *self);
int
xrdp_rdp_send_session_info(struct xrdp_rdp *self, const char *data,
int data_bytes);
/**
* Request output suppress or resume
*
* @param self RDP struct
* @param suppress (!= 0 for suppress, 0 for resume)
* @param reason Why the output is being suppressed or resumed
* @param left Left pixel of repaint area (ignored for suppress)
* @param top Top pixel of repaint area (ignored for suppress)
* @param right Right pixel of inclusive repaint area (ignored for suppress)
* @param bottom Bottom pixel of inclusive repaint area (ignored for suppress)
*/
void
xrdp_rdp_suppress_output(struct xrdp_rdp *self, int suppress,
enum suppress_output_reason reason,
int left, int top, int right, int bottom);

/* xrdp_orders.c */
struct xrdp_orders *
Expand Down
Loading
Loading