Commit Graph

16 Commits

Author SHA1 Message Date
Antonio Borneo 3957863667 log: remove "%m" from format strings by using strerror(errno)
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.

In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.

Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-05-02 22:10:30 +02:00
Pekka Paalanen b5e3ea218b Rename src/ to libweston/
This clarifies what is supposed to be the libweston code.

v2: screen-share.c is already in compositor/ instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Bryce Harrington e99e4bf2b9 clients & tests: Unify multiple definitions of x*alloc and related functions
Direct fail_on_null calls now produce output like:

    [weston-info] clients/weston-info.c:714: out of memory

xmalloc, et al produce output on failure like:

    [weston-info] out of memory (-1)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-17 14:13:13 +02:00
Bryce Harrington 1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Pekka Paalanen effef73926 cliptest: sync calculate_edges with master copy
The master copy of calculate_edges() lives nowadays in gl-renderer.c.
Copy it verbatim from gl-renderer.c into cliptest.c.

Update cliptest.c for the following changes that happened in Weston
core, vertex.clipping.c, and gl-renderer.c:
- replace GLfloat with float
- introduction of weston_view, here replacing weston_surface
- API change of weston_view_to_global_float

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-20 11:51:27 +03:00
Ondřej Majerech 06e089275d Remove duplicated code from cliptest.c
Signed-off-by: Ondřej Majerech <oxyd.oxyd@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-20 11:43:26 +03:00
Derek Foreman a0fae4657f cliptest: Avoid use of uninitialized memory when regions don't intersect
Prevent attempting to draw the intersection polygon when it contains no
vertices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-19 12:46:11 +03:00
Bill Spitzak 36bcf47054 weston-cliptest --help works. You must use -b to run benchmark 2014-08-19 12:19:56 +03:00
vivek 31732f7c68 Clients: Fix memleak issues in various clients of weston
In many clients of weston, Display was not being destroyed so added it.
Also destroy windows, widgets which were not being destroyed.

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-06-24 10:22:43 -07:00
Andrew Wedgbury 9cd661e746 Make sure config.h is included before any system headers
There was an issue recently in screen-share.c where config.h was not
being included, resulting in the wrong definition for off_t being used on
32 bit systems. I checked and I don't think this problem is happening
elsewhere, but to help avoid this sort of problem in the future, I went
through and made sure that config.h is included first whenever system
headers are included.

The config.h header should be included before any system headers, failing
to do this can result in the wrong type sizes being defined on certain
systems, e.g. off_t from sys/types.h

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-04-07 10:22:28 -07:00
Jason Ekstrand ee7fefcffc Rename frame_create and frame_set_child_size with a window_ prefix
This is to avoid a collision with an actual frame structure.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Kristian Høgsberg 9a6c48d0fd cliptest: Use xmalloc in cliptest 2013-07-25 16:24:36 -07:00
Kristian Høgsberg 4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Pekka Paalanen 0d64a0fa29 compositor: new intersection algorithm
The existing algorithm had some corner cases (pun!), where it failed to
produce correct vertices in the right order. This appeared only when the
surface was transformed (rotated). It also produced degenerate polygons
(3 or more vertices with zero polygon area) for non-transformed cases
where the clipping and surface rectangles were adjacent but not
overlapping.

Introduce a new algorithm for finding the boundary vertices of the
intersection of a coordinate axis aligned rectangle and an arbitrary
polygon (here a quadrilateral). The code is based on the
Sutherland-Hodgman algorithm, where a polygon is clipped by infinite
lines one at a time.

This new algorithm should always produce the correct vertices in the
clockwise winding order, and discard duplicate vertices and degenerate
polygons. It retains the fast paths of the existing algorithm for the
no-hit and non-transformed cases.

Benchmarking with earlier versions showed that the new algorithm is
a little slower (56 vs. 68 us/call) than the existing algorithm, for
the transformed case.  The 'cliptest f' command before and after this
commit can be used to compare the speed of the transformed case only.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Rob Clark <rob.clark@linaro.org>
2012-09-12 12:27:35 -04:00
Pekka Paalanen 8c492b1293 clients: add cliptest program
Cliptest is for controlled testing of the calculate_edges() function in
compositor.c. The function is copied verbatim into cliptest.c.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-12 12:24:40 -04:00