Commit graph

227 commits

Author SHA1 Message Date
Pekka Paalanen 0260b8a0b5 shared: fcntl uses int, not long
fcntl(2) manual says the return type is int, and that F_SETFD takes an
int. So use int.

Noticed by code inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-12 08:30:22 +00:00
Daniel Stone f52231660e tests: Use memstream for config-parser test
Using real files is unnecessarily heavy and error-prone. Fixes timeouts
seen on CI with ASan.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-05 10:15:49 +01:00
Daniel Stone c55a14206d cairo-util: Clean up more Cairo detritus; almost all of it
Pango, Cairo, and fontconfig, all want to leave thread-global data
hanging around in order to maintain a cache. Try to clean up as much of
it as we possibly can on exit, apart from the Pango language string
which appears to be unfreeable, so has been added to LSan suppressions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone 29c3422e05 cairo-util: Don't leak Pango objects
Rework PangoCairo context initialisation, so we don't leak either the
Pango layout, or any of the derived objects it creates.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Derek Foreman 0df0dccc84 shared: Make xalloc.h stand alone
Make fail_on_null static inline and put it in xalloc.h so we can use the
header exclusively instead of having to link with the library for it.

This is so we can use xalloc in places (like the RDP backend) without
having to bring in libshared.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-28 10:43:39 +00:00
Marius Vlad 59a72dcf63 shared/xcb-xwayland: Add missing atoms
Particularly important was _XWAYLAND_ALLOW_COMMITS atom which caused
some annoying flicker when resizing or hoovering over buttons.

This was introduced with 'shared/xcb-xwayland: Split into common
helpers' and somehow I missed those atoms.

Fixes 49d6532254

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-06-23 14:13:41 +00:00
Derek Foreman af51618708 xwayland/window-manager: Add support for _NET_FRAME_EXTENTS
https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html says
"The Window Manager MUST set _NET_FRAME_EXTENTS to the extents of the
window's frame", so this is probably something we should be doing.

Some programs (such as some versions of Firefox) expect this to be present,
and will render popups in wrong locations if it's not.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-22 12:05:23 -05:00
Derek Foreman 769e4376c6 shared/frame: Provide a function to get decoration sizes and use it
We need these values to calculate frame extents to properly set
_NET_FRAME_EXTENTS, but we don't want to calculate them twice.

Break out these bits from frame_resize_inside, and update it to use
the new function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-22 12:04:06 -05:00
Hideyuki Nagase d902088bfc xwayland: support minimizing
Allow minimizing xwayland windows.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-06-22 09:57:25 -05:00
Marius Vlad 49d6532254 shared/xcb-xwayland: Split into common helpers
Avoid duplication of atom retrieval. This is particuarly useful
if one would one to reuse atom retrival in other parts, like tests.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2022-06-22 08:08:41 +00:00
Derek Foreman 2afb812d1e shared/cairo-util: Hold onto our pattern reference until we're done
This doesn't actually fix a bug - cairo refcounts this. But I
really don't like the look of code that drops a reference then
continues to use it.

While we're here, set a different pattern when we're done so the
one we allocated loses its last reference.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-09 12:29:46 +00:00
Pekka Paalanen 8bbd1a995b libweston: remove UNIT_TEST
This #define was used only by the matrix-test program, which was removed
in the previous commit.

Remove it as unused and fold away MATRIX_TEST_EXPORT.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-31 12:26:09 +00:00
Pekka Paalanen b383f52d31 gl_renderer: print more GL ES feature flags
This is a human readable replacement for printing out the list of all
available GL extensions that doesn't happen anymore by default.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-18 14:18:53 +03:00
Daniel Stone 6cb2526b67 Move shell-utils to its own directory
shell-utils contains a number of helpers which are currently in use by
both desktop-shell and kiosk-shell. In order to extend this use to
fullscreen-shell as well (which can benefit from reusing the
weston_curtain infrastructure to be able to create solid-colour views
which may or may not be opaque, as well as one function within
fullscreen-shell which was copied wholesale to shell-utils), we need to
create a separate Meson dependency object, and avoid the existing
pattern of including the source from shared/ within the source list for
each shell.

This requires creating a new top-level directory for these shared helper
functions which are required by each shell, but are not part of
libweston in and of itself.

shell-utils depends on libweston-desktop; libweston-desktop depends on
libweston; libweston depends on shared.

Thus it is not possible to expose a dependency object from the shared/
directory which declares a dependency on the libweston-desktop
dependency, as Meson processes directories in order and resolves
variable references as they are parsed.

