Commit Graph

6043 Commits

Author SHA1 Message Date
Emil Velikov 863e66b003 compositor-drm: correctly set the version of the drmEventContext
We implement v2 so use that instead of the DRM_EVENT_CONTEXT_VERSION
macro.

The latter defines the version of the drmEventContext struct declared in
the header [used in the current build] and can be 2, 3 or even 1000.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-04-07 14:23:38 +01:00
Daniel Stone 95d48a2a88 compositor-drm: Return FB directly from render
Instead of setting state members directly in the drm_output_render
functions (to paint using Pixman or GL), just return a drm_fb, and let
the core function place it in state.

This brings damage handling in line with repaint state, so we do not
clear damage if repaint fails.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone 4e84f7dd32 compositor-drm: Reshuffle drm_output_render
Call drm_output_render unconditionally, doing an early exit if we're
already rendering a client buffer on the primary plane.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone 5bb8f58fd2 compositor-drm: Rename current/next FB members
'next' is used as a framebuffer which has either been rendered but not
had a configuration request (pageflip or CRTC set) applied to it, or
when for a framebuffer that has had configuration requested but not
applied (delayed pageflip where the event has not been applied).

'current' is used as the last framebuffer for which we know
configuration has been fully applied, i.e. CRTC set executed or pageflip
requested and event received.

Rename these members to fb_current and fb_pending, doing some small
reordering of drm_output whilst in the vicinity.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone e42568313c compositor-drm: Use drm_fb for cursor buffers
Now that we have better types in drm_fb, use it for cursor buffers as
well. This gives us easier refcounting for our cursors, as well as a
unified buffer-destruction path.

Currently this makes no difference, as the KMS legacy cursor update API
uses GEM names directly, and never touches DRM FBs. However, the cursor
plane becomes a regular KMS plane under atomic, at which point we
require DRM FBs.

Take the opportunity to move to drm_fb ahead of time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone 6e7a961d43 compositor-drm: Refcount drm_fb
Sometimes we need to duplicate an existing drm_fb, e.g. when
pageflipping to the same buffer to kickstart the repaint loop. To handle
situations like these, and simplify resource management for dumb and
cursor buffers, refcount drm_fb.

drm_fb_get_from_bo has a path where it may reuse a drm_fb, if the BO has
been imported and not released yet. As drm_fb_unref now relies on actual
refcounting (backed up by asserts), we add a balancing drm_fb_ref() to
the path where we return a reused drm_fb.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone 05a5ac2b8f compositor-drm: Drop output from release_fb
We only need it for the GBM surface the FB was originally created
against; a mismatch here is very bad indeed, so no reason to pass it in
explictly every time rather than store it.

Following patches change drm_fb to be explicitly reference counted; in
order to reduce churn, rename drm_output_release_fb to drm_fb_unref
whilst changing its call signature here, even though it does not yet
actually perform reference counting.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Tomohito Esaki 576f42effe compositor-drm: Refactor destroy drm_fb function
The drm_fb destroy callback to mostly the same thing regardless of
whether the buffer is a dumb buffer or gbm buffer. This patch refactors
the common parts into a new function that can be called for both cases.

[daniels: Rebased on top of fb->fd changes, cosmetic changes.]

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:12 +03:00
Daniel Stone 0b70fa4b56 compositor-drm: Store format in drm_fb
This uses the new pixel-format helpers, so we can also replace depth/bpp
with these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalaneN@collabora.co.uk>
2017-04-07 12:45:11 +03:00
Daniel Stone fc175a7ec8 compositor-drm: Add explicit type member to drm_fb
Rather than magically trying to infer what the buffer is and what we
should do with it when we go to destroy it, add an explicit type
instead.

