News for hackers. Stuff that matters.
Re:Intro to Low-Level Graphics on Linux by d_theorist on Wednesday August 30, 2017 @06:23PM (#15136615)
Also, I'm curious about portable (i.e. across different Unixes) low-level graphics, if such a thing exists.

I assume that the interfaces discussed here are Linux specific, and the BSDs have something different.

Does POSIX have anything to say about graphics interfaces?

What is the lowest-level portable way to draw graphics? X11?

It's funny, because I always thought of X as being more of a windowing abstraction, rather than graphics in general. Perhaps I am making a distinction that does not really exist.

Obviously I am not a graphics guy :)

Re:Intro to Low-Level Graphics on Linux by 0xcde4c3db on Wednesday August 30, 2017 @10:25PM (#15137723)
The BSDs and Solaris/Illumos have had DRM for years (where available), but it tends to lag the Linux version significantly because it's not trivial to port the code from Linux. I'm not sure where the compatibility breaks relative to the code given on the page, but most of them have some derivative of the original drm.h header that defines most of the structs and ioctls mentioned (e.g. [1] [2] [3])

[1] https://github.com/freebsd/freebsd/blob/master/sys/dev/drm/d...

[2] https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/d...

[3] https://github.com/illumos/illumos-gate/blob/master/usr/src/...

Re:Intro to Low-Level Graphics on Linux by d_theorist on Thursday August 31, 2017 @08:17AM (#15139746)
Ah, thanks. Interesting.
Re:Intro to Low-Level Graphics on Linux by pjmlp on Thursday August 31, 2017 @02:06AM (#15138449)
> Does POSIX have anything to say about graphics interfaces?

Not at all. Writing 100% compliant POSIX code means sticking to the PDP-11 model of what an application is supposed to be, meaning either a terminal text application or a daemon.

Anything graphical related is a separate standard.

http://www.opengroup.org/standards/unix

Re:Intro to Low-Level Graphics on Linux by kllrnohj on Wednesday August 30, 2017 @09:48PM (#15137548)
I don't think there is any common low level way, even among the Linux flavors. Android's graphics stack, for example, is completely different and doesn't use any of this.

If you want portable you're going to want something like SDL probably.

Re:Intro to Low-Level Graphics on Linux by shmerl on Wednesday August 30, 2017 @10:06PM (#15137634)
Andriod is a weird deviation, and kind of annoying because the rift goes all the way to libc, which makes Android blobs incompatible without translation hacks like libhybris. If in case of GPU you can at least get something like Freedreno to avoid such hacks, but good luck getting open drivers for the modem and the like. So those blobs are a necessary evil for some devices to be usable, and there are none for glibc.
Re:Intro to Low-Level Graphics on Linux by kllrnohj on Wednesday August 30, 2017 @10:57PM (#15137853)
libhybris would still exist if Android had been running glibc. You still have architecture-specific stuff at the end of the day. Just like how XWayland exists to map X11 to Wayland, even though both use the same glibc.

Looking through the source of libhybris it looks like very little of it has anything to do with bionic itself.

Re:Intro to Low-Level Graphics on Linux by shmerl on Wednesday August 30, 2017 @11:26PM (#15137959)
I thought its whole point is to work around idiosyncrasies of bionic, and translate it into glibc proper. Or you mean that Android drivers architecture is very different from proper Linux drivers?
Re:Intro to Low-Level Graphics on Linux by pjmlp on Thursday August 31, 2017 @02:10AM (#15138464)
Yes completely different. This how the graphics stack look like on Android, a mix of Java, C and C++ code.

https://source.android.com/devices/graphics/

https://source.android.com/devices/graphics/architecture

Re:Intro to Low-Level Graphics on Linux by shmerl on Thursday August 31, 2017 @02:21AM (#15138502)
Android can use Mesa, so that's not convincing.
Re:Intro to Low-Level Graphics on Linux by pjmlp on Thursday August 31, 2017 @02:54AM (#15138632)
No Android handset is being sold with Mesa instead of SurfaceFlinger.

Can you please prove me wrong?

Re:Intro to Low-Level Graphics on Linux by kllrnohj on Thursday August 31, 2017 @12:17PM (#15141347)
Mesa and SurfaceFlinger do two completely different things. You can absolutely use Mesa on Android (the emulator does, for example). But just like on desktop you're typically using the GPU vendors' accelerated GL implementation instead of Mesa. But if the vendors driver uses Mesa, like the Intel GPUs, that still works fine on Android.
Re:Intro to Low-Level Graphics on Linux by pjmlp on Friday September 01, 2017 @07:10AM (#15147464)
> the emulator does, for example

No it doesn't.

"Android Studio: The Mesa software renderer is deprecated. Use Swiftshader for software rendering"

https://stackoverflow.com/questions/39568455/android-studio-...

Intel has dropped out of Android market.

Re:Intro to Low-Level Graphics on Linux by shmerl on Thursday August 31, 2017 @10:15AM (#15140448)
SurfaceFlinger is a compositor. Mesa is lower level. Search yourself (Android with Mesa).
Re:Intro to Low-Level Graphics on Linux by pjmlp on Thursday August 31, 2017 @10:59AM (#15140757)
Which means you cannot answer my question.
Re:Intro to Low-Level Graphics on Linux by shmerl on Thursday August 31, 2017 @11:08AM (#15140833)
Which means you don't know what you are talking about. Did you search what I said? It's not the first time you do it for the sake of flaming.
Re:Intro to Low-Level Graphics on Linux by pjmlp on Friday September 01, 2017 @07:24AM (#15147504)
The FOSS religion days are well behind me for worrying about flame wars.

The very fact that you cannot prove me wrong, tells it all.

Given that I also work with Android, are you so naive to think I need to search for whatever you want me to find?!?

Sure there is Mesa on the emulator, which is deprecated by the way.

Oh and in those Intel devices that are no longer being sold.

Re:Intro to Low-Level Graphics on Linux by kllrnohj on Wednesday August 30, 2017 @11:35PM (#15137983)
bionic is largely just a subset of glibc. There's not really any idiosyncrasies to workaround going from bionic to glibc (the hard part is the reverse as people commonly use non-portable glibc extensions)

libhybris is more things like converting Surfaceflinger calls into Wayland ones. Looks like there's some media, camera, and input stuff, too, which is all outside the realm of bionic/glibc.

Re:Intro to Low-Level Graphics on Linux by shmerl on Wednesday August 30, 2017 @07:49PM (#15137078)
Looks like FreeBSD is following Linux design for DRM/KMS: https://wiki.freebsd.org/Graphics
Re:Intro to Low-Level Graphics on Linux by panic on Wednesday August 30, 2017 @11:30PM (#15137969)
Probably because that's how the vendors distribute their proprietary drivers.
Re:Intro to Low-Level Graphics on Linux by shmerl on Wednesday August 30, 2017 @11:38PM (#15138001)
Actually Nvidia blob didn't start using DRM/KMS until very recently. I think it's more because of Mesa. It makes sense for FreeBSD to leverage the major open project which does heavy lifting for graphics.