Commit Graph

113 Commits

Author SHA1 Message Date
Yuxuan Shui 685a583f84
backend: add preliminary support for driver detection
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:31 +01:00
Yuxuan Shui a2d0d5c826
xrender: move into its own folder
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:31 +01:00
Yuxuan Shui bd4c242015
win: split struct win
Currently compton handles window creation event by immediately query all
the information it needs and create a window struct with that
information. However, this is prone to race conditions.

In the future, we want to react to window creation event by creating a
placeholder in the window stack, and only query window information in a
critical section where the X server is grabbed by us.

This commit split struct win into two struct, one as placeholder, the
other for holding actual window information.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:29 +01:00
Yuxuan Shui abeeb36bb2
x: wrap xcb_generate_id to check for errors
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:28 +01:00
Yuxuan Shui 3935e97e69
gl_common: bump GL to 3.30
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:27 +01:00
Yuxuan Shui 6e8a86d415
gl_common: use vao
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:27 +01:00
Yuxuan Shui ffc9c32b5e
gl_common: update gl_compose to core profile
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:27 +01:00
Yuxuan Shui f08004a448
gl_common: update gl_blur to core profile
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:27 +01:00
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 a93754009c
Dump damage region info in trace log
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:24 +01:00
Yuxuan Shui 1f80e547bc
core: remove unnecessary win_check_fade_finished
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:24 +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 f501d35ba9
core: re-run paint_preprocess after redirecting
paint_preprocess calls redir_start if it decides to redirect the screen.
redir_start might change the state of the windows. For example, when the
image of the window fails to bind, redir_start sets the error flag. And
those state changes might exclude the window from being rendered. Thus,
paint_preprocess should be re-run to make sure the new states are
honoured.

Fixes a crash when window images fail to bind after redirecting.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +01:00
Yuxuan Shui 838a214749
Add several debug prints
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui 8dc250a415
win: update window's image lazily
Use a flag to mark whether the image needs update, and only update once
per frame.

Also refactor some common code into functions, and handle image errors
properly.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:21 +00:00
Yuxuan Shui 0a32c81d9c
backend interface: improve documentation 2019-03-16 20:57:43 +00:00
Yuxuan Shui 5940a959dc
new backend: handle --use-damage
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-16 12:12:54 +00:00
Yuxuan Shui d39d937566
new glx: fix memory leak, and bind pixmap
struct _glx_image_data needs to be freed even when refcount is not 0.

Also fixed a typo in glx_bind_pixmap.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 22:48:42 +00: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 9296706f7b
backend: fix rendering shadow with opacity
Shadow opacity should be multiplied with the window's opacity.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 19:56:55 +00:00
Yuxuan Shui cebe1b18d6
vsync: choose vsync method automatically
Choose the best vsync method for the user, instead of asking them to
frustratingly try every one of the options to see what works.

With this commit, the `vsync` option will take only a boolean value.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 15: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 fb155c9769
new glx: create a OpenGL 3.0 context
Older version of OpenGL won't be supported by the new glx backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 16:13:27 +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 6ff0facae6
backend: invert color and dim doesn't need reg_op
We only ever invert color of or dim the entire image, so just remove the
ability to do region based inversion and dimming. Making implementing
image_op easier.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-09 13:38:50 +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 f2aeb848ec
Put the whole vtable in backend_list
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-07 21:08:51 +00:00
Yuxuan Shui 7e3976947b
Fix crash when using monitor-repaint
If monitor-repaint is not implemented by the backend, compton will
crash. This commit fix the crash by not doing monitor-repaint in that
case.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 22:37:53 +00:00
Yuxuan Shui d0fd21e167
Drop support for Composite < 0.2
Rational: current workaround for Composite < 0.2 doesn't work with the
GLX backend, it also doesn't handle window border properly. Plus,
Composite 0.2 came out more than a decade ago, it's safe to assume
everyone has it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 22:14:23 +00:00
Yuxuan Shui eed5ea719e
Implement monitor repaint in new xrender
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui c387a266dc
backend interface: prepare is optional
Also remove xrender's prepare since it overwrite part of the screen
outside the damage region, causing rendering problems.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui de30ef14ae
backend: move the head of the damage ring after paint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-05 20:27:10 +00:00
Yuxuan Shui c57f267535
backend interface: Add visible hint
Pass the visible region of the image to the backend, so the backend
could optimize based on that information.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 23:02:58 +00:00
Yuxuan Shui a2ae36c1d6
backend_common: fix shadow generation with opacity
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-04 23:02:35 +00:00
Yuxuan Shui 3707f792fb
new_backend: New interface
Move more logic out of the backend. The backends are now more agnostic
to what happens in compton.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-03 22:18:34 +00:00
Yuxuan Shui 11c8655206
Fix build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-27 06:33:30 +00:00
Yuxuan Shui 26214f312f
x: create_picture_with_{visual, pictfmt} don't need session_t
Take xcb_connection_t and xcb_drawable_t instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-27 00:30:27 +00:00
Yuxuan Shui 0ceee9aad1
solid_picture and build_shadow shouldn't take session_t
Pass xcb_connection_t and xcb_drawable_t instead, which is what these
functions need.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-26 23:21:11 +00:00