Commit Graph

242 Commits

Author SHA1 Message Date
Scott Anderson 7ca3bc1d6f Fix libdrm includes
This removes any assumptions about how the libdrm headers are installed,
and uses the pkg-config include directories as we're "supposed to".
This only adds a partial dependency, since we don't actually need to
link against libdrm.
2018-10-15 11:39:35 +13:00
emersion 7daca85bcf
Merge pull request #1309 from swaywm/fix-headless-libinput
Fix headless backend
2018-10-14 08:33:25 +02:00
Cole Mickens 43d0ebfdac
Fix include path for (libdrm/)drm_fourcc.h
This PR broke a private nixpkgs definition I have for wlroots: https://github.com/swaywm/wlroots/pull/1304

It is fixed by changing `#include <drm_fourcc.h>` to `#include <libdrm/drm_fourcc.h>`, which follows what is already done in the dmabuf example.
2018-10-13 21:36:58 -07:00
Drew DeVault 63c69cee6e Fix headless backend
It was only working if you ran it underneath an already-working Wayland
compositor. Running with the headless backend on the API would break.
2018-10-13 23:39:38 -04:00
nyorain affbfb6a28 Support older wlr_linux_dmabuf_v1 clients
If a client uses an older version of the dmabuf protocol, use the
`formats` event instead of `modifiers` (since that didn't exist in older
versions).
With a bit of necessary guessing, support dmabuf importing even when
EGL_EXT_image_dma_buf_import_modifiers isn't present instead of
failing up front.
2018-10-12 23:07:45 +02:00
emersion 2f0815838d Init dmabuf global in renderer 2018-09-02 08:50:43 +02:00
Scott Anderson dc37194291 Change how glgen.sh outputs files
This fixes building wlroots as a subproject.
2018-08-24 19:35:21 +12:00
Scott Anderson fd3fa760d3 Revert "Revert "Merge pull request #1194 from ascent12/meson_feature""
This reverts commit 9c886f20b9.
2018-08-24 19:35:02 +12:00
Drew DeVault 9c886f20b9 Revert "Merge pull request #1194 from ascent12/meson_feature"
This breaks wlroots when used as a meson subproject.

This reverts commit dea311992e, reversing
changes made to 6db9c4b746.
2018-08-23 21:00:58 -04:00
Scott Anderson a2bbf2c1f7 Make style more consistent 2018-08-22 21:16:16 +12:00
Mariusz Bialonczyk ad406db21c gles2: change context when it is not current
Texture functions, that create and manipulate textures should switch
the current context if necessary.

thanks to: @emersion

Fixes #934
2018-08-03 07:43:22 +02:00
Drew DeVault b902c2bd7c Revert "Move side-effect out of assert statement"
This reverts commit a0afedcd8f.
2018-07-13 15:46:54 -04:00
Drew DeVault a0afedcd8f Move side-effect out of assert statement 2018-07-13 13:54:09 -04:00
emersion c4915d1492 render: add wlr_texture_is_opaque 2018-07-12 23:35:33 +01:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion cc9b198f9e
render/gles2: ditch extra parens 2018-06-30 23:19:02 +01:00
emersion bf7560b7cd
screencopy: add capture_output_region support 2018-06-30 22:18:04 +01:00
emersion 2b9cbaddf3
screencopy: add support for frame flags 2018-06-30 22:18:03 +01:00
Dominique Martinet 4cc4412481 wlr_renderer_destroy: fix renderer NULL check
renderer is checked for NULL, but was dereferenced before that.

Found through static analysis
2018-06-30 11:38:21 +09:00
emersion 57548b557a
Merge branch 'master' into screencontent 2018-06-17 14:49:18 +01:00
emersion d643361c48
Merge pull request #1047 from NotKit/gles2fix
Fix GLES2 renderer to use glGetUniformLocations locations
2018-06-13 15:37:16 +01:00
NeKit 6f29db1044 gles2 renderer: introduce struct wlr_gles2_tex_shader 2018-06-13 13:43:01 +03:00
Vincent Vanlaer f1a62a3200 Rename egl.exts to match the extension names 2018-06-09 19:11:51 +02:00
Vincent Vanlaer 5ec6d8230d Split eglSwapBuffersWithDamage feature detection
Detecting whether eglSwapBuffersWithDamageEXT or
eglSwapBuffersWithDamageKHR is used should be based on the extension
string, not only on the availability of the function.
2018-06-09 11:39:14 +02:00
Brian Ashworth 18bbe2d897 Fix atti assert in wlr_egl_init 2018-06-08 20:25:36 -04:00
emersion 457bfcab19
render/egl: only request high priority context on DRM 2018-06-08 00:17:45 +01:00
emersion d425edc96c
render/egl: consistent extension checking 2018-06-08 00:06:34 +01:00
emersion cbfe0e834a
Request a high priority EGL context 2018-06-08 00:06:34 +01:00
NeKit de91c55ea9 Fix GLES2 renderer to use glGetUniformLocations locations
This is needed as uniform locations are driver implementation-specific.
2018-06-07 18:06:31 +03:00
emersion 6b7a55aa3d
Merge pull request #1020 from emersion/remove-check-dmabuf
render: remove wlr_renderer_check_import_dmabuf
2018-05-31 21:49:57 +01:00
emersion 21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
Genki Sky d1cf9acbd5 cleanup: Use void for zero-parameter functions
Signed-off-by: Genki Sky <sky@genki.is>
2018-05-30 20:19:16 -04:00
emersion 135721118a
render: remove wlr_renderer_check_import_dmabuf
It's possible to implement it outside the renderer, by creating a
texture and destroying it right away. This reduces the API surface
of the renderer.
2018-05-30 17:08:15 +01:00
emersion 28020ff577
Only allow one modifier per DMA-BUF, split attributes struct in render/ 2018-05-30 09:29:12 +01:00
emersion 5ba1a9af56
render: add wlr_texture_to_dmabuf 2018-05-29 18:47:17 +01:00
emersion 6eb4b5b54d
Merge pull request #993 from emersion/bind-wl-drm-in-renderer
render: bind wl_drm in renderer
2018-05-25 13:54:16 +01:00
Ilia Bozhinov 24cf70ae96 backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its
renderer. Currently all backends create an EGL/GLES2 renderer, so
the necessary attributes for creating the context are passed to a
user-provided callback function. It is responsible for initializing
provided wlr_egl and to return a renderer. On fail, return 0.

