Commit Graph

248 Commits

Author SHA1 Message Date
Roman Gilg 3531007b75 render/pixman: add wlr_pixman_renderer_get_buffer_image()
This is similar to wlr_pixman_texture_get_image and can be useful for
compositors to access the rendering data.
2023-12-11 19:47:55 +01:00
Simon Ser 1f64f3925c render/gles2: add wlr_gles2_renderer_get_buffer_fbo()
Replacement for wlr_gles2_renderer_get_current_fbo(). Wayfire uses
it for instance.
2023-12-05 18:57:43 +01:00
Alexander Orzechowski 6e03d3015e swapchain: Add wlr_swapchain_has_buffer 2023-12-03 05:29:05 +00:00
Alexander Orzechowski d3a339a03e renderer: Drop buffer binding 2023-11-30 20:11:50 -05:00
Alexander Orzechowski 3ed1268f64 render: Nuke old read pixels API
Sadly, the new API is not backwards compatible with the old API. Since
we have already switched all users in wlroots to the new API compositors
are already practically mandated to implement the new API. Let's get rid
of the old one since there is no point.
2023-11-30 20:01:12 -05:00
Alexander Orzechowski 57b18d26d0 wlr_texture: Introduce wlr_texture_preferred_read_format 2023-11-30 19:56:54 -05:00
Alexander Orzechowski e85e8bc324 wlr_texture: Introduce wlr_texture_read_pixels_options helpers 2023-11-30 19:55:51 -05:00
Alexander Orzechowski 4c6caa7c48 wlr_texture: Introduce wlr_texture_read_pixels 2023-11-30 19:55:12 -05:00
Simon Ser e8b187cc92 render/gles2: save/restore context when creating/submitting a render pass
This is useful for e.g. lazily blitting a texture for readback
purposes while rendering.
2023-11-30 17:47:11 +01:00
Simon Ser 1208ba6c28 render/gles2: document EGL context gotchas 2023-11-30 17:46:50 +01:00
Alexander Orzechowski d7ecdad4e0 render: Drop rendering_with_buffer
This is always true now that we can only render with a buffer.
2023-11-29 16:00:24 -05:00
Alexander Orzechowski 3faf9883dc renderer: Drop wlr_renderer_begin 2023-11-29 15:13:24 -05:00
Simon Ser 41494244df render: drop legacy rendering API 2023-11-22 11:43:05 +01:00
Simon Ser e58c7bb792 render/drm_format_set: use published kernel doc URL
The kernel patch has been merged, so this is available in the
official docs now.
2023-10-05 21:29:25 +00:00
Alexander Orzechowski 5299d973d5 render/pass: Introduce wlr_render_rect_options_get_box 2023-09-21 02:25:34 -04:00
Manuel Stoeckl a94168b5fe render: ensure wlr_render_rect_options->box is nonempty
This optimization also fixes an validation error with the Vulkan
renderer by ensuring vkCmdClearAttachments does not receive empty
regions.
2023-08-23 18:28:58 +00:00
Simon Ser d3d3e19ffd render: split render pass API into separate header
Keeps the main wlr_renderer.h a tad more tidy.
2023-08-16 19:20:12 +02:00
Simon Ser 4811d9fb18 render: document wlr_buffer_pass_options.timer 2023-07-11 18:19:03 +00:00
Simon Ser b7dca21c2b render: constify struct wlr_buffer_pass_options
Let's not allow renderer implementations to mutate the passed in
options.
2023-07-11 18:19:03 +00:00
Alexander Orzechowski 2044cc2311 render: Introduce wlr_render_texture_options.blend_mode 2023-06-19 13:16:34 -04:00
Alexander Orzechowski 6bd44c4fcd renderer: Introduce wlr_scale_filter_mode 2023-06-19 12:25:38 -04:00
Rose Hudson 45ca284eee render/gles2: implement timer API 2023-06-05 19:50:07 +00:00
Rose Hudson 9e8947e4d5 add render timer API
Based on five calls:
wlr_render_timer_create - creates a timer which can be reused across
  frames on the same renderer
wlr_renderer_begin_buffer_pass - now takes a timer so that backends can
  record when the rendering starts and finishes
wlr_render_timer_get_time - should be called as late as possible so that
  queries can make their way back from the GPU
wlr_render_timer_destroy - self-explanatory