In order to break this deadlock, this commit creates a new top-level
directory called 'shell-utils' containing only this file, which can be
parsed by Meson after libweston-desktop (making the libweston-desktop
Meson dependency variable available to the build file to declare a
dependency on that), but before the shells (making the new Meson
depenendency object available to each shell which wishes to use it).

This commit contains no functional changes to any observable code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone dc0f73bcac shell: Encapsulate weston_curtain in its own struct
This will allow us to create a solid weston_buffer as well, since we
need to store that separately.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone bd9b0676dd shell: Make input capture optional for curtains
desktop-shell's focus surfaces want to reuse this, but they don't want
to capture the input, instead allowing it to fall through.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone e81b8d7cc9 shell: Add alpha to weston_curtain_create
Not all solid-colour views want to be opaque: sometimes we use them with
non-opaque alpha values in order to shade views underneath them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone d21563360a shell: Move weston_curtain_create params into the struct
Given that we have a struct for argument params, we might as well use it
rather than have them split between the struct and native params. For
consistency between the implementations, this also includes a shift from
float to int positioning for the base offset within the compositor's
global co-ordinate space.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 3a298b0b05 shell: Rename weston_solid_color_surface to weston_curtain_params
The name implied that it was a surface in and of itself, rather than
parameters used by a helper to create a surface and view.

Rename it now that we have weston_curtain as a name, and clean up
initialisers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone b77c2374ee shell: Rename solid_color_surface to weston_curtain
create_solid_color_surface actually returns a weston_view that it
creates internally. Since weston_solid_color_view is long and dull,
rename it to weston_curtain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Pekka Paalanen 0a38fc7e75 shared: fix WL_EXPORT style in config-parser.c
This was the only file in Weston using WL_EXPORT on its own line. Fix
the style to follow everything else.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-14 08:50:30 +00:00
Pekka Paalanen 32a790f774 shared: add WESTON_EXPORT_FOR_TESTS
This is a new function exporting macro that intends to make writing unit
tests in the Weston test suite easier.

A test needs to access a private function to be able to verify its
behavior. Previously we have used things like putting such functions in
a separate .c file and then building that file into the corresponding
test. That is a bit awkward and can lead to proliferation of arbitrary
.c files for no good reason. It may also require pre-processor magic,
and sometimes copying chunks of code causing a risk of deviating the
code being tested from the code actually used.

This patch proposes another approach: a private export from a DSO.
Except, private exports do not really exist, and this is just a normal
export with a specific C macro, and omitting the function from public
headers.

Once exported, a test program can link the DSO during build, be that a
shared library or even a plugin, use the private header declaring the
function, and simply call the function in the test.

The declaration of WESTON_EXPORT_FOR_TESTS is in shared/helpers.h so
that it is available to all components equally while still not being in
a public header. Other places that were considered:

- include/libweston/libweston.h is a public header, but external users
  should not know about the macro.

- libweston/libweston-private.h is too private and not available to all
  components, particularly color-lcms plugin.

- libweston/backend.h is not appropriate for color-lcms plugin either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-01 13:32:15 +00:00
Manuel Stoeckl b0ed4a2e3b gl-renderer: add support for (a|x)bgr16161616 shm formats
These formats are useful because they are often easier to produce
on CPU than half-float formats, and abgr16161616 has both >= 10bpc
color channels and adequate alpha, unlike abgr2101010.

The 16-bpc textures created from buffers with these formats require
the GL_EXT_texture_norm16 extension.

As WL_SHM_FORMAT_ABGR16161616 was introduced in libwayland 1.20,
update Weston's build requirements and CI.

The formats also needed to be registered in the pixel format table,
and defined in a fallback path if recent libdrm is not available.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2022-02-02 11:58:58 +00:00
Alexandros Frantzis 8b6daa41ab libweston: Introduce a safer wayland signal emission
Wayland signals (wl_signal) do not reliably handle changes to the
notification list during signal emission. Such scenarios occasionally
come up and can be difficult to investigate and debug.

This commit introduces the weston_signal_emit_mutable() function which can be
used in place of wl_signal_emit() and safely implements the following
behavior regarding notification list changes:

1. Listeners deleted during a signal emission and which have not already been
   notified at the time of deletion are not notified by that emission.

2. Listeners added during signal emission are ignored by that emission.

The implementation of weston_signal_emit_mutable() is copied from the
wlr_signal_emit_safe() function of the wlroots project.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2021-12-14 17:55:06 +00:00
Scott Anderson f9787ba482 gl-renderer: query DRM device given an EGLDisplay
Add function to query the DRM device given an EGLDisplay. It is the
device being used by the compositor to perform composition.

