Commit Graph

6848 Commits

Author SHA1 Message Date
Pekka Paalanen c01ba92eb2 gl-renderer: use pixel_format_info internally for EGL
Using arrays of pixel_format_info instead of just DRM format codes is useful
for fuzzy matching of formats with EGLConfigs in the future. The immediate
benefit is that we can easily print format names in log messages.

We should never deal with formats we don't have in our database, so discarding
unknown formats should be ok. Using unknown formats would become hard later,
too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Pekka Paalanen abd3f3c3ea pixel-formats: add RGBA bits and type fields
These fields are necessary when looking for an EGLConfig matching a pixel
format, but the configs do not expose a native visual id. Such happens on the
EGL surfaceless platform where one does not actually care about the exact pixel
format, one just cares it has the right number of bits for each channel and the
right component type.

FP16 formats are coming, so this paves way for them too, allowing them to be
described.

The FIXED/FLOAT terminology comes from EGL_EXT_pixel_format_float.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Pekka Paalanen ad8c7448cd gl-renderer: do not even pick a config with configless_context
If configless context is supported, we can skip choosing the "base" config
completely as it will never be used.

This simplifies the code a little bit.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Pekka Paalanen d8e851899a gl-renderer: use gl_renderer_get_egl_config() for display_create
Replace a direct call to egl_choose_config() with a higher level function
gl_renderer_get_egl_config(). This will make follow-up work easier when
attribute lists will be generated inside gl_renderer_get_egl_config() instead
of passed in as is.

We explicitly replace visual_id with drm_formats, because that is what they
really are. Only the DRM backend passes in other than NULL/0, and if other
backends start caring about the actual pixel format, drm_format is the lingua
franca.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Pekka Paalanen 8e42af02a6 gl_renderer: introduce gl_renderer_get_egl_config()
In an attempt to pull more of EGLConfig choosing into one place, refactor code
into the new gl_renderer_get_egl_config(). The purpose of this function is to
find an EGL config that not only satisfies the requested attributes and the
pixel formats if given but also makes sure the config is generally compatible
with the single GL context we have.

All this was already checked in gl_renderer_create_window_surface(), but
gl_renderer_create_pbuffer_surface() is still missing it. This patch is
preparation for fixing the pbuffer path.

We explicitly replace visual_id with drm_formats, because that is what they
really are. Only the DRM backend passes in other than NULL/0, and if other
backends start caring about the actual pixel format, drm_format is the lingua
franca.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Pekka Paalanen 5aaf8dc405 gl-renderer: move into egl-glue.c
Start a new source file for EGL glue stuff, for the EGL platform Weston runs
on. gl-renderer.c is getting too long, and I want to add even more boring code
(config pretty-printing etc.).

This pure code move, no changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00
Daniel Stone d7120032b0 renderer-gl: Assert function presence matches extensions
Some extensions (such as EGL_KHR_partial_update) add functions to EGL.
When the extension is present, GetProcAddress must return usable
function pointers for those entrypoints.

Assert that GetProcAddress returns a non-NULL function pointer in these
cases.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-10-02 11:53:31 +00:00
Adam Jackson 570490cef5 gl-renderer: Fix possible memory leak when no dmabuf modifers are supported
Some drivers support EGL_EXT_image_dma_buf_import_modifiers for format
enumeration, but don't have any modifiers. In this case, on platforms where
malloc(0) returns non-NULL, we would leak that allocation to the caller.

Handle this by noticing when the number of supported modifiers is 0 and
returning early.
2019-10-01 10:24:57 +00:00
Adam Jackson 95efe82982 simple-dmabuf-egl: Allow QueryDmaBufModifiers to report no modifiers
Some drivers expose the extension so they can expose
eglQueryDmaBufFormatsEXT, but don't support any modifiers. Treat this the
same as if the extension wasn't present.
2019-10-01 10:24:57 +00:00
Pekka Paalanen 8ba775d96d backend-drm: use format db for fallback too
Replace one more open-coded pixel format translation map with a call to our
central pixel format database, reducing duplication of format information.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:26:33 +00:00
Pekka Paalanen b766dbe3ac gl-renderer: remove print_egl_error_state
Nothing uses this, but the implementing function is used by gl-renderer
internally.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Pekka Paalanen 324e129172 gl-renderer: remove gl_renderer_output_surface
Nothing uses this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Pekka Paalanen c504e83b72 gl-renderer: remove gl_renderer_display
Nothing uses this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Pekka Paalanen 192ce0ae0b gl-renderer: remove platform_attribs
No caller ever used anything but NULL here, so just use NULL to simplify code.

In fact, no EGL platform defined today even defines any platform attributes
except the X11 platform for choosing a non-default SCREEN.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Pekka Paalanen b347edcc50 gl-renderer: fix typo native_window to native_display
It is a display, not a window.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Pekka Paalanen 7ad2871d75 gl_renderer: remove unused NO_EGL_PLATFORM
This became unused in:

