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>
Because when the screen is unredirected, the window resource would have
already been freed. Fix a NULL pointer deref.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
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>
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>
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>
Handle backend initialization failure.
Also actually disable vsync when it's not supported in the new xrender
backend.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If PresentPixmap choose to use the Flip mode, we cannot reuse the same
buffer for rendering for the next frame. Add double buffering for that
case.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Don't use idle fence. There is no reliable & portable way to obtain a
fence Present will like. Intel driver wants a DRI3 fence, NVIDIA driver
doesn't support DRI3, and wants a XSync fence (I am not even sure, since
Present doesn't really work with the NVIDIA driver. And using the fence
on NVIDIA driver causes compton to use 100% CPU).
Just don't bother.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Window size change cause window resource to be released and re-acquired,
so it cannot work on unmapped windows.
Previously we make sure of that by skipping fading and change if the
window is mapped. Now we just make sure that functino is never called
with an unmapped window.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If a window is being faded out because of unmapping, don't handle its
configuration notify. Avoid freeing pixmap of a window that is being
faded out, because that will cause paint to fail.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
win_update_focused transition window into FADING without checking their
current state, resulting into unmapping windows being brought into
FADING state and stops unmapping.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously it is initialized by win_update_bounding_shape, so
configure_win is called when win_data == NULL and state ==
WSTATE_MAPPING, which is an invalid state for a `win` to be in.
Now map_win explicitly calls backend->prepare_win. This is not very
efficient since win_update_bounding_shape will reinit it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* Make some functions in win.c pure
* Remove unused code
* Fix misuse of attr_const, const functions shouldn't exam data pointed
to by its pointer arguments.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
When destroying a window, set window->next->reg_ignore_valid to false,
since its reg_ignore is not valid anymore.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Only case where you want to map window in add_win() is during compton
startup, when compton is registering existing windows. Otherwise,
add_win() is always called for newly created windows, so there will
always be a MapNotify coming up for that window. If we map newly created
windows in add_win(), we will try to map it a second time when the MapNotify
arrives.
So, just don't call map_win() from add_win(). For compton startup, we
explicitly call map_win() after calling add_win() in session_init.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If a window is destroyed and starts to fade out when screen is
unredirected, when the screen become redirected again, we will generate
errors when trying to render that window.
Also make sure the assumption that all window are either MAPPED or
UNMAPPED when screen is unredirected holds.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
paint_preprocess takes head of the window list as an argument. The
actual head of the window list might be freed and deleted during processing
of fade, but paint_preprocess will keep using the old head of the list,
thus uses freed memory.
Solution is just don't pass the head as an argument. paint_preprocess
will use session_t::list directly.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>