Commit Graph

27 Commits

Author SHA1 Message Date
Yuxuan Shui edb8b38eef
Tile root pixmap in the glx backend
In X, background pixmap is tiled (meaning they are repeated to filled
the window) by default. So, in the glx backend, we mimic this behavior
by binding the background pixmap of the root window (aka, the wallpaper)
to texture that repeats.

Fixes #107

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-08 21:48:39 +00:00
Yuxuan Shui 8922312e42
Refactor FBConfig lookup
Background: To bind a Xorg window content to a OpenGL FBConfig, which
has to match the color format the Xorg window is using.

Previously, compton just find a FBConfig that has the same depth. This
led to chjj/compton#477, which has been fixed by a ugly hack.

The commit refactor the lookup mechanism to take as much into
consideration as we reasonably can. Hopefully preventing similar
breakages in the future.

Also, some code sharing between the old and new glx backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:41:47 +00:00
Yuxuan Shui 061dd8e52e
Reuse some code from the new gl backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 18:16:28 +00:00
Yuxuan Shui f649a949e2
Even more includes
Expand the modulemap to cover some of the system headers too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 22:09:22 +00:00
Yuxuan Shui 1e0deea57f
Improve the include situation
Slightly clean up header inclusion with the help of clang's module system.
It's better for files to include the things you need directly.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-18 23:30:44 +00:00
Yuxuan Shui c93789f5e9
Enable the glStringMarker logger when available
glStringMarker is usually only available when running under some
kind of GL debugger, and can be used to insert strings into the
GL command string. Writing logs using it can be useful, since it
lets us correspond GL calls with what happens in compton.

More info about the extension can be found here:

https://www.khronos.org/registry/OpenGL/extensions/GREMEDY/GREMEDY_string_marker.txt

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-09 21:58:16 +00:00
Yuxuan Shui 3e7b7bd608
Move glx_fbconfig_t to opengl.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-31 00:38:13 +00:00
Yuxuan Shui d8198926dc
Convert printf_* in opengl.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 17:24:03 +00:00
Yuxuan Shui 833eb966f1
Convert print_errf/dbgf in win.c and compton.c
And improve some of the log messages. Like, when compton exits because
of unsupported options, explain which options are causing compton to
quit.

Convert some debugging messages that are guarded behind ifdef's to log_trace,
so user don't need to re-compile to enabled them.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 03:56:31 +00:00
Yuxuan Shui e58cbf8add
Convert non-mandatory attributes to macros
They're shorter and more portable.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-19 20:50:02 +00:00
Yuxuan Shui baeb4572ff
Move rendering related functions out of compton.c
Moved:
* Blur kernel related functions to kernel.c
* Vsync related functions to vsync.c
* paint related functions to render.c

This will make the `split-backend` branch easier to rebase.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 00:50:46 +00:00
Yuxuan Shui acb81bc9a9
Add log.h to files that need it
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:53:17 +00:00
Yuxuan Shui 7b755a3cf0 Fix typo in CONTRIBUTORS, move licenses around
Having a LICENSE file makes github happy
2018-10-03 22:24:12 +01:00
Yuxuan Shui ee318582f5 Sort out license problems
IANAL, but I think I am allowed to add missing copyright notices for
someone else. And I did my best job using git history to figure out who
wrote which functions. So I hope everything is fine.
2018-10-03 22:14:51 +01:00
Yuxuan Shui 03f33ed45c Move a couple X related functions to x.c
Also replace remaining Pixmap with xcb_pixmap_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 20:57:42 +01:00
Yuxuan Shui 28a2cc62fa Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.

It is unclear to me what is the previous painting logic. But the current
one is basically this:

1. Go through all windows top to bottom, and put visible windows (not
   unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
   region of screen that is obscured by all the windows above current
   one.
3. Paint all the visible windows from bottom to top. Subtract the region
   of ignore from the painting region. If we need to paint shadow, we
   subtract the body of the window from the shadow painting region too,
   because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
   window on top moved or changed shape, when window changed between
   opaque and transparent, etc.

Notes:

It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.

It is unclear if window shape related events are handled correctly or
not. Need more testing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 417744df14 Move opengl related function prototype to opengl.h
And aggregate some of the OPENGL ifdefs

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:01 +01:00
Yuxuan Shui c01ad5bf04 Move OpenGL functions around
Also remove some debug function calls (there are better tools for opengl
debugging now). Also remove copysubbuffermesa

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 13:49:45 +01:00
Yuxuan Shui 209b751b25 Port more stuff to xcb
To avoid interoperability issues between xcb and xlib.
2018-09-23 22:58:49 +01:00
Richard Grenville 234e3e8cda Improvement: Separate GLX parts from session_t & Attempt to fix #217
- Separate GLX parts from session_t into glx_session_t.

- Add --rererdir-on-root-change and --glx-reinit-on-root-change, as
  possible solutions for #217. Thanks to jlindgren90 for reporting.
2014-07-28 12:50:15 +08:00
Michael Reed a29b7958cf whitespace cleanup 2014-07-04 06:27:13 -04:00
Richard Grenville e4f3a2d77a Bug fix #181: Add --xrender-sync{,-fence}
- Add --xrender-sync{,-fence} to deal with redraw lag issue on GLX
  backend. --xrender-sync-fence requires a sufficiently new xorg-server
  and libXext. NO_XSYNC=1 may be used to disable it at compile time.
  Thanks to tchebb for reporting and everybody else for testing. (#181)

- A bit code clean-up. Replace a few XSync() with XFlush() to minimize
  the latency.
2014-03-17 23:25:34 +08:00
Richard Grenville 926ae379ba Bug fix #143: GLSL shader error on European locales
Set LC_NUMERIC=C when generating GLSL shader strings to avoid decimal
point issues on European locales. Thanks to hiciu for reporting.
2013-09-15 08:56:53 +08:00
Richard Grenville 48fb54dfae Misc: Add DEBUG_GLX_PAINTREG
- GLX: Add DEBUG_GLX_PAINTREG, for debugging painting region issues, for
  p4ddy's problem.
2013-05-09 09:43:40 +08:00
Richard Grenville 4a4f857cc2 Misc: Fix wrong description & DEBUG_GLX_ERR
- Fix description of "opengl" VSync.

- Add DEBUG_GLX_ERR to check for OpenGL errors.

- Update man page.
2013-04-25 09:27:14 +08:00
Richard Grenville 66be1f2fe1 Bug fix: GLX backend incompatibility with mesa & others
- Fix a bug that glx_bind_pixmap() doesn't work with mesa drivers.
  Thanks to Janhouse and mkraemer for reporting. (#7)

- Use stencil buffer to attempt to eliminate potential double-paint
  issue in glx_render(). X Fixes doesn't guarantee the rectangles in a
  region do not overlap, and this may cause some regions to be painted
  twice, which would be a problem if we are painting transparent things.
  Now the target window must have a stencil buffer. Compiz uses its own
  region implementation to deal with this, but as a lightweight
  compositor we can't really do the same. It may have a positive or
  negative effort over performance. Callgrind result indicates basically
  no change in performance, but this may or may not be true.

- Correctly distinguish GL extensions and GLX extensions. Sorry. :-D

- Handle screen size. Thanks to tsmithe for reporting. (#7)

- Rename OpenGL backend to GLX backend, because, we might have a EGL
  backend someday.

- Add configuration file option `backend` to specify backend. Add
  `backend` to D-Bus `opts_get`.

- Add OpenGL shader compilation code, but currently unused.

- Minor adjustments.

- Known issue: Window content doesn't get updated in VirtualBox,
  probably because its OpenGL implementation requires constant rebinding
  of texture. But that's really slow...

- Known issue: Blur feature is still unimplemented in GLX backend.
2013-03-16 22:54:43 +08:00
Richard Grenville 8ffcf1c1e8 Feature: OpenGL backend
- Add experimental OpenGL backend (--opengl). --blur-background is
  currently not possible with this backend, because I'm still trying to
  find a proper way to do blur with OpenGL. Flipping backend on-the-fly
  is really hard, so it isn't supported right now. No configuration file
  option exists to enable this, because it isn't stable enough.

- Add `opengl-swc` VSync method that uses SGI_swap_control to control
  buffer swap, with OpenGL backend. (#7)

- Fix a potential read-from-freed-memory issue in paint_all().

- Correctly reattach GLX context after fork.

- Dump error text in error(). Add GLX error code handling.

- Code clean-up.

- Known issues: Region operations take a lot of time in glx_render().
  I'm hesitating about what to do.
2013-03-15 23:16:23 +08:00