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

[WIP] Add support for Sailfish OS #9435

Closed
wants to merge 1 commit into from

Conversation

Max-Might
Copy link
Contributor

@Max-Might Max-Might commented Jun 28, 2017

Hello.

I have been working on porting the engine to the Sailfish operating system.
I decided to open this PR to track progress and invite other interested parties to join the effort.

Sailfish is a Linux-based operating system for mobile devices.
It uses a lot of the common platform software stack like D-Bus, systemd, PulseAudio, Qt and others.
It also uses Wayland instead of x server.

This is a work in progress. Here is what works at the moment.

  • Rendering. The port uses QOpenGlWindow for accelerated drawing.
  • Audio. Reusing the PA driver we already have. Also uses libaudioresource to manage permissions.
  • Mouse and keyboard input.
  • Touch events are not sent (easy).
  • Landscape mode. Investigating how to implement landscape mode. May need to rotate canvas and translate input.
  • Exporter. SailfishOS uses RPM package format. My idea is to export the project files to a directory with a .spec file and call spectacle to generate the RPM. This way we will not introduce any additional dependencies like librpm nor resort to manually generating the RPM.

@karroffel karroffel changed the title Add support for Sailfish OS [WIP] Add support for Sailfish OS Jun 28, 2017
}

Point2 OS_Sailfish::get_mouse_position() const {
// DODO: implement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't those went extinct a while ago?

os.run(); // it is actually the OS that decides how to run
}

delete os.window;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be memdelete() and memnew() a few lines above? 😛

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no this is fine, memnew doesn't exist before OS is initialized, so those things have to be allocated the old fashion way

@punto-
Copy link
Contributor

punto- commented Jun 28, 2017 via email

@karroffel
Copy link
Contributor

This looks really awesome!! Too bad I can't test, but I'd love if Godot would support sailfish!

Also, you said that it's using Wayland, couldn't some part of this be split into a OS_Wayland or something so it could be used for "regular" Linux systems too?

@karroffel
Copy link
Contributor

@punto- Sailfish seems to use Qt, so this QOpenGLWindow is Qt specific, not wayland

@punto-
Copy link
Contributor

punto- commented Jun 28, 2017

yeah.. the "Q" was suspicious.. (I was also thinking this could be reused for Wayland). I wonder if it's possible to avoid Qt altogether, since you only need it for the window and gl context management, how much smaller would the binary be?

@karroffel
Copy link
Contributor

Looks like Sailfish apps need to be in Qt, that's why there are qml files and all

@punto-
Copy link
Contributor

punto- commented Jun 28, 2017

they don't need to be in Qt, just like Android doesn't need to be in java, the question is, do they force you to be in Qt? There's a window server and a kernel underneath Qt, can't we just access that directly?

@Max-Might
Copy link
Contributor Author

Max-Might commented Jun 28, 2017

The Qt framework is the official API for developing Sailfish apps.
I went for it as the easiest way to obtain an OpenGL window.
Removing the Qt dependency will not reduce executable size by much because it is dynamically linked.

AFAIK the SDL2 port for Sailfish uses the Wayland API instead of Qt but I do not know much about it.
If OS_Wayland materializes and works for this use case we can always update the port.
Also I am not sure how wayland handles peripherals. For desktop it looks like everybody is going for libinput.

As for the exporter, basically the Sailfish SDK is a Virtualbox VM with cross-compilers for all supported platforms (arm and i486 at the moment, aarch64 in progress).

Edit: the QML files are a remnant of failed experiments, they will be removed. Only the cover QML file is needed.

@akien-mga
Copy link
Member

Ah that makes sense, at first I was thinking "awesome, Wayland support for Linux", but I now understand that you did not have to implement direct Wayland support but get it directly from Qt 5. I don't think the dependency on Qt is too big a problem if it's only for SailfishOS, where it will indeed be dynamically linked.

@raymoo
Copy link
Contributor

raymoo commented Jun 28, 2017

Maybe Wayland support here could be used for desktop Wayland support? I'm particularly interested in desktop multitouch support.

@akien-mga
Copy link
Member

Maybe Wayland support here could be used for desktop Wayland support? I'm particularly interested in desktop multitouch support.

Read my comment right above yours.

@raymoo
Copy link
Contributor

raymoo commented Jun 28, 2017

Oh, I see. But this still could potentially be used on desktop platforms, right?

EDIT: Maybe as a "Qt backend" export or something

@akien-mga
Copy link
Member

Oh, I see. But this still could potentially be used on desktop platforms, right?

No, because we don't want to depend on huge Qt on desktop just for the sake of having Wayland support. On SailfishOS it makes sense as it's a core component of the ecosystem, but not on general Linux desktop.

@punto-
Copy link
Contributor

punto- commented Jun 28, 2017 via email

@Max-Might
Copy link
Contributor Author