In doing so, the test for dumb images (destroying them, but only if
they're not the 'live' ones) is removed. This was dead code, as the only
path which could cause us to shuffle images is drm_output_switch_mode.
This calls drm_output_release_fb before the images are reallocated in
drm_output_fini_pixman / drm_output_init_pixman, with the reallocation
unconditionally destroying the images, so can never be hit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:11 +03:00
Daniel Stone a7cba1d4cd compositor-drm: Calculate more cursor state up front
Make drm_output_set_cursor more deterministic, by calculating more state
and performing more plane manipulation, inside
drm_output_prepare_cursor_view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:45:11 +03:00
Daniel Stone 903721a621 libweston: Add pixel-format helpers
Rather than duplicating knowledge of pixel formats across several
components, create a custom central repository.

Signed-off-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix include paths and two copy-pastas]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-04-07 12:28:36 +03:00
Pekka Paalanen b030897b38 build: make libdrm a hard build-time dependency
Libdrm provides headers that are useful even without libdrm.so itself,
particularly drm_fourcc.h. Therefore promote libdrm as a hard build-time
dependency of libweston core so that we can always rely on libdrm
headers.

This does not affect any runtime dependencies. Specifically, no runtime
dependency to libdrm.so is added in any build configuration.

Currently only gl-renderer is using drm_fourcc.h. Now we can drop the
GL_RENDERER check from configure.ac and just use LIBDRM_CFLAGS.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka, from Quentin: just drop have_libdrm var completely]
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-04-07 12:07:58 +03:00
Pekka Paalanen 4e3522bbd5 build: do not link libdrm without DRM backend
The pkg-config test for LIBDRM is independent of whether the DRM backend
is enabled or not. Therefore it is possible to have libdrm available and
found, even though it is not needed.

Do not link libdrm.so into the launchers unless it is really needed,
that is, DRM compositor is built. Otherwise you end up with
fbdev-backend.so and weston-launch depending on libdrm.so.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-04-07 12:02:47 +03:00
Pekka Paalanen 2667e9e399 configure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR
HAVE_LIBDRM was used as a condition for the launcher infrastructure to
call libdrm.so functions. It was set by an independent test for libdrm,
which would silently continue if libdrm was not found. It was assumed
that if you enabled a feature that used libdrm at runtime, the test for
that feature would imply that HAVE_LIBDRM is also set. This was quite
subtle.

The only feature that actually uses libdrm.so at runtime is the DRM
backend. No other backend needs the libdrm calls in the launcher
infrastructure.

Therefore to simplify things, stop using HAVE_LIBDRM and use
BUILD_DRM_COMPOSITOR instead. If you enable the DRM compositor, you
automatically also get libdrm support in the launchers.

There are still things depending on LIBDRM_CFLAGS and LIBDRM_LIBS, so
the test cannot be removed completely.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-04-07 12:02:47 +03:00
Emmanuel Gil Peyrot c394179488
desktop-shell: Position maximized surfaces on the correct output.
During a maximize event, a surface was previously always put back to
the primary output after one frame on the correct output, while keeping
its size.  This was caused by the shell surface’s last_{width,height}
not being reset when it was either fullscreen or maximized, leading to
the unmaximize/maximize dance being done at each commit.

This was introduced in 8f9d90a84b.

Changes since v1:
- Fix the actual issue instead of a symptom.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-04-06 15:26:09 +02:00
Sergi Granell 597dde5cf6
wcap: Prevent fd leak in wcap_decoder_create() fail path
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:41:45 +02:00
Raúl Peñacoba fec723ef56
compositor-wayland: Properly dealloc mmap data using munmap
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:38:30 +02:00
Raúl Peñacoba 745e647f18
editor: Add missing free() and display_destroy() in main
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:36:06 +02:00
Raúl Peñacoba bd8dc0a255
ivi-layout: Add missing free() in ivi_view_create
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:32:46 +02:00
Raúl Peñacoba 5fc8d5eb9d
gl-renderer: Change 'data' type to 'uint8_t *', since 'void *' arithmetic is undefined
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:26:36 +02:00
Sergi Granell ceb5981af0
compositor-drm: Add missing drmModeFreeResources in drm_device_is_kms
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:20:58 +02:00
Sergi Granell eaa7358403
compositor-wayland: Call weston_compositor_exit when receiving an xdg toplevel close event
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 17:29:09 +01:00
Raúl Peñacoba 07a2b99f7f
desktop-shell: Remove unused variable in panel_create
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 17:25:32 +01:00
Sergi Granell ed016bff23
compositor-wayland: Call set_window_geometry when using zxdg_shell_v6
This way Wayland compositors will be aware of Weston's
"visible bounds" (and ignore its shadows).

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 00:26:06 +01:00
Derek Foreman 88353ddad7
weston-terminal: Fix race at startup
If anything is printed for the terminal window to display before the
window has been initially sized we end up with a segfault.

