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

Native wayland support via glutin #9558

Open
vberger opened this Issue Feb 5, 2016 · 22 comments

Comments

Projects
None yet
@vberger

vberger commented Feb 5, 2016

Hi, I'm the maintainer of the wayland-client crate and its friends, as well as the wayland backend of glutin.

As a way to stress-test and improve my implementations, I was thinking of tring to make servo run with them, and as planned, it did not work out of the box.

The first reason for this is the use by servo of glutin's Window::platform_display()(which currently hits an unimplemened!() of the wayland backend), here

NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)

(And writing this, I discover that this function is marked as deprecated in glutin's documentation.)

Well, my question is: what does servo use this platform_display for? I guess the wayland equivalent is probably the main display, but I'd like to understand what's going on before trying some unsafe magic.

Or maybe, given the deprecation notice in glutin, something would need to be done on servo's side?

@larsbergstrom

This comment has been minimized.

Contributor

larsbergstrom commented Feb 5, 2016

@zmike, how did you work around all of this in your Servo-on-Wayland work?

@vberger vberger changed the title from Native wayland support via gluin to Native wayland support via glutin Feb 5, 2016

@jdm

This comment has been minimized.

Member

jdm commented Feb 5, 2016

My understanding is that platform_display is used for parenting windows in X. I assume it's deprecated in glutin by the plans for tomaka/glutin#702.

@jdm

This comment has been minimized.

Member

jdm commented Feb 5, 2016

Actually it looks like it's more complicated than that; sorry. There are more uses of native_display() than I expected.

@zmike

This comment has been minimized.

Contributor

zmike commented Mar 23, 2016

I didn't use glutin, I used the embedding API with my demo application that has Wayland support.

iirc platform_display in Servo is used for working with GL contexts in the compositor (previously layers) in order to perform accelerated rendering. I don't have the (Servo) code available in front of me for easy verification, but it seems like what you want is possibly this https://cgit.freedesktop.org/wayland/weston/tree/clients/simple-egl.c#n158

cc @pcwalton and @glennw for native_display() usage related things

@vberger

This comment has been minimized.

vberger commented Mar 23, 2016

Alright thanks, i'll look on that side regarding GL contexts and such.

If it's also used for parenting X windows (if I understand correctly what it implies, aka subsurfaces in wayland), it's a hint that maybe glutin's api is too narrow for what servo needs to do. As such, it might be interesting to explicit what the real need is behind that, to maybe work on integrating a minimal platform-unified way to do that in glutin (or, soon to be, winit) ?

@glennw

This comment has been minimized.

Member

glennw commented Apr 3, 2016

@vberger Thanks for looking into this!

I suspect that the easiest way to get Servo working on wayland now will be to use webrender - when using webrender, all drawing is done via GL calls only - there shouldn't be any calls made to native_display(), and we shouldn't use any X11 / GLX specific functionality (if you do hit these code paths when running with WR that's a bug, as those are used for texture sharing in rust-layers).

Webrender currently relies on having either a GL3.3 or GLES3 context available, and apart from that should have no additional requirements. Is it currently possible to set up once of those context types from the wayland backend?

@vberger

This comment has been minimized.

vberger commented Apr 4, 2016

Okay, I'll look in the webrender direction then. GL3.3 should be provided by glutin over wayland, assuming the mesa driver of the computer its run on provides it.

However, I don't know when exactly I'll be able to dig more into it, I've quite a lot going on currently.

@zbraniecki

This comment has been minimized.

zbraniecki commented Sep 14, 2016

any progress on that @vberger ?

@vberger

This comment has been minimized.

vberger commented Sep 14, 2016

I'm currently mostly busy with a large re-design of my wayland libs, so I didn't progress on that, and have still a lot to do before I could.

Also, I kinda heard that servo more or less planned to stop using glutin, so I didn't really keep an high focus on that.

@jdm

This comment has been minimized.

Member

jdm commented Sep 14, 2016

I'm pretty sure the rumours of glutin's demise in Servo have been exaggerated. I'm not aware of any effort to replace it at this point in time.

@vberger

This comment has been minimized.

vberger commented Sep 15, 2016

Okay. My timeline for now is anyway: first finish my redesign and publish wayland-client 0.7, then integrate it into glutin/winit, and then I'll work from that.

@metajack

This comment has been minimized.

Contributor

metajack commented Sep 16, 2016

@jdm is correct. There's no plan to stop using glutin, and even if we had one, I suspect we'd use a custom fork. I'm not aware of any real alternatives.

@tomaka

This comment has been minimized.

tomaka commented Sep 21, 2016

My understanding is that platform_display is used for parenting windows in X. I assume it's deprecated in glutin by the plans for tomaka/glutin#702.

For the record, the function itself has been deprecated but a replacement has been added in a trait named WindowExt that is only available on Linux.
This was done to mimic the way the stdlib handles platform-specific stuff.

@zbraniecki

This comment has been minimized.

zbraniecki commented Oct 28, 2016

I don't know if this has been fixed but I'm able to run servo on wayland+gnome now.

@emilio

This comment has been minimized.

Member

emilio commented Oct 29, 2016

@zbraniecki: I think this isn't fixed, Servo should run on top of XWayland right now.

@vberger

This comment has been minimized.

vberger commented Nov 5, 2016

Just to give some news, most (all ?) of the required work in glutin is now done, and I'm getting back at this.

However, I'll need to wait for glutin-servo to catch up to glutin-0.7 (all non-opengl stuff was moved to the winit crate, so I believe half or more of the servo-specific patches of glutin will need to be moved to a winit-servo crate, or upstreamed ?)

@FallingSnow

This comment has been minimized.

FallingSnow commented Mar 5, 2018

Any change on the status of Servo on Wayland?

@jdm

This comment has been minimized.

Member

jdm commented Mar 5, 2018

No. We're in the process of switching to the upstream glutin, however: #19895

@mikolajpp

This comment has been minimized.

mikolajpp commented Mar 21, 2018

When I run servo on Gnome 3 + Wayland on current Arch, this is the result: https://imgur.com/a/tZjDt
The app is unskinned and input is broken.

When I run it on Gnome3 + X11 it works.

@atouchet

This comment has been minimized.

Contributor

atouchet commented Nov 19, 2018

What is the status of this issue now? Servo is now using upstream glutin along with the latest wayland-* crates.

@paulrouget

This comment has been minimized.

Contributor

paulrouget commented Nov 19, 2018

It should "just work". As in, nothing special to do on Servo's side. But I'm afraid we'll run into sizes and resolution issues on any hidpi devices. See tomaka/winit#305

@vberger

This comment has been minimized.

vberger commented Nov 20, 2018

I just tried on sway, and I can confirm it "just works" except for dpi. Servo does not seem to follow the HiDPI information suggested by winit.

On my computer with a screen with dpi factor of 2.0, only the bottom-left quarter of the window contains the displayed web page, the 3 other quarters are just a white background.

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