Fixes #987
2018-05-25 14:56:52 +03:00
agr 4e89e0fc6c fix server exit: eglMakeCurrent Invalid display 2018-05-23 16:17:29 +02:00
emersion 41130fe54b
render: bind wl_drm in renderer 2018-05-21 19:07:08 +01:00
Ilia Bozhinov 47ffd0e184 gles2: pre-multiply alpha and fix blending function 2018-05-18 20:34:36 +03:00
Brian Ashworth 35e83800d4 Fix alpha for src_rgba and src_rgbx 2018-05-15 22:29:36 -04:00
Alain Greppin b2f8f00ae3 fix check of EGL_WL_bind_wayland_display presence 2018-05-13 15:17:17 +02:00
emersion 5a87712ca8
Log required extension name if unavailable 2018-04-26 11:11:28 +01:00
Drew DeVault fecb971518
Merge pull request #902 from emersion/various-memory-leaks
Various memory leaks
2018-04-26 11:34:49 +02:00
emersion 449f06556a
Destroy wlr_surface with wlr_renderer 2018-04-26 00:11:36 +01:00
emersion 71ca45e2c0
Make sure we don't use others' prefixes 2018-04-25 23:24:58 +01:00
emersion 018b82c01e
render/egl: allow passing NULL to surface and image destructors 2018-04-25 08:28:48 +01:00
emersion eaed6bd03b
render/egl: add wlr_egl_destroy_surface 2018-04-24 23:44:43 +01:00
Rostislav Pehlivanov 12298ce88c Do not advertize *RGB8888 as supported shm formats
They're always available and supported, and are added automatically.
Adding them again just duplicates them.
2018-04-21 14:58:25 +01:00
Drew DeVault b116414bd5
Merge pull request #880 from emersion/advertize-renderer-formats
Advertize supported renderer formats
2018-04-21 14:45:09 +02:00
emersion 1588094b99
Remove a few local prefixed symbols 2018-04-21 10:20:33 +01:00
emersion 70d820be25
Add wlr_renderer_init_wl_shm to advertize supported renderer formats 2018-04-20 23:58:30 +01:00
emersion 1b802d9251
Make wlr_renderer_scissor take normal coords instead of upside-down ones 2018-04-12 19:38:33 -04:00
emersion d2ebbd103c
backend: remove wlr_backend_get_egl 2018-04-08 11:00:56 -04:00
Guido Günther 6a05bd3886 egl: silence dmabuf error when extension is not present
This makes it match 4bf936360d.
2018-04-04 09:28:07 +02:00
emersion f3f61bed3e
Untie wlr_gles2_renderer and wlr_gles2_texture 2018-04-01 16:07:50 -04:00
emersion a7bb48b404
render/egl: add wlr_egl_create_image_from_wl_drm
This allows external renderers and potential future GL-based
renderers to re-use this function.
2018-03-31 23:20:00 -04:00
emersion 33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
Drew DeVault 23d357e371 Downgrade gles2 messages to L_DEBUG
L_INFO is for stuff that's useful to the user
2018-03-31 00:27:30 -04:00
Orestis Floros c9ed6fed59
Fix build error with -O2
../render/gles2/renderer.c: In function ‘gles2_render_texture_with_matrix’:
../render/gles2/renderer.c:140:2: error: ‘target’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  glBindTexture(target, tex_id);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../render/gles2/renderer.c:145:2: error: ‘prog’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  glUseProgram(prog);
2018-03-31 01:05:33 +03:00
Tony Crisci 330ee08126
Merge pull request #744 from emersion/texture-redesign
Redesign wlr_texture
2018-03-28 00:14:57 -04:00
Drew DeVault 13edb19a6c Fix issue starting up client EGL on X11 backend 2018-03-27 18:51:38 -04:00
Drew DeVault f444a0d14c Implement layer surface damage 2018-03-27 18:50:32 -04:00
Drew DeVault 4bf936360d Arrange & render layer surfaces 2018-03-27 18:50:09 -04:00
emersion c42fd1018b
render: remove GL calls from wlr_egl 2018-03-27 17:02:48 -04:00
emersion adf4fb08dd
Merge branch 'master' into texture-redesign 2018-03-26 19:13:13 -04:00
emersion 793c3b3047
render: add simple functions to render rectangles and ellipses 2018-03-26 12:41:51 -04:00
emersion c63d94483b
Redesign wlr_texture
- Textures are now immutable (apart from those created from raw
  pixels), no more invalid textures
- Move all wl_drm stuff in wlr_renderer
- Most of wlr_texture fields are now private
- Remove some duplicated DMA-BUF code in the DRM backend
- Add more assertions
- Stride is now always given as bytes rather than pixels
- Drop wl_shm functions

Fun fact: this patch has been written 10,000 meters up in the air.
2018-03-24 23:48:32 -04:00
Guido Günther b1852096c5 linux-dmabuf: Support multi plane formats like NV12 2018-03-23 09:03:31 +01:00
emersion a854c2f246
Merge branch 'master' into gles2-renderer-redesign 2018-03-23 00:55:55 +01:00
emersion b1f93bc5cc
render/egl: use EGL_KHR_debug 2018-03-21 10:42:43 +01:00
emersion 8207f0f081
render/gles2: use gles2_pixel_format::has_alpha for shader selection 2018-03-21 08:53:36 +01:00
emersion cc5ef1d2ff
render/gles2: move list of supported WL formats to pixel_format.c 2018-03-21 08:50:59 +01:00
emersion 3581573bdc
render/gles2: make wlr_renderer_begin take viewport size
This allows raw GL calls outside wlr_renderer to be removed.
2018-03-21 07:37:09 +01:00
emersion 95e86e675a
render/gles2: remove global state, use OpenGL debug extension 2018-03-20 19:14:33 +01:00
Guido Günther 2d01663b25 gles2: Honor alpha in fragment_src_external
By using the same vertex shader and adding alpha to the fragment shader
for external textures we can:

  - use alpha blending
  - have wlr_gles2_render_texture_with_matrix work with
    the GL_TEXTURE_EXTERNAL_OES. So far this failed
    since we passed in alpha which was unknown by fragment_src_external
