Skip to content

Commit

Permalink
Merge branch 'yshui:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
FT-Labs authored Feb 4, 2024
2 parents e8ca191 + bbc657e commit 77c4eba
Show file tree
Hide file tree
Showing 28 changed files with 195 additions and 121 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build files
.deps
.direnv
aclocal.m4
autom4te.cache
config.log
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Unreleased

## New features

* Allow `corner-radius-rules` to override `corner-radius = 0`. Previously setting corner radius to 0 globally disables rounded corners. (#1170)

## Bug fixes

* Workaround a NVIDIA problem that causes high CPU usage after suspend/resume (#1172, #1168)

# v11.1 (2024-Jan-28)

## Bug fixes

* Fix missing fading on window close for some window managers. (#704)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libpcre2-dev libpixma
On Fedora, the needed packages are

```
dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libXext-devel libxcb-devel libGL-devel libEGL-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel
dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libXext-devel libxcb-devel libGL-devel libEGL-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel
```

To build the documents, you need `asciidoc`
Expand Down
10 changes: 5 additions & 5 deletions src/backend/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ struct backend_operations {
* @param backend_data backend data
* @param pixmap X pixmap to bind
* @param fmt information of the pixmap's visual
* @param owned whether the ownership of the pixmap is transfered to the backend
* @param owned whether the ownership of the pixmap is transferred to the backend
* @return backend internal data structure bound with this pixmap
*/
void *(*bind_pixmap)(backend_t *backend_data, xcb_pixmap_t pixmap,
Expand All @@ -225,7 +225,7 @@ struct backend_operations {
struct backend_shadow_context *ctx);

/// Create a shadow image based on the parameters. Resulting image should have a
/// size of `width + radisu * 2` x `height + radius * 2`. Radius is set when the
/// size of `width + radius * 2` x `height + radius * 2`. Radius is set when the
/// shadow context is created.
/// Default implementation: default_render_shadow
///
Expand Down Expand Up @@ -284,9 +284,9 @@ struct backend_operations {
bool (*is_image_transparent)(backend_t *backend_data, void *image_data)
attr_nonnull(1, 2);

/// Get the age of the buffer content we are currently rendering ontop
/// Get the age of the buffer content we are currently rendering on top
/// of. The buffer that has just been `present`ed has a buffer age of 1.
/// Everytime `present` is called, buffers get older. Return -1 if the
/// Every time `present` is called, buffers get older. Return -1 if the
/// buffer is empty.
///
/// Optional
Expand All @@ -295,7 +295,7 @@ struct backend_operations {
/// Get the render time of the last frame. If the render is still in progress,
/// returns false. The time is returned in `ts`. Frames are delimited by the
/// present() calls. i.e. after a present() call, last_render_time() should start
/// reporting the time of the just presen1ted frame.
/// reporting the time of the just presented frame.
///
/// Optional, if not available, the most conservative estimation will be used.
bool (*last_render_time)(backend_t *backend_data, struct timespec *ts);
Expand Down
9 changes: 6 additions & 3 deletions src/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ void apply_driver_workarounds(struct session *ps, enum driver driver) {
}
}

enum vblank_scheduler_type choose_vblank_scheduler(enum driver driver) {
enum vblank_scheduler_type choose_vblank_scheduler(enum driver driver attr_unused) {
enum vblank_scheduler_type type = VBLANK_SCHEDULER_PRESENT;
#ifdef CONFIG_OPENGL
if (driver & DRIVER_NVIDIA) {
return VBLANK_SCHEDULER_SGI_VIDEO_SYNC;
type = VBLANK_SCHEDULER_SGI_VIDEO_SYNC;
}
return VBLANK_SCHEDULER_PRESENT;
#endif
return type;
}

enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_window_t window) {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void gl_destroy_window_shader(backend_t *backend_data attr_unused, void *shader)
* @note In order to reduce number of textures which needs to be
* allocated and deleted during this recursive render
* we reuse the same two textures for render source and
* destination simply by alterating between them.
* destination simply by alternating between them.
* Unfortunately on first iteration source_texture might
* be read-only. In this case we will select auxiliary_texture as
* destination_texture in order not to touch that read-only source
Expand Down Expand Up @@ -253,7 +253,7 @@ _gl_average_texture_color(backend_t *base, GLuint source_texture, GLuint destina

/*
* @brief Builds a 1x1 texture which has color corresponding to the average of all
* pixels of img by recursively rendering into texture of quorter the size (half
* pixels of img by recursively rendering into texture of quarter the size (half
* width and half height).
* Returned texture must not be deleted, since it's owned by the gl_image. It will be
* deleted when the gl_image is released.
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gl/gl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef struct {
GLint color_loc;
} gl_fill_shader_t;

/// @brief Wrapper of a binded GL texture.
/// @brief Wrapper of a bound GL texture.
struct gl_texture {
int refcount;
bool has_alpha;
Expand Down
6 changes: 3 additions & 3 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ typedef struct session {
/// Either the backend is currently rendering a frame, or a frame has been
/// rendered but has yet to be presented. In either case, we should not start
/// another render right now. As if we start issuing rendering commands now, we
/// will have to wait for either the the current render to finish, or the current
/// back buffer to be become available again. In either case, we will be wasting
/// will have to wait for either the current render to finish, or the current
/// back buffer to become available again. In either case, we will be wasting
/// time.
bool backend_busy;
/// Whether a render is queued. This generally means there are pending updates
Expand Down Expand Up @@ -279,7 +279,7 @@ typedef struct session {
struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit
bool quit : 1;
// TODO(yshui) use separate flags for dfferent kinds of updates so we don't
// TODO(yshui) use separate flags for different kinds of updates so we don't
// waste our time.
/// Whether there are pending updates, like window creation, etc.
bool pending_updates : 1;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#else
# define attr_warn_unused_result
#endif
// An alias for conveninence
// An alias for convenience
#define must_use attr_warn_unused_result

#if __has_attribute(nonnull)
Expand Down
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ static char *locate_auxiliary_file_at(const char *base, const char *scope, const
}

/**
* Get a path of an auxiliary file to read, could be a shader file, or any supplimenrary
* Get a path of an auxiliary file to read, could be a shader file, or any supplementary
* file.
*
* Follows the XDG specification to search for the shader file in configuration locations.
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ char **xdg_config_dirs(void);
/// Parse a configuration file
/// Returns the actually config_file name used, allocated on heap
/// Outputs:
/// shadow_enable = whether shaodw is enabled globally
/// shadow_enable = whether shadow is enabled globally
/// fading_enable = whether fading is enabled globally
/// win_option_mask = whether option overrides for specific window type is set for given
/// options
Expand Down
8 changes: 4 additions & 4 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/// made the query when those events were already in the queue. so the reply you got is
/// more up-to-date than the events). Also, handling events when other client are making
/// concurrent requests is not good. Because the server states are changing without you
/// knowning them. This is super racy, and can cause lots of potential problems.
/// knowing them. This is super racy, and can cause lots of potential problems.
///
/// All of above mandates we do these things:
/// 1. Grab server when handling events
Expand Down Expand Up @@ -324,7 +324,7 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
}

if (ev->parent == ps->c.screen_info->root) {
// X will generate reparent notifiy even if the parent didn't actually
// X will generate reparent notify even if the parent didn't actually
// change (i.e. reparent again to current parent). So we check if that's
// the case
auto w = find_win(ps, ev->window);
Expand Down Expand Up @@ -465,7 +465,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
}
}

// Unconcerned about any other proprties on root window
// Unconcerned about any other properties on root window
return;
}

Expand Down Expand Up @@ -499,7 +499,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
}

if (ev->atom == ps->atoms->a_NET_WM_BYPASS_COMPOSITOR) {
// Unnecessay until we remove the queue_redraw in ev_handle
// Unnecessary until we remove the queue_redraw in ev_handle
queue_redraw(ps);
}

Expand Down
2 changes: 1 addition & 1 deletion src/file_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bool file_watch_add(void *_fwr, const char *filename, file_watch_cb_t cb, void *
fflags |= NOTE_CLOSE_WRITE;
#else
// NOTE_WRITE will receive notification more frequent than necessary, so is less
// preferrable
// preferable
fflags |= NOTE_WRITE;
#endif
struct kevent ev = {
Expand Down
2 changes: 1 addition & 1 deletion src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static inline double estimate_first_row_sum(double size, double r) {
// `a` is gaussian at (size, 0)
double a = exp(-0.5 * size * size / (r * r)) / sqrt(2 * M_PI) / r;
// The sum of the whole kernel is normalized to 1, i.e. each element is divided by
// factor sqaured. So the sum of the first row is a * factor / factor^2 = a /
// factor squared. So the sum of the first row is a * factor / factor^2 = a /
// factor
return a / factor;
}
Expand Down
2 changes: 1 addition & 1 deletion src/opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
// TODO(bhagwan) this is a mess and needs a more consistent way of getting the border
// pixel I tried looking for a notify event for XCB_CW_BORDER_PIXEL (in
// xcb_create_window()) or a way to get the pixels from xcb_render_picture_t but the
// documentation for the xcb_xrender extension is literaly non existent...
// documentation for the xcb_xrender extension is literally non existent...
//
// NOTE(yshui) There is no consistent way to get the "border" color of a X window. From
// the WM's perspective there are multiple ways to implement window borders. Using
Expand Down
6 changes: 3 additions & 3 deletions src/opengl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ typedef struct glx_session {
glx_round_pass_t *round_passes;
} glx_session_t;

/// @brief Wrapper of a binded GLX texture.
/// @brief Wrapper of a bound GLX texture.
typedef struct _glx_texture {
GLuint texture;
GLXPixmap glpixmap;
Expand Down Expand Up @@ -121,9 +121,9 @@ bool glx_bind_texture(session_t *ps, glx_texture_t **pptex, int x, int y, int wi
void glx_paint_pre(session_t *ps, region_t *preg) attr_nonnull(1, 2);

/**
* Check if a texture is binded, or is binded to the given pixmap.
* Check if a texture is bound, or is bound to the given pixmap.
*/
static inline bool glx_tex_binded(const glx_texture_t *ptex, xcb_pixmap_t pixmap) {
static inline bool glx_tex_bound(const glx_texture_t *ptex, xcb_pixmap_t pixmap) {
return ptex && ptex->glpixmap && ptex->texture && (!pixmap || pixmap == ptex->pixmap);
}

Expand Down
8 changes: 4 additions & 4 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all

int o = 0, longopt_idx = -1;

// Pre-parse the commandline arguments to check for --config and invalid
// Pre-parse the command line arguments to check for --config and invalid
// switches
// Must reset optind to 0 here in case we reread the commandline
// Must reset optind to 0 here in case we reread the command line
// arguments
optind = 1;
*config_file = NULL;
Expand Down Expand Up @@ -379,7 +379,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
// instead of commas in atof().
setlocale(LC_NUMERIC, "C");

// Parse commandline arguments. Range checking will be done later.
// Parse command line arguments. Range checking will be done later.

bool failed = false;
const char *deprecation_message attr_unused =
Expand Down Expand Up @@ -731,7 +731,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
opt->blur_strength = atoi(optarg);
break;
case 333:
// --cornor-radius
// --corner-radius
opt->corner_radius = atoi(optarg);
break;
case 334:
Expand Down
45 changes: 37 additions & 8 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ enum vblank_callback_action reschedule_render_at_vblank(struct vblank_event *e,
/// is no render currently scheduled. i.e. render_queued == false.
/// 2. then, we need to figure out the best time to start rendering. we need to
/// at least know when the next vblank will start, as we can't start render
/// before the current rendered frame is diplayed on screen. we have this
/// before the current rendered frame is displayed on screen. we have this
/// information from the vblank scheduler, it will notify us when that happens.
/// we might also want to delay the rendering even further to reduce latency,
/// this is discussed below, in FUTURE WORKS.
Expand Down Expand Up @@ -1330,14 +1330,43 @@ void root_damaged(session_t *ps) {
}
auto pixmap = x_get_root_back_pixmap(&ps->c, ps->atoms);
if (pixmap != XCB_NONE) {
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply(
ps->c.c, xcb_get_geometry(ps->c.c, pixmap), NULL);
if (!r) {
goto err;
}

// We used to assume that pixmaps pointed by the root background
// pixmap atoms are owned by the root window and have the same
// depth and hence the same visual that we can use to bind them.
// However, some applications break this assumption, e.g. the
// Xfce's desktop manager xfdesktop that sets the _XROOTPMAP_ID
// atom to a pixmap owned by it that seems to always have 32 bpp
// depth when the common root window's depth is 24 bpp. So use the
// root window's visual only if the root background pixmap's depth
// matches the root window's depth. Otherwise, find a suitable
// visual for the root background pixmap's depth and use it.
//
// We can't obtain a suitable visual for the root background
// pixmap the same way as the win_bind_pixmap function because it
// requires a window and we have only a pixmap. We also can't not
// bind the root background pixmap in case of depth mismatch
// because some options rely on it's content, e.g.
// transparent-clipping.
xcb_visualid_t visual =
r->depth == ps->c.screen_info->root_depth
? ps->c.screen_info->root_visual
: x_get_visual_for_depth(&ps->c, r->depth);
free(r);

ps->root_image = ps->backend_data->ops->bind_pixmap(
ps->backend_data, pixmap,
x_get_visual_info(&ps->c, ps->c.screen_info->root_visual), false);
ps->backend_data, pixmap, x_get_visual_info(&ps->c, visual), false);
if (ps->root_image) {
ps->backend_data->ops->set_image_property(
ps->backend_data, IMAGE_PROPERTY_EFFECTIVE_SIZE,
ps->root_image, (int[]){ps->root_width, ps->root_height});
} else {
err:
log_error("Failed to bind root back pixmap");
}
}
Expand Down Expand Up @@ -2040,7 +2069,7 @@ static void x_event_callback(EV_P attr_unused, ev_io *w, int revents attr_unused
/**
* Turn on the program reset flag.
*
* This will result in the compostior resetting itself after next paint.
* This will result in the compositor resetting itself after next paint.
*/
static void reset_enable(EV_P_ ev_signal *w attr_unused, int revents attr_unused) {
log_info("picom is resetting...");
Expand Down Expand Up @@ -2117,11 +2146,11 @@ static bool load_shader_source_for_condition(const c2_lptr_t *cond, void *data)
/**
* Initialize a session.
*
* @param argc number of commandline arguments
* @param argv commandline arguments
* @param argc number of command line arguments
* @param argv command line arguments
* @param dpy the X Display
* @param config_file the path to the config file
* @param all_xerros whether we should report all X errors
* @param all_xerrors whether we should report all X errors
* @param fork whether we will fork after initialization
*/
static session_t *session_init(int argc, char **argv, Display *dpy,
Expand Down Expand Up @@ -2673,7 +2702,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
ps->server_grabbed = true;

// We are going to pull latest information from X server now, events sent by X
// earlier is irrelavant at this point.
// earlier is irrelevant at this point.
// A better solution is probably grabbing the server from the very start. But I
// think there still could be race condition that mandates discarding the events.
x_discard_events(&ps->c);
Expand Down
Loading

0 comments on commit 77c4eba

Please sign in to comment.