This will be useful in the next commits of this series, where we add
support for dma-buf feedback.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 10:47:39 -03:00
Alyssa Ross 7c12182576 clients: don't use deprecated fontconfig aliases
The "sans" and "mono" aliases for "sans-serif" and "monospace" are
deprecated[1].  Let's standardize on the non-deprecated versions, which were
already in use in some places.

[1]: be453bd159/fonts.conf.in (L33-67)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-11-18 10:57:16 +02:00
Marius Vlad 2be09373b4 desktop-shell, kiosk-shell: Migrate helpers to create a view to shell-utils
Incidentally fixes #553

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:32:24 +02:00
Marius Vlad d98c7e86fb shared/shell-utils: Create common helpers functions for shells
Group common functions found in both kiosk-shell and deskop-shell to
a shared utils file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:29:50 +02:00
Emmanuel Gil Peyrot eff793ab46 Fix indentation all through the project
Fixes a “regression” from 04918f3b0b, but
also other missed pieces.
2021-07-31 15:28:20 +00:00
Pekka Paalanen bc3c37840c shared: add str_printf()
asprintf() has the problem that it leaves *strp undefined when it
fails. Here is a simple wrapper that ensures NULL if asprintf() fails,
which is much more convenient to use.

This will be useful in future patches, where one needs to return error
messages from maybe failing functions, and more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-22 22:19:17 +00:00
Pekka Paalanen 091b1554da shared/cairo-util: fix leak from load_cairo_surface()
Fixes ASan reported leaks:

Direct leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f8266c8589a  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x5089a)
    #2 0x7f8266c4ea77  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x19a77)
    #3 0x55fa7818f8e8 in load_png ../../git/weston/shared/image-loader.c:297
    #4 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
    #5 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
    #6 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
    #7 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
    #8 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
    #9 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
    #10 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
    #11 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
    #12 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
    #13 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)

Indirect leak of 8024 byte(s) in 1 object(s) allocated from:
    #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x55fa7818f5e7 in load_png ../../git/weston/shared/image-loader.c:275
    #2 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
    #3 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
    #4 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
    #5 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
    #6 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
    #7 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
    #8 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
    #9 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
    #10 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
    #11 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)

from the command

	ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
	LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
	./tests/test-viewporter test_viewporter_bad_source_rect

by recording the pixman image as user data so it can be freed when the
surface is destroyed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Leandro Ribeiro 58393ca733 shared/helpers: fix ARRAY_COPY macro
In commit "backend-drm: simplify compile time array copy", the macro
ARRAY_COPY was introduced.

The macro STRING was accidentally introduced in the same commit, and as
it is completely unnecessary, remove it.

Also, memcpy was copying from src to dst, and it should do the opposite.
So fix it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-28 11:35:28 -03:00
Leandro Ribeiro 3193ab5807 backend-drm: simplify compile time array copy
In drm_fb_get_from_dmabuf() we have some compile time array copies, and
multiple static_assert() calls are needed (for safety). This makes the
code unpleasant to read.

Add ARRAY_COPY macro, to simplify the code.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:00:38 -03:00
Pekka Paalanen 4b301fe7f2 Add weston-drm-fourcc.h
This header is for sharing fallback definitions for drm_fourcc.h. A new
test in tests/yuv-buffer-test.c is going to be needing XYUV8888 format,
and more new formats will be expected with HDR supports.

Share these fallback definitions in one place instead of copying them
all over.

All users of drm_fourcc.h are converted to include weston-drm-fourcc.h
instead for consistency: have the same definitions available everywhere.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 14:35:03 +02:00
Maxime Roussin-Bélanger 5d10fe0264 shared: fix typos
Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
2021-02-24 10:00:32 -05:00
Pekka Paalanen eb5a95bfc9 libweston: move TYPEVERIFY macro into shared
This will be useful in the test harness macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-17 12:52:33 +00:00
Pekka Paalanen 49399806a0 config-parser: use zalloc()
While the code looks fine, clang 7 memory sanitizer complains about
things like:

==26052==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f4f4d003327 in weston_config_get_section /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:141:2
    #1 0x7f4f4cfce11a in wet_main /home/pq/build/weston-clang/../../git/weston/compositor/main.c:3266:12

==26683==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f09ebd638e2 in config_section_get_entry /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:125:2
    #1 0x7f09ebd661c4 in weston_config_section_get_bool /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:310:10
    #2 0x7f09ebd2e1e5 in wet_main /home/pq/build/weston-clang/../../git/weston/compositor/main.c:3269:3

In all cases, the errors point to wl_list_for_each().

