Commit Graph

224 Commits

Author SHA1 Message Date
emersion e4933ab445
Introduce wlr_buffer 2018-06-08 20:06:13 +01:00
Dominique Martinet c6821f3dd3 wlr_surface: insert subsurfaces in revert order
sibling surfaces were drawn in incorrect order (e.g. latest below).
This attempts to fix that by reverting the order of the list.
2018-06-05 21:02:42 +09:00
Dominique Martinet cf9b8c0a8c wlr_surface_get_root_surface: walk up parent
This would dead-loop and never walk up if called on a subsurface
2018-06-05 00:17:58 +09:00
Markus Ongyerth 7b07b3f95d Fix type in wlr_surface_get_extends 2018-06-01 16:36:04 +02:00
Markus Ongyerth 3994762ae0 Add wlr_surface_get_geometry
This function defaults and clips the xdg-surface geometry to the
bounding box of the surface + its subsurfaces, as specified by the
protocol spec.
2018-06-01 15:21:18 +02: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 28020ff577
Only allow one modifier per DMA-BUF, split attributes struct in render/ 2018-05-30 09:29:12 +01:00
emersion da504f9253
surface: remove wl_resource_post_event 2018-05-26 19:43:55 +01:00
emersion 6d569def6d
compositor, surface: correctly destroy resources 2018-05-03 18:45:30 +01:00
emersion 43012f3740
compositor: redesign how resources are managed
All public resource creators now take a new ID for the resource
and an optional list where the resource link is added. When the
resource is destroyed it is its own responsibility to remove
itself from the list. This removes the need for the caller to add
a destroy listener.

This commit fixes a few segfaults with resources not removed from
the list when destroyed.
2018-04-26 17:51:06 +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 d47713ac0f
compositor: destroy subsurface resources with wlr_subcompositor 2018-04-25 23:53:44 +01:00
emersion 625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion b0d99f5c67
Remove wlr_ prefix from local symbols 2018-04-25 23:00:46 +01:00
emersion fa84b267e0
Remove wlr_surface::subsurface 2018-04-21 18:40:25 +01:00
emersion 4a9a9eae9a
Add surface iterators 2018-04-05 14:18:17 -04:00
emersion 1a8b24bdd2
rootston: fix view_at 2018-04-04 17:16:35 -04:00
emersion d16127b3cb
Fix wlr_surface_subsurface_at, change it to be wlr_surface_surface_at 2018-04-04 16:48:23 -04:00
Drew DeVault e19ee6d469 Add wlr_surface_point_accepts_input
Ref https://github.com/swaywm/sway/pull/1674
2018-03-30 23:02:11 -04:00
emersion 6bbf507082
surface: fix texture not updated on commit
When a client attaches a wl_drm or a linux_dmabuf buffer, we only
update it if the size is different from the one of the old buffer.
This means that if the client attaches a new, updated buffer with
the same size as the old buffer, the texture won't get updated.

This commit changes this behavior and re-creates the texture if
the client attaches a new buffer, without requiring the size to be
different.
2018-03-29 19:44:57 -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 805039457a wlr_surface: fix indentation 2018-03-23 08:59:48 +01:00
emersion 1914a1aa2b
surface: drop wlr_surface_get_matrix 2018-03-15 18:35:22 +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
emersion de0e40d621
Merge pull request #698 from agx/linux-dmabuf
Add initial linux_dmabuf protocol support
2018-03-15 12:45:07 +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
emersion 90148e64ab
Fix clients binding multiple times to the same output 2018-03-01 10:19:48 +01:00
emersion f0404f6d75
surface: don't reset frame_callback_list on resize 2018-02-22 22:40:02 +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
emersion 392d54a35d
Wrap wl_resource_get_user_data into safer helper functions
This ensures we're not incorrectly casting a resource.

Fixes #628
2018-02-13 23:48:46 +01:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion e049610b47
surface: copy buffer damage to surface damage 2018-01-28 21:29:51 +01:00
emersion 861d5bdff2
surface: fix damage when resizing a surface in QT apps 2018-01-27 21:49:40 +01:00
emersion ece2c1e4e2
Damage tracking for transformed outputs 2018-01-26 22:11:09 +01:00
emersion a8cb02f585
surface: add damage when subsurface moves 2018-01-22 10:34:23 +01:00
emersion 59c53e8333
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-21 22:18:06 +01:00
Johannes Schramm dcc743047b style: include brackets for if/while/for, even if it's a single statement 2018-01-21 16:28:21 +01:00
emersion eeffe11337
surface: add wlr_surface new_subsurface and wlr_subsurface destroy events 2018-01-21 14:22:33 +01:00
emersion ddafcb86a2
surface: add resize damage 2018-01-20 00:52:43 +01:00
emersion 59ba8f35ed
rootston: use surface damage 2018-01-18 21:34:10 +01:00
Tony Crisci 5a18f62fee add role-committed hook 2017-12-27 06:06:29 -05:00
emersion 54f1135c05
Fix fullscreen in xdg-shell 2017-11-20 20:53:13 +01:00
Drew DeVault 86b8729998 Merge remote-tracking branch 'origin/master' into hidpi 2017-11-02 23:34:02 -04:00
emersion f8de7aa0fd
Add checks for wl_resource_create 2017-11-02 23:14:24 +01:00
Drew DeVault c8f97a3a2c Use surface matrix for software cursors
A similar change should probably be applied to hardware cursors, though
more complicated. Also, this doesn't actually fix the issue where the
cursor is too small when over a scale=2 surface. Apparently they don't
set their cursor scales to 2. Seems like a client bug? idk
2017-11-01 08:51:59 -04:00
Drew DeVault a6930cd8ea Handle output enter/leave correctly 2017-11-01 08:51:59 -04:00
Drew DeVault a7446792a1 Consider scale factor when rendering views 2017-11-01 08:44:07 -04:00
emersion 816d6890ee
Fix remaining unchecked allocs in types and code style 2017-10-31 11:58:39 +01:00
Drew DeVault bbf08f3ef9 Merge pull request #262 from acrisci/feature/data-device-selection
wlr-data-device
2017-10-24 08:22:13 -04:00
Tony Crisci 1dbe314937 Merge branch 'master' into feature/data-device-selection 2017-10-24 07:57:36 -04:00
Tony Crisci 6e7caaee6b Revert "wlr-surface: destroy texture on null buffer commit"
This reverts commit 0e7d13fab7.
2017-10-23 09:09:12 -04:00
Tony Crisci 0e7d13fab7 wlr-surface: destroy texture on null buffer commit 2017-10-22 21:07:54 -04:00
Tony Crisci d1dd0a6970 refactor buffer detection 2017-10-22 21:07:32 -04:00
Scott Anderson 9b984253e2 Move egl.h to render/egl.h 2017-10-22 10:36:07 +13:00
Tony Crisci df0a8d3abe wlr-data-device: drag icons 2017-10-15 11:06:03 -04:00
Drew DeVault fbddc81b59 Merge pull request #254 from versusvoid/fix-frame-callback-double-free
Destroy callbacks before callback list reinitialization
2017-10-10 08:37:19 -04:00
Versus Void d3af2c09c2 Destroy callbacks before callback list reinitialization 2017-10-10 13:16:56 +03:00
Versus Void a6db47196c Upload texture on surface commit 2017-10-10 11:18:38 +03:00
Drew DeVault c39bfe7f84 Merge pull request #206 from emersion/client-cursor
Client provided cursors
2017-10-09 17:56:05 -04:00
Drew DeVault 1c3c2ff90a Merge pull request #250 from acrisci/feature/surface-finder-to-wlr
move surface finder functions to wlroots
2017-10-09 17:28:27 -04:00
Tony Crisci 100b39c608 bug: null buffer commit detection 2017-10-09 17:19:17 -04:00
Tony Crisci 654e2ccd6b move surface finder functions to wlroots 2017-10-09 16:51:55 -04:00
emersion c4c948c5d9
Use attach x,y when computing hotspot, set sx,sy in surface_attach 2017-10-09 00:08:54 +02:00
Tony Crisci 761b35339e bug: handle commit empty buffer 2017-10-08 17:03:27 -04:00
emersion 7b6d785f52
Rename wlr_surface->signals to events 2017-10-08 19:12:28 +02:00
Tony Crisci db15ab77b4 use input bounds for pointer events 2017-10-08 12:33:39 -04:00
Versus Void 606311c755 Reset buffer resource pointer on destroy signal 2017-10-03 19:57:54 +00:00
Tony Crisci 8b7ae61ad4 subsurface handle parent destroy 2017-09-30 13:24:59 -04:00
Tony Crisci 19e30aab9b subcompositor protocol errors 2017-09-30 08:55:40 -04:00
Tony Crisci 93f79378f7 subsurface stacking requests 2017-09-30 08:55:40 -04:00
Tony Crisci 3a04f5b2db consistently name surface state variables 2017-09-30 08:55:40 -04:00
Tony Crisci 693e30dff7 refactor surface commit 2017-09-30 08:55:40 -04:00
Tony Crisci 86bc4840a0 subsurface commit and render 2017-09-30 08:55:40 -04:00
Tony Crisci 5cbb4f5ca0 refactor surface commit 2017-09-30 08:55:40 -04:00
Tony Crisci cb2d05e83b subsurface sync and position 2017-09-30 08:55:40 -04:00
Tony Crisci 7f39578824 cleanup wlr_surface.[ch] 2017-09-30 08:55:40 -04:00
Tony Crisci 68eeebc647 subsurface implementation stubs 2017-09-30 08:55:40 -04:00
Tony Crisci b2c71287f2 set toplevel role on wlr_surface 2017-09-13 07:57:14 -04:00
Tony Crisci 74e9578889 add surface destroy signal 2017-09-11 13:01:53 -04:00
Dominique Martinet ea906ea3e2 wlr surface/shell types: add message on creation
Not sure if we really want to keep that, would be helpful to get more
logging levels at some point
2017-08-23 22:03:49 +02:00
Dominique Martinet 84c0c87a5d wlr_surface: change update_size/damage to bool 2017-08-19 14:37:57 +02:00
Dominique Martinet 4da976bfad wlr_surface: small refactoring
- split surface damage and buffer damage
 - the pending buffers are always valid, so can be 'fini'shed
 - consider opaque buffer and input buffer in commit, just to free
 - only update size if scale/transform/buffer changed
2017-08-19 09:31:06 +02:00
Dominique Martinet 03b29eb32c wlr region/surface: explicitely select interface fields 2017-08-19 09:31:06 +02:00
Dominique Martinet fc1a851415 wlr_surface: clear/fini buffers when appropriate 2017-08-19 09:31:06 +02:00
Dominique Martinet f24b3df980 wlr renderer/texture: rename init to create when it does alloc 2017-08-19 08:33:31 +02:00
Dominique Martinet bb3b9d0156 wlr_surface: use post_event instead of queue
This fixes not sending anything back to the client if the only event
it's waiting for is a buffer release, and nothing else is in the pipe.

Workaround for #102 - there probably is a better solution as weston and
wlc do not need to use post_event here.
2017-08-18 19:38:11 +02:00
Tony Crisci c6631e2140 Fix wild pointer to buffer
After the buffer is released from the release event, it should no longer be
accessed.

Fixes a GTK crash.
2017-08-18 12:41:42 -04:00
nyorain 10eee58d2d Fix surface buffer uploading 2017-08-17 17:50:09 +02:00
Drew DeVault 27c13d621d Merge pull request #88 from 4e554c4c/alloc_crashing
Prevent alloc errors from crashing
2017-08-15 12:21:58 -04:00
Drew DeVault f60b53c6e3 Change how surface matricies are calculated 2017-08-15 08:52:30 -04:00
Tony Crisci d5f98dbf61 refactor getting surface size into a function 2017-08-15 08:22:22 -04:00
Tony Crisci 2bf2dbb2bd formatting fixup 2017-08-15 07:41:25 -04:00
Tony Crisci 5b1ce84350 implement buffer transform 2017-08-15 07:36:51 -04:00
Tony Crisci 84c6dbd58d remove unused dimension from buffer calculations 2017-08-15 07:36:51 -04:00
Tony Crisci e46ec57b43 implement surface sizing 2017-08-15 07:36:51 -04:00
Tony Crisci b49650b555 initialize buffer damage before conversion 2017-08-15 07:36:50 -04:00
Tony Crisci d87c58416b clip surface damage to surface size 2017-08-15 07:36:50 -04:00
Tony Crisci 72a33b736f implement texture get buffer size 2017-08-15 07:36:50 -04:00
Tony Crisci f0f190bfa5 implement buffer scale
Keep track of the scale of the buffer set by surface.set_buffer_scale.

Calculate the height and width of the texture from the buffer depending on the
scale when it is attached.

Use buffer damage to determine the damage of the buffer when flushing damage.

Convert surface damage to buffer damage and union to the surface buffer_damage
prior to flushing damage.
2017-08-15 07:36:50 -04:00
Tony Crisci e22e443717 fix formatting in surface_damage 2017-08-15 07:36:50 -04:00
Tony Crisci 0b3d56384f implement surface_damage_buffer 2017-08-15 07:36:17 -04:00
Calvin Lee 5cc7342606 Prevent alloc errors from crashing
Resolves #76
2017-08-15 08:04:57 +02:00
nyorain f998bb8299 Fix style issues 2017-08-14 17:09:56 +02:00
Drew DeVault c24351681f Refactor EGL handling 2017-08-10 22:15:37 -04:00
Drew DeVault 7095274a9e Merge branch 'master' into drm_buffer 2017-08-10 13:19:39 -04:00
Tony Crisci 73adb49f15 release buffer on surface flush when no damage 2017-08-10 11:12:33 -04:00
Drew DeVault 888986b038 Remove excess logging 2017-08-10 08:36:45 -04:00
Drew DeVault 7da43ff8b0 Implement wlr_surface_flush_damage 2017-08-10 08:26:16 -04:00
nyorain 31d78ff497 Fix wlr_surface destruction bug 2017-08-10 12:42:35 +02:00
nyorain 67369173aa Implement drm (egl) buffer attaching 2017-08-10 10:59:58 +02:00
Drew DeVault 750d0ad458 Flesh out wlr_surface state lifecycle a bit
Sprinked some TODOs around for future work
2017-08-09 23:34:50 -04:00
Drew DeVault 4de930542f Implement partial texture uploads 2017-08-09 22:17:40 -04:00
Drew DeVault 4dfc6460f3 Style fixes 2017-08-09 17:52:02 -04:00
Tony Crisci 8306f46dfb implement surface frame
The surface frame callback lets a window know when it is a good time to show the
next frame if it is animating. In particular, this callback is used by
weston-simple-shm to throttle drawing.
2017-08-09 17:31:38 -04:00
Tony Crisci 87fe13a9fa release shm buffer after uploading 2017-08-09 17:31:38 -04:00
nyorain fb58307a50 Fix surface destruction 2017-08-09 17:27:12 +02:00
nyorain cf9ee6ce3f Move wlr_surface into wlr 2017-08-09 17:27:12 +02:00
Renamed from examples/compositor/wlr_surface.c (Browse further)