The timer is exposed as an opaque `struct wlr_render_timer` so that
backends can store whatever they want in there.
2023-06-05 19:50:07 +00:00
Alexander Orzechowski 300bd80772 wlr_drm_format_set: Store formats on array 2023-05-11 18:25:52 +02:00
Alexander Orzechowski 340700cb70 wlr_drm_format: Change wlr_drm_format_dup to copy 2023-05-11 18:24:43 +02:00
Alexander Orzechowski e6879616e7 wlr_drm_format: Make structure constant length
Don't store modifiers as part of the struct.
2023-05-11 03:51:01 -04:00
Alexander Orzechowski 84d07e7119 wlr_drm_format_set: Remove redundant text in comment for finish function
This is implied by the fact that this function finishes the state instead
of destroying it.
2023-05-11 03:51:01 -04:00
Alexander Orzechowski b45396c790 wlr_drm_format: Introduce drm_format_finish 2023-05-11 03:51:01 -04:00
Alexander Orzechowski 5adb1be3a7 drm_format_set_intersect: Require initialized dst and remove assert
The usages in linux_dmabuf zero out the dst before passing it so this
change should be fine.
2023-05-04 18:19:33 +00:00
Alexander Orzechowski 1ee75786b4 drm_format_set_union: Require initialized dst and remove assert 2023-05-04 18:19:33 +00:00
Alexander Orzechowski 2dd9549085 drm_format_set: Mark as unstable
This is supposed to be an unstable interface and it was a mistake that
this header was not included.
2023-05-03 19:08:14 +02:00
Austin Shafer ec37d55a5e Add union function for format sets 2023-05-03 12:06:48 -04:00
Simon Ser a93fc8afd6 render: introduce blend mode
Allow callers to pick the blend mode when rendering a rect. The
"none" mode can be used to disable blending and clear rects.
2023-05-02 21:32:51 +02:00
Simon Ser 4a1ad32534 render: add render pass helpers 2023-04-25 17:25:10 +02:00
Simon Ser 756dedae20 Add a new renderer API
Goals:

- Extensibility: we need to be able to add new params to the calls
  to render a texture/rect. For instance we'll need to add fences to
  the render texture operation for explicit sync purposes.
- No implicit state: no more bind_buffer, begin, end.
- No matrices: these hurt Pixman and we don't need them.
- Clip regions for optimized damage repainting.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3188
2023-04-25 17:25:10 +02:00
Simon Ser b33ab26fe7 render/swapchain: make public
We've had this struct for a while. It'd be useful for compositors
if they want to manage the swap chains themselves instead of being
forced to use wlr_output's. Some compositors might also want to use
a swapchain without an output.
2023-02-21 17:14:31 +01:00
Alexander Orzechowski db0e962368 wlr_texture: Expose owning renderer 2022-12-01 04:41:43 -05:00
Simon Ser 0fa5743c26 render/gles2, render/pixman: stop pulling <wlr/backend.h>
No reason why the GLES2/Pixman renderers should depend on the
backend.
2022-11-24 21:50:28 +00:00
Simon Ser 99134c26b8 render: stop pulling <wlr/backend.h>
Let's just forward-declare struct wlr_backend instead.

We need to fixup the Vulkan renderer: it needs makedev(), which
got included by chance via <wlr/backend.h> → <wlr/backend/session.h>
→ <libudev.h>.
2022-11-24 21:50:28 +00:00
Simon Ser 31ea61b390 render: add wlr_renderer.events.lost 2022-11-15 15:50:19 +00:00
Simon Ser a541c9510a render: make wlr_renderer_begin return a bool 2022-11-15 15:50:19 +00:00
Simon Ser 23540b5579 render: allow wlr_renderer_impl.begin to fail
Make it return a bool to indicate success/failure. Adapt the
various implementations to check errors.
2022-11-15 15:50:19 +00:00
Simon Ser 4a70172e26 render: make some wlr_renderer fields private 2022-11-15 15:50:19 +00:00
Simon Ser 5451cbd183 render: add docs for wlr_renderer 2022-11-15 15:50:19 +00:00
zccrs 5b34fe5513 render/vulkan: add wlr_vk_texture_has_alpha
Allow to get whether has alpha channel of the VkImage, it can help an
optimization to disable blending when the texture doesn't have alpha.
Because the VkFormat isn't enough because it's always set to
VK_FORMAT_B8G8R8A8_SRGB or VK_FORMAT_R8G8B8A8_SRGB.
2022-11-15 10:58:45 +08:00
Simon Ser 6baf045590 render/texture: constify wlr_texture_update_from_buffer() 2022-11-11 23:11:17 +00:00
zccrs 270914d379 render/vulkan: add some interfaces to allow compositors to integrate
Added wlr_vk_renderer_get_* functions to allow get the VkInstance,
VkPhysicalDevice, VkDevice, queue family of a wlr_vk_renderer.

Added wlr_vk_renderer_get_current_image_attribs function to allow get
the VkImage of current renderer buffer to use on compositors.

Added wlr_renderer_is_vk function, it's like the wlr_renderer_is_gles2,
returns true if the wlr_renderer is a wlr_vk_renderer.

Added wlr_vk_image_get_attribs function to get a VkImage and it's
extras information (e.g. a VkImageLayout and VkImageFormat of the
VkImage) from a wlr_texture.
2022-11-08 12:56:38 +01:00
Simon Ser 6832ae14aa render: drop wlr_renderer_read_pixels() flags
These are unused.
2022-10-04 09:15:19 +02:00
Simon Ser 98cf38601f render: replace wlr_texture_write_pixels with update_from_buffer
This lets the renderer handle the wlr_buffer directly, just like it
does in texture_from_buffer. This also allows the renderer to batch
the rectangle updates, and update more than the damage region if
desirable (e.g. too many rects), so can be more efficient.
2022-08-12 08:41:32 +00:00
Simon Ser 29291cb47c render/texture: drop wlr_texture_is_opaque
Whether a texture is opaque or not doesn't depend on the renderer
at all, it just depends on the source buffer. Instead of forcing
all renderers to implement wlr_texture_impl.is_opaque, let's move
this in common code and use the wlr_buffer format to know whether
a texture will be opaque.
2022-06-16 14:43:24 +02:00