Skip to content

Add support for Xlibre#406

Open
metalefty wants to merge 5 commits into
neutrinolabs:develfrom
metalefty:xlibre
Open

Add support for Xlibre#406
metalefty wants to merge 5 commits into
neutrinolabs:develfrom
metalefty:xlibre

Conversation

@metalefty
Copy link
Copy Markdown
Member

Adding Xlibre support on devel branch is a bit complicated. Need some work on glamor.

@jsorg71 @matt335672 Can you help?

@matt335672
Copy link
Copy Markdown
Member

I'll set up a FreeBSD 14.3 VM and try to reproduce this.

Based on my previous experiences with Enrico Weigelt (see e.g. #362) I think it likely that some of the functions we need have been removed from the public module interface. I'll have a look and try to get more analysis of the problem first.

@matt335672
Copy link
Copy Markdown
Member

These PRs seem to have caused this based on the log. I've not tested reverting them yet:

@jsorg71 - if we want to get Glamor working with XLibre do we have any alternative than to ask for these to be re-added into the public interface?

@metalefty
Copy link
Copy Markdown
Member Author

Alternatively, we can drop support glamor with Xlibre. Not many people want Xlibre support, so it will be fine limited support.

@matt335672
Copy link
Copy Markdown
Member

I don't think anyone knows how successful Xlibre is going to be, so it's hard to know if it's worth expending the effort to fix it.

It's possible over time that xorgxrdp will have more problems with Xlibre than just Glamor.

@metalefty
Copy link
Copy Markdown
Member Author

I agree. But it appears Enrico Weigelt is cooperative in creating the APIs if we need them, as done in #364.
Anyway, I'll try to make it work by setting Glamor and Xlibre exclusive.

Could you also check the xorgxrdpCheckWrap issue?

@matt335672
Copy link
Copy Markdown
Member

@metalefty - what exactly is the xorgxrdpCheckWrap issue?

I've had a play, and if I make this change:

diff --git a/module/rdpMain.c b/module/rdpMain.c
index cca3d6f..0b1909a 100644
--- a/module/rdpMain.c
+++ b/module/rdpMain.c
@@ -488,6 +488,7 @@ xorgxrdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
 int
 xorgxrdpCheckWrap(void)
 {
+#if 0
     if (g_nvidia_wrap_done)
     {
         return 0;
@@ -510,6 +511,7 @@ xorgxrdpCheckWrap(void)
         xf86DriverList[0]->platformProbe = xorgxrdpPlatformProbe;
         xf86DriverList[0]->driverFunc = xorgxrdpDriverFunc;
     }
+#endif
     return 0;
 }
 

Everything builds and tests without --enable-glamor

With the code in, we get the following error on make check:

mjb@freebsd14-xlibre:~/xorgxrdp $ grep EE tests/test-xorg.log
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[2026-02-10 10:52:44] (EE) Failed to load /home/mjb/xorgxrdp/module/.libs/libxorgxrdp.so: /home/mjb/xorgxrdp/module/.libs/libxorgxrdp.so: Undefined symbol "xf86NumDrivers"
[2026-02-10 10:52:44] (EE) Failed to load module "xorgxrdp" (loader failed, 0)

This is down to this commit:

X11Libre/xserver@8a0ec43

I can't think of a clean way around this. There's a hacky way, but I'd rather not suggest it! Any thoughts, @jsorg71?

@metalefty
Copy link
Copy Markdown
Member Author

The xorgxrdpCheckWrap issue I meant is

meta@xlibre:~/xorgxrdp $ make check
Making check in module
Making check in amd64
Making check in tests
Making check in yuv2rgb
make  yuv2rgb_speed  yuv2rgb_speed.sh
`yuv2rgb_speed' is up to date.
`yuv2rgb_speed.sh' is up to date.
make  check-TESTS
PASS: yuv2rgb_speed.sh
============================================================================
Testsuite summary for xorgxrdp 0.10.80
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make  xorg-test-run.sh
`xorg-test-run.sh' is up to date.
make  check-TESTS
FAIL: xorg-test-run.sh
============================================================================
Testsuite summary for xorgxrdp 0.10.80
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log for debugging.
Some test(s) failed.  Please report this to xrdp-devel@googlegroups.com,
together with the test-suite.log file (gzipped) and your system
information.  Thanks.
============================================================================
*** Error code 1

Stop.
make[4]: stopped making "test-suite.log" in /usr/home/meta/xorgxrdp/tests
*** Error code 1

Stop.
make[3]: stopped making "check-TESTS" in /usr/home/meta/xorgxrdp/tests
*** Error code 1

Stop.
make[2]: stopped making "check-am" in /usr/home/meta/xorgxrdp/tests
*** Error code 1

Stop.
make[1]: stopped making "check" in /usr/home/meta/xorgxrdp/tests
*** Error code 1

Stop.
make: stopped making "check" in /usr/home/meta/xorgxrdp
meta@xlibre:~/xorgxrdp $ LD_BIND_NOW=1 /usr/local/libexec/Xorg -modulepath /home/meta/xorgxrdp/xrdpmouse/.libs,/home/meta/xorgxrdp/xrdpkeyb/.libs,/home/meta/xorgxrdp/xrdpdev/.libs,/home/meta/xorgxrdp/module/.libs,/usr/local/lib/xorg/modules/xlibre-25 -config /home/meta/xorgxrdp/xrdpdev/xorg.conf -logfile test-xorg.log -novtswitch -sharevts -terminate -ac :20

XLibre X Server 1.25.1
X Protocol Version 11, Revision 0
Current Operating System: FreeBSD xlibre 15.0-RELEASE-p1 FreeBSD 15.0-STABLE stable/15-n282263-d653f474e901 GENERIC-BHYVESNAPSHOT amd64
Current version of pixman: 0.46.2
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "test-xorg.log", Time: Tue Feb 17 15:18:42 2026
(++) Using config file: "/home/meta/xorgxrdp/xrdpdev/xorg.conf"
(==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
rdpmousePlug:
rdpkeybPlug:
ld-elf.so.1: /home/meta/xorgxrdp/xrdpkeyb/.libs/xrdpkeyb_drv.so: Undefined symbol "xorgxrdpCheckWrap"

@matt335672
Copy link
Copy Markdown
Member

Yes, that's the same issue.

xorgxrdpCheckWrap() depends on xf86NumDrivers:

if (xf86NumDrivers < 1)

On Xorg (Ubuntu 24.02):

$ grep xf86NumDrivers /usr/include/xorg/xf86Priv.h
extern _X_EXPORT int xf86NumDrivers;

On XLibre (FreeBSD 14.3):

# Look in same file
$ grep xf86NumDrivers /usr/local/include/xorg/xf86Priv.h
# Look in all XLibre internal includes
$ find /usr/local/include/xorg -type f -exec grep xf86NumDrivers {} +

@b-aaz
Copy link
Copy Markdown

b-aaz commented Apr 22, 2026

Hello!

I skimmed through Xorgxrdp's code, did some testing, and it seams to me that this issue is caused by the lack of some glamor_* functions that are used in xrdpdri.c (added in 6660fad) in XLibre's version of the xorg/glamor.h SDK header (X11Libre/xserver@0644764 et. al.).

These functions were removed from XLibre's driver API in a continuous process of trying to minimize the X server's driver API and better define and organize it, and since these functions were not at use by any driver at the time, they were "unexported".

Since it looks like they are needed now, I think we should perhaps create an issue over at https://github.com/X11Libre/xserver/ or maybe a PR and add them back?

@metalefty
Copy link
Copy Markdown
Member Author

@b-aaz

Can you raise an issue or PR to Xlibre upstream?

Honestly, we welcome adding support for Xlibre as long as it can be handled with changes on the xorgxrdp side, but we're not particularly enthusiastic about negotiating with the Xlibre upstream to request API changes.

If someone else is willing to handle such negotiations, we'd be happy to continue working on our side.

@b-aaz
Copy link
Copy Markdown

b-aaz commented Apr 24, 2026

@metalefty I patched up the upcoming XLibre 25.1.4 release for FBSD/DFBSD adding the required functions back at b-aaz/xlibre-ports@7d28dad for allowing xorgxrdp-devel to compile. The overlay build (which includes the latest xorgxrdp-devel) has been successful on both FBSD & DFBSD: logs

This new release, with the patches included, will hopefully also get pushed to FreeBSD latest soon.
Also opened up a draft PR over at X11Libre/xserver#2338 , feel free to share any comments and suggestions!

@b-aaz
Copy link
Copy Markdown

b-aaz commented Apr 26, 2026

@metalefty
Glamor APIs are patched back in FreeBSD ports main:
freebsd/freebsd-ports@439ad72

@metalefty
Copy link
Copy Markdown
Member Author

Thank you, I'll check it.

vishwin pushed a commit to vishwin/freebsd-ports that referenced this pull request Apr 27, 2026
@metalefty
Copy link
Copy Markdown
Member Author

@b-aaz
Committed to FreeBSD ports main:
freebsd/freebsd-ports@1486717

Our CI depends on the pkg. Currently, our FreeBSD CI refers to the quarterly branch. It will take some time until we can pass the CI, even if we change it to refer to the main branch.

@metux
Copy link
Copy Markdown

metux commented Apr 27, 2026

These PRs seem to have caused this based on the log. I've not tested reverting them yet:

These were dropped from public API, because no drivers were using them.
Since that now seemed to have changed, we're exporting them again.
Is master / upcoming 25.2 enough or do you need backport to existing releases ?)

In the longer run I'd prefer having the RDP video driver upstreamed, so we don't have to care about ABIs anymore (quite the same reason as in the Linux kernel ;-))

NullClient macro is dropped in Xlibre [1]

[1] X11Libre/xserver#415

(cherry picked from commit f5a07e9)
(cherry picked from commit 1c93081)
(cherry picked from commit 58e6a64)
Xorg -showDefaultModulepath cannot get proper xlibre moduledir in
FreeBSD.

The moduledir differ like below:

xlibre: /usr/local/lib/xorg/modules/xlibre-25
xorg:   /usr/local/lib/xorg/modules
@metalefty
Copy link
Copy Markdown
Member Author

@metux It would be nice if it is backported to the next 25.1.x release.

Regarding upstreaming, I personally keep our own release cycles but it is a good idea to include xorgxrdp build in upstream CI.

Please note that xorgxrdp isn't a RDP driver, but a driver that provides specific interfaces to communicate with xrdp.

@metalefty
Copy link
Copy Markdown
Member Author

The Xlibre CI will pass when freebsd/freebsd-ports@439ad72 comes to the CI environment.

@metalefty metalefty marked this pull request as ready for review April 28, 2026 05:17
@metalefty
Copy link
Copy Markdown
Member Author

We're all done. Just need to wait until CI passes.

@metux
Copy link
Copy Markdown

metux commented Apr 28, 2026

@metux It would be nice if it is backported to the next 25.1.x release.

X11Libre/xserver#2402

Please note that xorgxrdp isn't a RDP driver, but a driver that provides specific interfaces to communicate with xrdp.

Sure. But since Xserver drivers are deeply interwoven with the core Xserver (unfortunately, there's no clearly defined API), both sides need to be carefully kept in sync. If there instead was a stable API to the actual RDP protocol handling layer, which is just called by the driver, and the driver being upstreamed (in-tree on our side), those trouble would go away.

By my quick scan through the code it looks like you're operating on a virtual framebuffer (not an actual HW display) and transmitting the render operations/results to the RDP client, correct ?

@metalefty
Copy link
Copy Markdown
Member Author

By my quick scan through the code it looks like you're operating on a virtual framebuffer (not an actual HW display) and transmitting the render operations/results to the RDP client, correct ?

Yes, as far as I understand, and receive keyboard/mouse events from the RDP client, as shown in the figure in the README.

ocochard pushed a commit to ocochard/freebsd-ports that referenced this pull request Apr 28, 2026
@metalefty
Copy link
Copy Markdown
Member Author

The new xlibre has come to the CI environment. It builds but test-suite is failing. I'll look into that later.

@metalefty
Copy link
Copy Markdown
Member Author

CI is failing due to make check phase:

  XLibre X Server 1.25.1.5
  X Protocol Version 11, Revision 0
  Current Operating System: FreeBSD freebsd 15.0-RELEASE FreeBSD 15.0-RELEASE releng/15.0-n280995-7aedc8de6446 GENERIC amd64
  Current version of pixman: 0.46.4
  Markers: (--) probed, (**) from config file, (==) default setting,
  	(++) from command line, (!!) notice, (II) informational,
  	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
  (++) Log file: "test-xorg.log", Time: Mon May 11 13:04:15 2026
  (++) Using config file: "/home/runner/work/xorgxrdp/xorgxrdp/xrdpdev/xorg.conf"
  (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
  ld-elf.so.1: /home/runner/work/xorgxrdp/xorgxrdp/xrdpmouse/.libs/xrdpmouse_drv.so: Undefined symbol "g_log_msg"

@matt335672
Copy link
Copy Markdown
Member

This may be the problem:

X11Libre/xserver#401 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants