Porting SDL2 to a new platform, detailed docs?

Hello SDL developers,
I want to help in porting SDL2 to a new platform. I am new to this, and I would greatly appreciate help from somebody who has done this before (porting to Android or other platforms where SDL2 now exists).

I have the following question:

  • Is there a standard reference document that includes all the functions with implementation details*? I need something telling me which system level functions (drivers) I have to implement, detailing their desired behaviour (input/output etc.)?

*ideally this should be a long, indexed, pdf and not a bunch of disjointed comments in source or a bunch of disjointed comments/readme?s on GitHub :slight_smile:

What I have found:

So far I have found this
https://forums.libsdl.org/viewtopic.php?p=3591&sid=ca6328caf29e567ac498a6d32ae4399a https://forums.libsdl.org/viewtopic.php?p=3591&sid=ca6328caf29e567ac498a6d32ae4399a

, and some comments in the driver source for SDL2 for other platforms. But surely that can?t be all the documentation for a decade old project?

To clarify: None of the content at https://wiki.libsdl.org https://wiki.libsdl.org/ is of use to me, since it is at the user level. I need docs at the driver/internal level of the API. I am looking at documentation at the developer level for porting the SDL2 library itself, not documentation at the user level for using an existing SDL2 port for a project.

Thank you very much for any help in advance,
Arne

Sounds like you should look at this file:
http://hg.libsdl.org/SDL/file/5fcc998013ed/docs/README-porting.md

Jonny DOn Sun, Feb 19, 2017 at 4:41 PM, Arne Schwettmann <arneschwettmann at gmail.com wrote:

Hello SDL developers,
I want to help in porting SDL2 to a new platform. I am new to this, and I
would greatly appreciate help from somebody who has done this before
(porting to Android or other platforms where SDL2 now exists).

I have the following question:

  • Is there a standard reference document that includes all the functions
    with implementation details*? I need something telling me which system
    level functions (drivers) I have to implement, detailing their desired
    behaviour (input/output etc.)?

*ideally this should be a long, indexed, pdf and not a bunch of disjointed
comments in source or a bunch of disjointed comments/readme?s on GitHub :slight_smile:

What I have found:

So far I have found this
https://forums.libsdl.org/viewtopic.php?p=3591&sid=
ca6328caf29e567ac498a6d32ae4399a

, and some comments in the driver source for SDL2 for other platforms. But
surely that can?t be all the documentation for a decade old project?

To clarify: None of the content at https://wiki.libsdl.org is of use to
me, since it is at the user level. I need docs at the driver/internal level
of the API. I am looking at documentation at the developer level for
porting the SDL2 library itself, not documentation at the user level for
using an existing SDL2 port for a project.

Thank you very much for any help in advance,
Arne


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ah, yep, I followed that forum link now and that’s the intro file for
porting to a new platform. My best advice is to do what it says and start
from either a similar platform’s implementation or use the dummy driver as
a starting point. There are several people who will have more to add.

Jonny DOn Sun, Feb 19, 2017 at 5:58 PM, Jonathan Dearborn <@Jonathan_Dearborn> wrote:

Sounds like you should look at this file:
http://hg.libsdl.org/SDL/file/5fcc998013ed/docs/README-porting.md

Jonny D

On Sun, Feb 19, 2017 at 4:41 PM, Arne Schwettmann < arneschwettmann at gmail.com> wrote:

Hello SDL developers,
I want to help in porting SDL2 to a new platform. I am new to this, and I
would greatly appreciate help from somebody who has done this before
(porting to Android or other platforms where SDL2 now exists).

I have the following question:

  • Is there a standard reference document that includes all the functions
    with implementation details*? I need something telling me which system
    level functions (drivers) I have to implement, detailing their desired
    behaviour (input/output etc.)?

*ideally this should be a long, indexed, pdf and not a bunch of
disjointed comments in source or a bunch of disjointed comments/readme?s on
GitHub :slight_smile:

What I have found:

So far I have found this
https://forums.libsdl.org/viewtopic.php?p=3591&sid=ca6328caf
29e567ac498a6d32ae4399a

, and some comments in the driver source for SDL2 for other platforms.
But surely that can?t be all the documentation for a decade old project?

To clarify: None of the content at https://wiki.libsdl.org is of use to
me, since it is at the user level. I need docs at the driver/internal level
of the API. I am looking at documentation at the developer level for
porting the SDL2 library itself, not documentation at the user level for
using an existing SDL2 port for a project.

Thank you very much for any help in advance,
Arne


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

New platforms are rare enough that nobody has written detailed
documentation on how to add one, especially since platforms besides the
desktop OSes are extremely unique. There isn’t a standard reference
document other than the API documentation. When in doubt, check the
behavior of your favorite desktop platform.

As Jonathan said, your best bet is to look at a platform that is closest to
yours, and see what is done there.

Feel free to ask lots of questions on the mailing list and create the
document you wanted. :)On Sun, Feb 19, 2017 at 1:41 PM, Arne Schwettmann <arneschwettmann at gmail.com wrote:

Hello SDL developers,
I want to help in porting SDL2 to a new platform. I am new to this, and I
would greatly appreciate help from somebody who has done this before
(porting to Android or other platforms where SDL2 now exists).

I have the following question:

  • Is there a standard reference document that includes all the functions
    with implementation details*? I need something telling me which system
    level functions (drivers) I have to implement, detailing their desired
    behaviour (input/output etc.)?

*ideally this should be a long, indexed, pdf and not a bunch of disjointed
comments in source or a bunch of disjointed comments/readme?s on GitHub :slight_smile:

What I have found:

So far I have found this
https://forums.libsdl.org/viewtopic.php?p=3591&sid=
ca6328caf29e567ac498a6d32ae4399a

, and some comments in the driver source for SDL2 for other platforms. But
surely that can?t be all the documentation for a decade old project?

To clarify: None of the content at https://wiki.libsdl.org is of use to
me, since it is at the user level. I need docs at the driver/internal level
of the API. I am looking at documentation at the developer level for
porting the SDL2 library itself, not documentation at the user level for
using an existing SDL2 port for a project.

Thank you very much for any help in advance,
Arne


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This ended up being what I did, when porting SDL2 to WinRT/UWP: I spent
-lots- of time reading through SDL source code. The hardest parts usually
ended up being platform-specific bits, although, SDL2’s window vs.
full-screen management code was difficult to work with, at times.

I’m happy to try answering questions about, or during this process, as well.

Cheers,
– David L.

?

This ended up being what I did, when porting SDL2 to WinRT/UWP: I spent
-lots- of time reading through SDL source code. The hardest parts
usually ended up being platform-specific bits, although, SDL2’s window
vs. full-screen management code was difficult to work with, at times.

Having just done this for a new platform, it’s basically “get it to
compile with the platform’s build system, then go through each subdir in
"src” to see if there needs to be a platform-specific piece added."

This gets more complicated in that a few things (SDL_atomic.c) expect
you to add an #ifdef, and others expect you to add a new implementation
and plug it into a list of available implementations to try at runtime
(audio, video), and others expect you to add a new implementation that’s
the only thing that works on that platform (thread, etc).

And then joystick expects you to have one implementation for the
platform, but both Linux and Windows then built their own
multi-implementation thing on top of that.

Also, almost universally, starting from the “dummy” driver is the wrong
move.

We should fix some of these details.

–ryan.