This defers the exec() of the shell child process until after the
window is sized so this can't happen anymore.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 22:43:20 +01:00
Derek Foreman 091c801705
desktop-shell: launch clients in their own process group.
Client applications shouldn't be in the same process group as
the display server.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 21:18:20 +01:00
Derek Foreman f0d39b2243
weston: Set CLOEXEC on stdin
We don't want to leak this into apps launched from the panel.

stdout and stderr are left for now because some things launched
by weston - such as weston-keyboard - share weston's log by
printing to those fds.

I'm singling out stdin because it's never needed by a child process
and because it's value is 0, which makes it easy to accidentally
do bad things to (commit 5c611d933f)

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 21:16:43 +01:00
Derek Foreman 5ef6bd7eee
os: Check for EINTR on ftruncate()
The man page indicates that ftruncate() can set errno to EINTR, so test
for this.

I have not actually been able to provoke an EINTR error from ftruncate()
in testing though.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 21:02:30 +01:00
Derek Foreman 91d4bce7c3
os: Check for EINTR on posix_fallocate()
posix_fallocate() can return EINTR and need to be restarted - I've hit
this when running weston-terminal under gdb.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 21:00:54 +01:00
Sergi Granell 7fecb43735
compositor-wayland: Check the return value of wayland_output_create_common
If wayland_output_create_common returns NULL, it means that
the output creation failed.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 20:55:37 +01:00
Sergi Granell 2dcbb8d20d
compositor-wayland: Refactor struct wayland_output::name usage
struct wayland_output::name was used but never initialized.
Also zxdg_toplevel_v6_set_title was only called for windowed outputs,
and some compositors let you see the client's name even when it is
fullscreen (GNOME Shell's Activities menu for example).

So rename struct wayland_output::name to struct wayland_output::title and
precompute it on wayland_output_create_common(), so it can be later used
on xdg's set_title and frame_create.

v2: Move zxdg_toplevel_v6_set_title() before the wl_surface_commit()
as per Quentin Glidic's suggestion.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 20:54:00 +01:00
Sergi Granell b4c088630f
Fix uninitialized msec_to_next in output_repaint_timer_arm
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-22 17:55:07 +01:00
Pekka Paalanen 65e57c93ca man: move pageflip-timeout later
The paragraph about pageflip-timeout was added in between the two
paragraphs of idle-time, causing the paragraphs to be associated wrong.

Move the pageflip-timeout paragraph to the end.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100163

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-03-20 12:45:13 +00:00
Derek Foreman 7609178917 weston-terminal: Add a --maximized command line parameter
This is useful for testing compositor response to a client that
requests a maximized initial surface.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-03-17 17:48:49 +00:00
Daniel Stone 5a313c2f00 weston-launch: Add sysmacros.h include for major()
Same as with c4d7f66c, but I hadn't done a full-tree rebuild so didn't
see this one go by.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-03-17 17:38:09 +00:00
Daniel Stone 4933ca5e57 libinput: Suppress unhandled-case warning
When the wheel tilt source is present, gcc complains that we don't
handle all possible enumeration values. We already ensure this cannot
happen in its only caller (handle_pointer_axis), but gcc doesn't
recognise this. Give it a default value to quiet the warning.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-17 17:37:47 +00:00
Derek Foreman 300bc6efea simple-dmabuf-v4l: Remove incorrect assert
According to v4l2 documentation, DQBUF always clears FLAG_DONE, so
this assert can be expected to fire 100% of the time.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-17 13:53:46 +02:00
Pekka Paalanen 080f130092 configure: bump libweston to 3.0.0
Bump the future release to 3.0.0 due to breaking ABI in libweston.

We have merged a few patches already that change libweston/compositor.h.
While most of the changes arguably change only things libweston users
should not be touching, some change the size of e.g. struct
weston_output and struct weston_compositor, possibly moving member
offsets. We also haven't separated public and private parts from
compositor.h yet. To be on the safe side, bump the major now. I'm sure
there will be more changes that make the bump obviously necessary.

Cc: Bryce Harrington <bryce@osg.samsung.com>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-03-16 14:14:02 +02:00
Daniel Stone b1f166d71e Allow backends to group repaint flushes
Implement new repaint_begin and repaint_flush hooks inside
weston_backend, allowing backends to gang together repaints which
trigger at the same time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-14 12:01:50 +02:00
Daniel Stone 6847b858a3 Switch to global output repaint timer
In preparation for grouping output repaint together where possible,
switch the per-output repaint timer, to a global timer which iterates
across all outputs.

This is implemented by storing the absolute time for the next repaint
for each output locally, and maintaining a global timer which iterates
all of them, scheduling the repaint for the first available time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: The comment about 1 ms delay.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-14 11:43:24 +02:00
Daniel Stone c4d7f66c12 launcher: Add sysmacros.h include for major()
glibc 2.25 produces a warning when sysmacros.h is not directly included
but major() is used, as it is intended to be moved to sysmacros.h and
only there. Include it to keep the build happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2017-03-13 17:56:16 +00:00
Daniel Stone 2ef9b1a3c4 Fix 'implicit fallthrough' warning with new GCC
GCC 7 now warns on case statements falling through without an explicit
comment that falling through is OK. Insert some to make it happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2017-03-13 17:56:07 +00:00
Daniel Stone 05df8c16ec Change boolean repaint_scheduled to quad-state enum
repaint_scheduled is actually cleverly a quad-state, disguised as a
boolean. There are four possible conditions for the repaint loop to be
in at any time:
  - loop idle; no repaint will occur until specifically requested, which
    may be never (repaint_scheduled == 0)
  - loop schedule to begin: the loop was previously idle, but due to a
    repaint-schedule request, we will call the start_repaint_loop hook
    in the next idle task
  - repaint scheduled: the compositor has definitively scheduled a
    repaint request for this output, which will occur in fixed time
  - awaiting repaint completion: the backend has not yet signaled
    completion of the last repaint request, and the compositor will not
    schedule another until it does so

All but the first condition were previously conflated as
repaint_scheduled == 1, but break them out into separate conditions to
aid clarity, backed up by some asserts.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:20:06 +02:00
Daniel Stone 09a97e2402 Change repaint_needed to bool
It is only used as a binary value.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:20:06 +02:00
Daniel Stone 3615ce1955 Don't delay initial output paint
On startup, we cannot lock on to the repaint timer because it is unknown
to us. We deal with this by claiming that the moment of entry into the
repaint loop is the moment a frame returned, causing finish_frame to
delay our initial repaint to (refresh_time - repaint_delay), typically
around 9ms of utterly wasted time.

Add an explicit stamp == NULL, to determine that we are just beginning
our repaint loop, that the timings are in fact totally invalid, and that
it would be beneficial to repaint the output immediately. This will only
trigger when the display had previously been disabled or the previous
state is unknown, e.g. at startup, or coming back from DPMS off.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:20:06 +02:00
Daniel Stone 84aff5c77a Calculate next-frame target time in absolute space
Rather than determining the time until next-frame repaint in relative
space (time until repaint), determine it first in absolute space, and
then later convert this to relative.

This will later allow us to store these per-output, so we can have a
single idle timer which will allow us to aggregate multiple repaints
together when timing allows.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:20:06 +02:00
Daniel Stone 839b63546d timespec: Add timespec subtraction helpers
Add helpers to subtract two timespecs, then return the difference in
either milliseconds or nanoseconds. These will be used to compare
timestamps during the repaint cycle.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:20:06 +02:00
Daniel Stone 37ad7e3bae timespec: Add timespec_to_msec helper
Paralleling timespec_to_nsec, converts to milliseconds.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: added doc about flooring]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-13 14:19:46 +02:00
Daniel Stone 61f6d7d372 timespec: Add timespec_add_msec helper
Add a (timespec) = (timespec) + (msec) helper, to save intermediate
conversions in its users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-08 11:57:34 +02:00