aboutsummaryrefslogtreecommitdiff
path: root/include/render/gles2.h
AgeCommit message (Collapse)Author
2021-05-30render/gles2: fix texture cleanup on destroySimon Ser
When importing a DMA-BUF wlr_buffer as a wlr_texture, the GLES2 renderer caches the result, in case the buffer is used for texturing again in the future. When the wlr_texture is destroyed by the caller, the wlr_buffer is unref'ed, but the wlr_gles2_texture is kept around. This is fine because wlr_gles2_texture listens for wlr_buffer's destroy event to avoid any use-after-free. However, with this logic wlr_texture_destroy doesn't "really" destroy the wlr_gles2_texture. It just decrements the wlr_buffer ref'count. Each wlr_texture_destroy call must have a matching prior wlr_texture_create_from_buffer call or the ref'counting will go south. Wehn destroying the renderer, we don't want to decrement any wlr_buffer ref'count. Instead, we want to go through any cached wlr_gles2_texture and destroy our GL state. So instead of calling wlr_texture_destroy, we need to call our internal gles2_texture_destroy function. Closes: https://github.com/swaywm/wlroots/issues/2941
2021-05-17render/gles2: implement texture_from_bufferSimon Ser
Make it so wlr_gles2_texture is ref'counted (via wlr_buffer). This is similar to wlr_gles2_buffer or wlr_drm_fb work. When creating a wlr_texture from a wlr_buffer, first check if we already have a texture for the buffer. If so, increase the wlr_buffer ref'count and make sure any changes made by an external process are made visible (by invalidating the texture). When destroying a wlr_texture created from a wlr_buffer, decrease the ref'count, but keep the wlr_texture around in case the caller uses it again. When the wlr_buffer is destroyed, cleanup the wlr_texture.
2021-04-22render/gles2: destroy textures on renderer teardownSimon Ser
2021-04-08render: drop support for ellipsesSimon Ser
For anything more complicated than quads, compositors can easily ship their own shaders. Closes: https://github.com/swaywm/wlroots/issues/2759
2021-03-25render/gles2: remove depth and bpp gles2_pixel_format, use drm pixel formatSimon Zeni
2021-03-10output: improve transform matrix calculationSimon Zeni
Compute only the transform matrix in the output. The projection matrix will be calculated inside the gles2 renderer when we start rendering. The goal is to help the pixman rendering process.
2021-02-23render: use DRM formats in wlr_texture_from_pixelsSimon Ser
2021-02-23render: use DRM formats in wlr_renderer_get_shm_texture_formatsSimon Ser
2021-02-23render/gles2: replace wlr_gles2_texture.wl_format with drm_formatSimon Ser
2021-02-23render/gles2: convert format table to DRM formatsSimon Ser
2020-11-15render: introduce wlr_renderer_get_drm_fdSimon Ser
2020-11-15render/gles2: implement wlr_renderer_bind_bufferSimon Ser
2020-07-28render/gles2: remove gles2_procsSimon Ser
Move the global into wlr_gles2_renderer. This removes global state and allows us to have multiple renderers with different GL loaders.
2020-07-28render/gles2: make push/pop debug functions take a wlr_rendererSimon Ser
2020-07-28render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_textureSimon Ser
2020-07-28render/gles2: make wlr_gles2_texture_from_* privateSimon Ser
These functions are unused by compositors (see e.g. [1]) and prevent wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an issue for proper teardown [2] and for accessing GLES2 extensions. [1]: https://github.com/swaywm/wlroots/pull/1962#issuecomment-569511830 [2]: https://github.com/swaywm/wlroots/pull/1962
2020-06-24render/gles2: use glGetAttribLocation instead of hardcoded indicesSimon Zeni
2020-06-08render: Add wlr_renderer_blit_dmabuf()Andri Yngvason
2020-04-28render/texture: add width and height fieldsSimon Ser
Instead of requiring compositors to call wlr_texture_get_size each time they want to access the texture's size, expose this information as wlr_texture fields.
2020-04-22render/gles2: add wlr_gles2_renderer_check_extSimon Ser
2019-12-20Refactor EGL/GL API loadingSimon Ser
Remove glapi.sh code generation, replace it with hand-written loading code that checks extension strings before calling eglGetProcAddress. The GLES2 renderer still uses global state because of: - {PUSH,POP}_GLES2_DEBUG macros - wlr_gles2_texture_from_* taking a wlr_egl instead of the renderer
2019-11-06render/gles: Simplify textures a bitScott Anderson
We don't need our own enum for types. Instead we just use GL_TEXTURE_{2D,EXTERNAL_OES}, which already describes usage. Also fixes a situation where we were using GL_TEXTURE_2D in a situation we should not have. wl_drm buffers are always GL_TEXTURE_EXTERNAL_OES, no matter if they're RGB or any other format.
2019-07-17Use -fmacro-prefix-map to strip build pathManuel Stoeckl
This commit matches sway's 2dc4978d8af326c310057ca8fd22a4c7f5d09335. To help ensure a reproducible build (when debug info is disabled), the meson build script now uses the -fmacro-prefix-map command line argument supported by GCC to strip the build-path dependent bytes of each __FILE__ string used by wlr_log and related functions. A rather ugly algorithm is used to compute the relative path between the build and source folders, because meson has no specific function for this. When the compiler does not support -fmacro-prefix-map, fall back to shifting the start of each __FILE__ string by the length of the relative path to the source directory.
2019-04-22Fix missing headers when building without X11Alyssa Ross
The deleted includes are redundant, because other headers will include the necessary files. Additionally, they cause build failures, because including EGL/egl.h or EGL/eglext.h directly, instead of through wlr/render/egl.h or wlr/render/interface.h, will mean that MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL headers will attempt to pull in unnecessary X11 headers that may not exist on the system. For the headers produced by glgen.sh, the includes couldn't simply be deleted, because no other header would include the EGL headers. Neither wlr/render/egl.h or wlr/render/interface.h felt appropriate to include, so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before the EGL includes.
2019-02-28Remove glEGLImageTargetTexture2DOESGuido Günther
It's declared via render/glapi.txt.
2018-11-04render/gles2: check for GL_OES_EGL_image_externalemersion
2018-11-04render/gles2: remove assumptions about supported formatsemersion
We were assuming GL_BGRA_EXT was always supported. We now check that it's supported for rendering. We fail if it isn't because this format is specified as "always supported" by the Wayland protocol. We also check if it's supported for reading pixels. A new preferred_read_format function returns the preferred format that can be used to read pixels. This is used by the screencopy protocol.
2018-10-16Use enum wl_shm_format for gles2 texture formatsnyorain
Also rephrase the write_pixels comment.
2018-10-15Remove fmt parameter from wlr_texture_write_pixelsnyorain
It's not allowed to change the format of a texture so remove the confusing parameter.
2018-08-03gles2: change context when it is not currentMariusz Bialonczyk
Texture functions, that create and manipulate textures should switch the current context if necessary. thanks to: @emersion Fixes #934
2018-07-09util: add wlr_ prefix to log symbolsemersion
2018-06-13gles2 renderer: introduce struct wlr_gles2_tex_shaderNeKit
2018-06-07Fix GLES2 renderer to use glGetUniformLocations locationsNeKit
This is needed as uniform locations are driver implementation-specific.
2018-04-25Make sure we don't use others' prefixesemersion
2018-04-12Make wlr_renderer_scissor take normal coords instead of upside-down onesemersion
2018-04-01Untie wlr_gles2_renderer and wlr_gles2_textureemersion
2018-03-28Merge pull request #744 from emersion/texture-redesignTony Crisci
Redesign wlr_texture
2018-03-27render: remove GL calls from wlr_eglemersion
2018-03-24Redesign wlr_textureemersion
- 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-21render/gles2: move list of supported WL formats to pixel_format.cemersion
2018-03-20render/gles2: remove global state, use OpenGL debug extensionemersion
2018-03-20gles2: allow to specify texture target typeGuido Günther
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-19render: split render.h into wlr_renderer.h and wlr_texture.hemersion
2018-02-21Rename _strip_path to wlr_strip_pathGuido Günther
since it's a public function
2018-02-12Reformat all #include directivesemersion
2017-10-22Move egl.h to render/egl.hScott Anderson
2017-09-23Use more consistent include guard namesemersion
2017-08-19wlr renderer/texture: rename init to create when it does allocDominique Martinet
2017-08-14Refactor away wlr_renderer_stateDrew DeVault
2017-08-14Refactor out wlr_texture_stateDrew DeVault