2018-03-20 14:30:30 +01:00
Guido Günther 13e4ba4867 gles2_texture_bind: use texture's target type
Hardcoding GL_TEXTURE_2D leads to rendering errors when using
GL_TEXTURE_EXTERNAL_OES textures.
2018-03-20 14:30:30 +01:00
Guido Günther b3cb5a36c7 gles2: allow to specify texture target type
Allow to set the texture target type when generating/binding the
texture.  This allows us to attach the texture type to the texture so we
don't have to keep the logic elsewhere.
2018-03-20 14:30:30 +01:00
emersion c41de2d1be
render: split render.h into wlr_renderer.h and wlr_texture.h 2018-03-19 23:16:29 +01:00
emersion 6ecb0eefcb
render/gles2: transpose matrices before binding them
Setting glUniformMatrix3fv's transpose parameter to GL_TRUE is
not allowed for OpenGL ES 2.

This adds a wlr_matrix_transpose function.
2018-03-19 20:21:02 +01:00
Drew DeVault 1956d3cedb
Merge pull request #722 from emersion/matrix-redesign
Matrix redesign
2018-03-17 15:22:00 -04:00
Guido Günther 7fd7dff26f egl: print supported dmabuf formats
Useful for debugging dmabuf related problems e.g. when a client requests
a certain and we fail to support it.
2018-03-16 09:47:21 +01:00
emersion f1cbbac636
render/gles2: remove matrix transposition in shaders 2018-03-15 21:30:31 +01:00
emersion 876f07e9f1
renderer: replace wlr_texture_get_matrix by wlr_render_texture 2018-03-15 19:31:02 +01:00
emersion 0e253e0615
render/gles2: don't set inverted_y when EGL_WAYLAND_Y_INVERTED_WL is unsupported 2018-03-15 15:51:15 +01:00
emersion 8b58e1a3ad
Merge branch 'master' into matrix-redesign 2018-03-15 15:48:09 +01:00
emersion 824a95ad19
matrix: use 2D matrices 2018-03-15 15:33:58 +01:00
Guido Günther 653bc282a7 Indent GLSL by two spaces
since this is the most established indentation
2018-03-15 12:40:18 +01:00
Guido Günther 14cdb6153f Add initial linux_dmabuf protocol support
Tested with

    ./weston-simple-dmabuf-drm
    ./weston-simple-dmabuf-drm --import-immediate=1
    ./weston-simple-dmabuf-drm --y-inverted=1
    (and combinations)

Supports only single plane XRGB dmabufs for now.
2018-03-15 12:40:18 +01:00
emersion d26b67cb06
matrix: unify API, don't use array pointers 2018-03-15 11:10:56 +01:00
emersion b6a3f240c7
matrix: move to types/ 2018-03-15 09:11:27 +01:00
Guido Günther 2d0db16942 render: Flip textures in case of inverted_y 2018-03-11 19:02:05 +01:00
emersion d9571f27e6
Merge pull request #691 from agx/egl_ext_match
Avoid false positives on egl extension matching
2018-02-28 21:22:00 +01:00
Guido Günther d9f2e90df6 Avoid false positives on egl extension matching
Due to the strstr prefix match EGL_EXT_foo would be incorrectly matched
if EGL_EXT_foobar would be available but not foo.

This doesn't matter for the currently checked extensions but will matter
for EGL_EXT_image_dma_buf_import_modifiers vs
EGL_EXT_image_dma_buf_import

Code borrowed from weston
2018-02-28 20:03:06 +01:00
Guido Günther 2dc8a35db2 textures: tell us which texture format is unsupported 2018-02-28 18:36:32 +01:00
Guido Günther d928ddc36c wlr_egl_create_image: return NULL when function is missing
This matches the return value of elgCreateImage in case of error.
2018-02-28 08:44:00 +01:00
Guido Günther d08792bfff Add alpha to wlr_render_with_matrix
so we can use the alpha channel to e.g. blend in textures
2018-02-25 13:47:48 +01:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
Guido Günther 4d496802dd Log GL and EGL vendor
useful for debugging
2018-02-15 10:40:19 +01:00