Commit Graph

1218 Commits

Author SHA1 Message Date
Yuxuan Shui 51ad94f745
win: remove unnecessary assertion
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:24 +01:00
Greg Flynn 75ef090fc4
fix tiny typo in manpage for --use-damage 2019-05-21 20:15:23 +01:00
Yuxuan Shui d3a2c94461
win: invalidate reg_ignore properly when destroying window
reg_ignore_valid marks the validity of the reg_ignore of the windows
BENEATH the current window. That is, set `w->reg_ignore_valid = false`
doesn't invalidate `w->reg_ignore`.

When destroying window `w`, we need to invalidate all reg_ignore beneath
`w`. So it is not enough to just set `w->next->reg_ignore_valid =
false`, we also need to invalidate `w->next->reg_ignore`.

Yes, this variable name is confusing. Will be changed in the future.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +01:00
Yuxuan Shui df15526722
options: print warning for --vsync-aggressive
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +01:00
Yuxuan Shui b5b9419ecc
core: don't rebind root image when unredirected
When the screen is not redirected, don't update the root image because
the backend is not initialized in this case.

Fixes a crash.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +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 a3f41bdc25
ci: test config file parsing
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +01:00
Yuxuan Shui b5be5e3cdd
ci: fix code coverage reports generation
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:23 +01:00
Yuxuan Shui 1ba402e11f
ci: update
The docker image is on debian buster now, adapt.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:22 +01:00
Yuxuan Shui edbf7f430c
Initialize tls log structure in main
Fix error reporting when failed to open X display.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:22 +01:00
Yuxuan Shui e267b9178e
ci: upload code coverage
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:22 +01:00
Yuxuan Shui a2cc81c572
Run unittest in CI
Also general CI config update

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:22 +01:00
Yuxuan Shui aa37c4f4ca
Add some unittests
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:22 +01:00
Yuxuan Shui 2cefefb531
Add test.h as submodule 2019-05-21 20:15:22 +01:00
Yuxuan Shui 061f9aea9d
win: clear window flag _after_ release_image
release_image has assertions on the flags, clear the flags before
calling it causes assertion failure.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui 7c1876c787
core: don't use stale window images
Previously, when the backend doesn't implement root_change(), we will
deinit, and then init the backend again. However, we didn't free all the
images previously returned by the backend. There is no guarantee that
these images will be valid across deinit/init.

So, make sure they are freed.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui e8f2298159
event: lazify screen update
Set root screen change flag in event handler, and update in
draw_callback.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui e414fee91f
event: use log levels, not ifdefs
And some general clean up.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui 17c96eb9ba
core: general clean up
Also move some remaing event functions to event.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui 472185e885
core: split out event code
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui 1b955cabc5
win: add comment mentioning the NVIDIA bug
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui aa742146f1
win: put window into UNMAPPED state before mapping
Make sure before the mapping operation begins, the window is always in
UNUNMAPPED state. This makes it easier to reason about things, such as
resource availability, etc.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui fed6ac5b09
win: release window image before rebind
Previously we try to keep the image data until the rebind succeeds. This
way even if the rebind fails, we still have something to display.

But that triggers a NVIDIA driver bug. Basically you cannot have more
than one names (XIDs) of a window pixmap. NVIDIA driver doesn't like
that, and binding the pixmap with its aliases will fail. This can
sometimes happen if we name the new pixmap before freeing the old one during
rebind, and the pixmap doesn't actually change (i.e. the rebind is
unnecessary, could happen because of X event handling complications).

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui 9bb2fa44d4
core: ignore window with IMAGE_ERRORs
window with IMAGE_ERROR might not have an image data attached, so ignore
them during paint.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui b32ae5a32c
win: free window resource
It's fine to call free_win_res in the new backends too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00: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 312643c454
win: clear STALE_IMAGE flag in map_win
Clear the STALE_IMAGE flag set by win_update_bounding_shape to avoid an
unnecessary image data invalidation.

Mainly to workaround a NVIDIA bug. For more detailed explanation, see
commit 8f67c6190c281955846589d8769385f30e7c5d23

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:21 +00:00
Yuxuan Shui b10f0bbc67
win: always refresh window size in map_win
Instead queue up configure notification while the window is unmapped,
just update the window geometry when the window is mapped.

Simplify the logic a little bit.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:21 +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 b0820d847c
release: bump version number
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:20:47 +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
yshui cbe22a1cc8
Merge pull request #131 from yshui/deprecate-glx-swap-method
Deprecate --glx-swap-method
2019-03-12 00:37:20 +00:00
Yuxuan Shui dd240d0576
Deprecate --glx-swap-method
Setting glx-swap-method to value other than "undefined" and "buffer-age"
could potentially cause rendering problems. So remove them, the meaning
of the remaining options can be more precisely captured by "use-damage",
so create a new option under that name.

--glx-swap-method is deprecated in favor of the new option --use-damage.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-12 00:35:47 +00:00
Yuxuan Shui 17d1281594
Remove options deprecated in v3
Specifically, use --glx-copy-from-front and --glx-use-copysubbuffermesa
are now hard errors.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-11 23:56:58 +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 0bd08f4ab4
Don't call glx_on_root_change when using new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 16:34:07 +00:00
Yuxuan Shui a5c64b74ad
doc: remove mentions of opengl-swc 2019-03-10 15:04:41 +00:00
yshui 8c1f3bf0eb
Merge pull request #130 from yshui/vsync
vsync: choose vsync method automatically
2019-03-10 15:02:50 +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 e7de44260b
Deprecate --vsync-aggressive
Original developer's word in man page: "Reported to work pretty terribly".

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 13:59:22 +00:00
Yuxuan Shui 22da17630f
Run clang-format
Now we have a consistent style across the codebase.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 12:35:38 +00:00
yshui 7845673734
Merge pull request #129 from Patricol/patch-1
fix typo
2019-03-10 03:09:32 +00:00
Yuxuan Shui 472fe6c6bd
options: remove mentions of some deprecated options
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-10 03:04:43 +00:00
Patrick Collins 9c0d17d06b
fix typo
writeen -> written
2019-03-09 21:35:00 -05: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