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