@punto- The SDK consists of two VMs - one for development and one for the emulator.
All the tools needed for build a package are in the development VM. The SDK also contains a package validator so you can check if your RPMs are compatible with Harbour (the application store).

Even when you are building a normal Sailfish application you do not need to run anything on your host besides the IDE and the VMs. When you hit 'Run' the IDE transfers your project files to the dev VM, compiles them, creates a package and deploys it to the emulator VM or real device. I think the same workflow would be possible with the exporter. The other option is just to export the files somewhere on the host and them manually SSH to the dev vm and run the packaging commands.

The SailfishOS SDK is available for Linux 32/64, OS X and Windows.

@punto-
Copy link
Contributor

punto- commented Jun 29, 2017 via email

@Max-Might
Copy link
Contributor Author

To create an RPM package we have a few options:

  1. Use the RPM packaging tools on the host.
    On linux some distros have RPM-related tools in their repos. I don't think they are available for windows and OS X.

  2. Use the RPM packaging tools in the SDK VM. This would be nice because the SDK is available for all major operating systems and you will also be able to use the RPM validator. And you will probably need the emulator VM for development or testing anyway.

  3. Use librpm to build the package but this will introduce a new hard dependency to the engine since it has to be available for all platforms. I do not think this is a good idea.

Building the package 'manually' (without the tools that are intended to do just that) is not a good idea in my opinion since this is error-prone and not future-proof.

If anyone has any other ideas about this please feel free to join the discussion.
Anyway, before working on the exporter I would like to resolve some of the other issues (like the landscape mode).

@akien-mga
Copy link
Member

The 4th option is to implement the RPM file format specification to be able to write it, but that's basically rewriting part of librpm: http://ftp.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html

Since Sailfish OS is a relatively "exotic" platform, I think it's not too much to ask of developers who want to develop to this platform to get the upstream SDK.

@punto-
Copy link
Contributor

punto- commented Jun 29, 2017 via email

@punto-
Copy link
Contributor

punto- commented Jun 29, 2017 via email

@Max-Might
Copy link
Contributor Author

I am looking for a way to add landscape support but it looks like Qt does not have any APIs for this.
It can only let the compositor know you are already drawing in landscape.

@reduz Do you know if it is possible to use GLES on the OS class level to rotate the screen? I guess it would be possible with GLES? I have absolutely no experience with low level graphics :(

I know about glRotate() but it is not available in GLES 3?

@savegame
Copy link

savegame commented Jul 20, 2017

i build that )) its godots editor in sailfish )) fun and nice ) but cant create or launch any project ...

@savegame
Copy link

Ok, 2D project ( simple test with 3 animated sprites ) is run fine! ) , but running 3D is segfault ( gles3 shaders cant compile )

@k0105 k0105 mentioned this pull request Aug 16, 2017
@akien-mga
Copy link
Member

Hi there, what's the current status on this PR?

@savegame
Copy link

@akien-mga , i think need just make that issue #576, and godot automaticly willwork on sailfish =)
i am already porting irricht engine to sailfish, and i think in that way we can port godot, but now a dont have much time for this, maybe later
ps sorry for my english

@Max-Might
Copy link
Contributor Author

Max-Might commented Nov 12, 2017

@akien-mga My question still stands.
In order to support landscape mode we need to rotate/modify the view port from the OS class.
The input can be translated by some Qt helpers but I do not know how to do the OpenGL viewport rotation.

That is why I asked if it is possible/suitable to do it from the OS class and if yes then how can it be done.

@savegame This is nice but a generic Wayland port will not be enough here.
To port Godot to a new platform you also need sound, input(kbd,mouse,joystick), packaging and deployment tools etc. For example this port uses libaudioresource to request permission to play sound by the pulseaudio driver. Whether the port uses Wayland directly or Qt is not a big difference.

@savegame
Copy link

@Max-Might, in wayland no problem to get keyboard, mouse and touchscreen. But i don't now about sound, i am not test it yet.

@aaronfranke
Copy link
Member

@Max-Might Are you still working on this?

I noticed that you mentioned GLES. How does Godot's decision to add Vulkan support affect this PR?

@akien-mga
Copy link
Member

Closing as it stalled.

Support for SailfishOS would still be interesting to have, and any interested contributor could start from the work in this branch. As it's a relatively niche platform we'll need at least two things for it to be viable:

  • a mostly feature-complete initial implementation
  • an active maintainer to keep it up to date with changes in the master branch

@savegame
Copy link

@Max-Might, if you still interesting with Sailfish platform, i am allready build both Godot 2 and 3 for sailfish OS (i am get sample of use audioresource from your code, thanks), and in Godot 3 i found a way to rotate render for Sailfish landscape orientation (just fix canvas shader in drivers gles2 ).

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

Successfully merging this pull request may close these issues.

7 participants