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>
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>
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>
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>
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>
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>
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>