Commit Graph

31 Commits

Author SHA1 Message Date
Yuxuan Shui 599e8b6600
gl_common: update gl_fill to core profile
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:27 +01:00
Yuxuan Shui 233edbd1c3
gl_common: fix implicit conversion warnings
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui 7c2edd9d63
gl_common: remove some fixed function glEnable/Disable
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui d64aab7d40
gl_common: add vertex shader
Also use an attribute for the texture coordinates.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui 0733f7540f
Silence unused variable warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui 0037b7e5fb
Eliminate implicit conversions
Use explicit conversions everywhere. Adding bounds check assertions when
necessary.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:25 +01:00
Yuxuan Shui ad3ec8cada
gl_common: initialize string marker logger
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:24 +01:00
Yuxuan Shui cabd0b0801
new glx: always use GL_TEXTURE_2D
Rectangle textures was used as a fallback when the driver doesn't
support non-power-of-two (NPOT) textures. Since we are using OpenGL 3.0 now,
which includes support for NPOT textures, we don't need this fallback
anymore.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 20:42:52 +00:00
Yuxuan Shui e1c5e7ab8d
gl_common: fix gl error when blur is not enabled
blur_textures are not initialized when blur is disabled, but we still
try to resize them in gl_resize.

Don't do that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 20:04:11 +00:00
Yuxuan Shui e40f16c60e
new glx: fix leak of X pixmaps
release_image should release the X pixmap when it's owned by the
backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 20:00:56 +00:00
Yuxuan Shui 5f22b4b31c
new glx: implement dim
Also removed a bunch of unused functions and macros. Fixed a memory leak
of gl_texture::refcount.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 02:25:41 +00:00
Yuxuan Shui a72fb0c755
new glx: handle blur with opacity
Now blur can fade out smoothly

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 02:04:14 +00:00
Yuxuan Shui 34254ff86e
new glx: implement fill for monitor-repaint
Refine the API of fill_rectangle and rename it to fill.

Extras:

Keep GL_BLEND enabled; Fixed some texture/fbo leaks

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 01:53:46 +00:00
Yuxuan Shui 48338a9903
new glx: implement blur
This is barely tested, so bugs and/or performance problems to be
expected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 01:22:38 +00:00
Yuxuan Shui c5d9f459dd
backend interface: add IMAGE_OP_RESIZE_TILE
We need this to paint the wallpaper with repeat to mimic the behavior of Xorg's
background pixmap.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 18:01:18 +00:00
Yuxuan Shui c67eb62ce8
gl_common: texture should repeat
To match xrender's behavior.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 15:08:21 +00:00
Yuxuan Shui 0a2dd8aa72
gl_common: implement image_op
Implement image processing in gl_compose using a frag shader.
gl_image_op is used to set flags corresponds to what processing is
needed for a texture.

Also implement proper reference counting for textures.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 14:12:53 +00:00
Yuxuan Shui 60c10790d7
new glx: initial implementation
This is basically just adapting old code to the new interface. A lot
of the functions are still stubs, but the basic stuffs is working.

What remains to be done:

* Implement gl_image_op. (It should do the operation lazily, only update
the flags on the texture. Actual processing will be delayed until composition.)

* Implement gl_copy. Now it just return the same image after incrementing the
refcount. It should actually copy the image data structure so it can have a
separate set of flags.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 01:39:18 +00:00
Yuxuan Shui 2e2e8e3ce0
Use struct conv for blur kernel as well
Instead of storing them as an array of xfixed.

Might cause some performance overhead for the new backend, because
it is allocating a buffer to do the conversion every frame. Will fix
later.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:39:43 +00:00
Yuxuan Shui b1d8687b31
Add copyright notice to backend/**
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:47:36 +00:00
Yuxuan Shui 8371d6a0b7
Replace glDrawBuffers with glDrawBuffers
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 19:30:07 +00:00
Yuxuan Shui 4e14eec2ba
Remove a redundant glEnd in glx_dim_dst
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-29 22:27:05 +00:00
Yuxuan Shui 3b21365e94
gl_common: fix rendering
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-28 00:48:26 +00:00
Yuxuan Shui 6e454adff1
glx (new backend): Add some missing functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-28 00:04:01 +00:00
Yuxuan Shui 8c71f3fcbe
Move some macros around
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 23:57:43 +00:00
Yuxuan Shui 061dd8e52e
Reuse some code from the new gl backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 18:16:28 +00:00
Yuxuan Shui f649a949e2
Even more includes
Expand the modulemap to cover some of the system headers too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 22:09:22 +00:00
Yuxuan Shui 916e23861a
Improve the header includes, cont'd
Also check in the modulemap file, and add a option to build with clang's
-fmodules.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 17:10:06 +00:00
Yuxuan Shui a2022661e6
Move glx_init_blur to gl_common.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-31 07:18:38 +00:00
Yuxuan Shui 61f55f69a6
Add backend/gl/glx.c to build
Still a long way to go for the glx backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-31 01:32:31 +00:00
Yuxuan Shui 0c4b690b2b
First step of split backend into modules
This commit introduced a new, modular backend interface. The interface
is not very good, since I don't think I fully understand all the
requirements writing a backend have. But this is a good first step.

This commit also includes an initial xrender backend written using the
new interface, and some opengl backend related helper functions, which
are taken from the old opengl backend.

However, there is not integration with the core compton yet. compton
will still use the old backend code. This commit is here so we can get
the automated build test.

What is implemented in the new xrender backend:

* Windows with transparency
* Shadow
* Opacity
* Wallpaper (getting the root pixmap)
* Blur

Known problem with the xrender backend:

* It is slower

Things that still need to be figured out:

* What is the better way to add vsync to the new backends

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-22 00:50:25 +00:00