Making these allocations use zalloc() avoids these errors. Since using
zalloc() is a good habit in any case, I didn't dig deeper.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-11-27 14:44:10 +02:00
Frank Binns 77d06f7b8b shared: fix unused variable warning
Fix the following build warning by moving the 'seals' declaration inside the
HAVE_MEMFD_CREATE guard:

  ../shared/os-compatibility.c: In function ‘os_ro_anonymous_file_get_fd’:
  ../shared/os-compatibility.c:341:6: warning: unused variable ‘seals’ [-Wunused-variable]
    int seals, fd;
        ^

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
2020-06-24 11:11:31 +01:00
Sebastian Wick f0d3a61491 shared: guard all the seal logic behind HAVE_MEMFD_CREATE
The initial version of os_ro_anonymous_file missed two guards around the
seal logic which leads to a compilation error on older systems.

Also make the check for a read-only file symmetric in
os_ro_anonymous_file_get_fd and os_ro_anonymous_file_put_fd.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2020-02-05 10:40:25 +01:00
James Hilliard 7b36f171d0 unconditionally include sys/mman.h in os-compatibility.c
Fixes:
../shared/os-compatibility.c:273:25: error: ‘PROT_READ’ undeclared (first use in this function); did you mean ‘LOCK_READ’?
  map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0);
                         ^~~~~~~~~
                         LOCK_READ

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-02-02 16:07:41 -07:00
Daniel Stone dd8219b3fb option-parser: Make bools boolean
When option-parser is confronted with a boolean option, have it write a
bool rather than treating the value as a pointer to an int32.

(lib)weston already heavily uses bool types internally, so this has the
nice side effect of eliminating quite a few local variables which only
existed as integer shadows of internal boolean variables.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-28 19:24:13 +00:00
Daniel Stone 51d995ad82 config-parser: Make get_bool be bool
Wayland innovated a lot of cool things, but non-binary boolean values is
the great advances of our time.

Make config_parser_get_bool() work on boolean values, and switch all its
users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-28 19:24:13 +00:00
Daniel Stone 3ef098fad1 config-parser: Export get_full_path and destroy
Make sure we export the get_full_path() accessor (declared in the
header, used by Weston itself) and the parser's destroy function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-25 12:27:08 +00:00
Sebastian Wick 178f17e25d shared: add read-only anonymous file abstraction
The ro_anonymous_file is an abstraction around anonymous read-only files.
os_ro_anonymous_file_create creates such a file with the contents passed
in data. Subsequent calls to os_ro_anonymous_file_get_fd return a fd
that's ready to be send over the socket.
When mapmode is RO_ANONYMOUS_FILE_MAPMODE_PRIVATE the fd is only
guaranteed to be mmap-able readonly with MAP_PRIVATE but does not
require duplicating the file for each resource when memfd_create is
available. RO_ANONYMOUS_FILE_MAPMODE_SHARED may be used when the client
must be able to map the file with MAP_SHARED but it also means that the
file has to be duplicated even when memfd_create is available.

See also:
weston commit 76829fc4ea
wayland commit 905c0a341ddf0a885811d19e2b79c65a3f1d210c

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-11-01 02:44:58 +01:00
Emmanuel Gil Peyrot deae98ef45 shared: Use memfd_create() when available
This (so-far) Linux-only API lets users create file descriptors purely
in memory, without any backing file on the filesystem and the race
condition which could ensue when unlink()ing it.

It also allows seals to be placed on the file, ensuring to every other
process that we won’t be allowed to shrink the contents, potentially
causing a SIGBUS when they try reading it.

This patch is best viewed with the -w option of git log -p.

It is an almost exact copy of Wayland commit
6908c8c85a2e33e5654f64a55cd4f847bf385cae, see
https://gitlab.freedesktop.org/wayland/wayland/merge_requests/4

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2019-10-24 07:32:17 +00:00
Adam Jackson ad0fe6b6f9 image-loader: Fix undefined left shift in premultiply_data
../shared/image-loader.c:184:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

Store each channel in a uint32_t instead of a byte so we compute the shift over
an unsigned type.
2019-10-16 16:06:06 -04:00
Pekka Paalanen ecdf50d38e gl-renderer: add EGL surfaceless platform support
This allows passing EGL_PLATFORM_SURFACELESS_MESA to
gl_renderer_display_create(). It is not useful on its own, because the
surfaceless platform has no window surfaces.

This feature will be used by the headless backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen b6c7a3020c build: use dependency for matrix.c
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 15:55:55 +03:00
Marius Vlad 6630f2acd3 shared/: Please compiler when passed certain compile flags
Fixes the following warn/error when using combination of flags like
building with debug, when disabling optimization and/or when enabling ASAN:

../shared/option-parser.c:61:1: error: control reaches end of non-void function [-Werror=return-type]

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-08-06 20:36:06 +03:00