commit e77f8ad79b
Author: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Date:   Wed Jun 8 17:39:37 2016 +0300

    compositor-fbdev: drop EGL support

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-01 09:17:10 +00:00
Miguel A. Vico 5c5f0272d9 compositor: Do not trigger invalid destructors when hotunplugging
When hotunplugging a display, the compositor will tear the top-level
wet_output object down, freeing its memory.

However, destruction of the backend output might be delayed in certain
situations (e.g. destroying DRM output while in the middle of a page
flip).

When the backend output is finally destroyed, it will trigger a
destruction callback previously added by the compositor, which point to
data belonging to the top-level wet_output object.

In order to avoid access to invalid data when the backend output is
destroyed after the top-level wet_output object, remove the destruction
callback from the corresponding list before freeing the object.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
2019-09-25 13:25:39 -07:00
Miguel A. Vico 620f68dc4f desktop-shell: Avoid NULL output dereference when getting surface label
When hotunplugging a display, the compositor will tear down the
corresponding output object.

Avoid NULL output dereferences by all surface label getters in
desktop-shell when hotunplugging happens.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
2019-09-25 13:25:39 -07:00
Pekka Paalanen 1ca4ed2015 clients: fix len-string formatting
All these have the printf format string wrong. "%*s" sets the field width but
does not limit the string to len bytes. You need to set precision instead to
limit to len bytes: "%.*s".

Found by grepping, after wondering why my WIP prints printed garbage at the
end.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-23 17:27:09 +03:00
Pekka Paalanen e62f276a21 backend-headless: make renderer type an enum
Helps adding one more type.

No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-19 15:56:06 +03:00
Pekka Paalanen e986de729d backend-headless: refactor into headless_output_disable_pixman
Pure refactoring. Preparing for adding GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-19 15:56:06 +03:00
Pekka Paalanen 4b0688fd77 backend-headless: refactor into headless_output_enable_pixman
Pure refactoring. Preparing for adding GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-19 15:56:06 +03:00
Pekka Paalanen b984a158d6 backend-headless: fix comment on use_pixman
The default is no-op, not GL. It doesn't even support GL.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-19 15:56:06 +03:00
sichem b86eb201ba libweston: Bring back 'weston_output_move'
For supporting output layout, compositors need the ability to manually set the
'weston_output' by 'weston_output_move'.

Signed-off-by: sichem <sichem.zh@gmail.com>
2019-09-13 08:57:31 +00:00
Ankit Nautiyal fc2c180926 backend-drm: Check for HDCP Content Type property before setting
Currently, a check is missing for the case if the HDCP Content Type
property is requested, but is not supported by the driver.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-30 19:46:04 +05:30
Ankit Nautiyal fbfcc304a4 man: Declare drm-backend support for HDCP
Modify weston.ini man page to update that drm-backend supports HDCP.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Ankit Nautiyal 4fd38138fa libweston: Notify the client, when output recording is started/stopped
In case of enforced protection mode, the renderer takes care of
censoring the protected content when the output recording is going on.
But in case of relaxed protection mode, the client must be notified to
avoid showing the protected content, if the output recording is on.

This patch handles the case, where the content-protection is enabled
with relaxed protection mode, and notifies the client, whenever the
recording is started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Harish Krupo 57d7883dd5 gl-renderer: Censor protected views when output is recorded
Contents on an ouput are captured when screenshooter/recorder/screen
sharing is enabled. In such cases the protected content must
be censored to ensure that it is not recorded along with unprotected
content. This is a required only when the surface protection is in
enforced mode.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Ankit Nautiyal faa5ab4e7b libweston: Add function to schedule idle task for updating surface protection
Currently, the idle task for updating surface protection is scheduled
in case of change in the output mask of a surface or in case of change
in protection status of an output.
This patch adds a function for reusing the code to schedule the
idle-tasks, that can be called whenever there is a chance of a change
in the protection status of a surface.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Ankit Nautiyal 93dde245ee libweston: Add functions to modify disable_planes counter for an output
The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Ankit Nautiyal a344fe3245 backend-drm: Add support for content-protection
Currently drm-layer supports HDCP1.4 using connector property:
Content Protection. This property if available for a platform, can be
read and set for requesting content-protection.
Also, the patch series [1] adds HDCP2.2 support in drm, and patch [2]
adds support to send udev events for change in connector properties,
made by the kernel.

This patch adds these HDCP connector properties in weston, and exposes
the content-protection support to the client for drm-backend.

It adds the enums to represent 'Content Protection' and 'Content Type'
connector properties exposed by drm layer. It adds a member
'protection' in drm_output_state, to store the desired protection
from the weston_output in the drm-backend output-repaint cycle. This
is then used to write the HDCP connector properties for the drm_heads
attached to the drm_output.

The kernel sends uevents to the user-space for any change made by it
in the "Content Protection" connector property. No event is sent in
case of change in the property made by the user-space.
It means, when there is a change of the property value from "DESIRED"
to "ENABLE" i.e. successful authentication by the kernel, a uevent
will be generated, but in case of userspace requesting for disabling
the protection by writing "UNDESIRED" into the property, no uevent
will be generated.

This patch also adds support for handling new udev events for HDCP
connector property changes. Any such change, triggers change in the
weston_head's current_protection.

[1] https://patchwork.freedesktop.org/series/57233/#rev7
[2] https://patchwork.freedesktop.org/patch/303903/?series=57233&rev=7

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Simon Ser 18e0cf85d6
build: reopen master for regular development 2019-08-24 00:14:35 +03:00
Simon Ser 3180fa8a12
build: bump to version 7.0.0 for the official release 2019-08-23 23:58:15 +03:00
Daniel Stone d32dfcf833 backend-drm: Enforce content protection for hardware planes
62626cbfec ensures that the GL render will not render a view's content
to the screen when the surface has requested a higher content-protection
level than the output currently offers.

When the HDCP MR was split into the core content-protection support in !83
and specific DRM support for HDCP in !48 (not yet landed), this opened a
hole where the DRM backend could promote a view to a hardware plane,
even if the output offered a lower protection level than the surface
wanted to enforce.

In the DRM backend, check the desired protection level, and refuse to
promote the view to a hardware plane if the output does not offer
sufficient protection. This will lead to presentation falling back to
the renderer, which may censor the content, reduce quality, etc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: 4b6e73d617 ("libweston: Add support to set content-protection for a weston_surface")
2019-08-23 20:51:43 +00:00
Manuel Stoeckl 5f592c7855 weston-terminal: Ignore SIGPIPE
This ensures that the default signal action doesn't kill weston-terminal
when the terminal tries to paste into a pipe whose read end has already
been shut down. (For example, a pipe from a misconfigured program or from
one which crashes/exits before the terminal calls write().)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-08-23 11:53:13 +00:00
sichem ec8c876e82 make weston_binding_destroy public 2019-08-23 11:47:44 +00:00
Marius Vlad e568488548 compositor: Return the number of bytes written as to format properly
Otherwise 'log_extensions()' will not know how to properly format the
data.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-08-19 12:52:29 +03:00
Marius Vlad 843b238551 weston-log: Return bytes written for 'printf()' and 'vprintf()' functions
Information is needed for 'vlog()' and 'vlog_continue()' (others
depend on them).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-08-19 12:40:42 +03:00
Simon Ser 670ac1c0ed
build: bump to version 6.0.93 for the RC1 release 2019-08-16 18:48:51 +03:00
Stefan Agner bf5b6219ae screen-share: use pixman_image_composite32 instead of pixman_blt
The function pixman_blt may return false in case there is no
accelerated blit function available. In this case the remote shared
screen stays black.

This has been observed on Weston compiled for aarch64. In currrent
pixman 0.38.4 there is no accelerated pixman_blt function for
aarch64 available.

Use pixman_image_composite32 instead which is guaranteed to have a
working fallback implementation.

Fixes: #253

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner ab840fc855 screen-share: move damage calculation after screen resize
Calculate damage region after resizing the cache image. This
avoids unnecessary calculation of damaged regions on resize,
makes sure that the whole screen is considered damaged on
resize and simplifies error handling.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner 64e2964159 screen-share: fix error handling
Make sure damage region gets properly unreferenced in error cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner 2b2c9a6f7f screen-share: align read_pixels call with screenshooter
Calculate y_orig separately first makes it easer to understand the
code and aligns with how pixels are read in screenshooter.c.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Emmanuel Gil Peyrot 45f5e536ec Fix a crash when closing an X11 window with a selection
This was caused by weston_wm_handle_xfixes_selection_notify() calling
weston_seat_set_selection() with a NULL source, apparently only
sometimes when closing an Xwayland window.
2019-08-15 14:03:48 +02:00
Manuel Stoeckl 324d846567 clients/simple-egl: Exit when display has an error
Check return values for wl_display_dispatch_* functions, so that
the program stops running when the compositor that it is connected
to crashes.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-08-12 18:43:30 +00:00
Marius Vlad 7216d4c44b compositor: Bring back the old timestamp format for the log scope
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-08-12 18:31:46 +00: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
Marius Vlad bed9b81a39 compositor: Use only 'log' scope to print libwayland messages
No need to duplicate messages.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-08-06 14:34:17 +03:00
Simon Ser 1a3c6df5d5
build: bump to version 6.0.92 for the beta release 2019-08-02 19:11:52 +03:00
Simon Ser d9cec1261c releasing: update for the new release process
A few things have changed:

- Meson is used instead of autotools
- Wayland and Weston releases are not synchronized anymore
- Artifact deployment happens via wayland.freedesktop.org's Git repo

While at it, also convert the file to Markdown. Instructions to locally install
Xwayland/libinput have been dropped.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-08-02 15:03:46 +00:00