chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
terminal/idev: avoid magic numbers
[elogind.git]
/
src
/
libsystemd-terminal
/
grdev.c
diff --git
a/src/libsystemd-terminal/grdev.c
b/src/libsystemd-terminal/grdev.c
index c5ea524c69fd725990977f9e55bb4856527c4981..0c21eac5512d37f8a98516c48ac9c907b4bd5c90 100644
(file)
--- a/
src/libsystemd-terminal/grdev.c
+++ b/
src/libsystemd-terminal/grdev.c
@@
-158,6
+158,7
@@
int grdev_tile_new_leaf(grdev_tile **out, grdev_pipe *pipe) {
_cleanup_(grdev_tile_freep) grdev_tile *tile = NULL;
int r;
_cleanup_(grdev_tile_freep) grdev_tile *tile = NULL;
int r;
+ assert_return(out, -EINVAL);
assert_return(pipe, -EINVAL);
assert_return(!pipe->tile, -EINVAL);
assert_return(pipe, -EINVAL);
assert_return(!pipe->tile, -EINVAL);
@@
-300,6
+301,18
@@
const char *grdev_display_get_name(grdev_display *display) {
return display->name;
}
return display->name;
}
+uint32_t grdev_display_get_width(grdev_display *display) {
+ assert_return(display, 0);
+
+ return display->width;
+}
+
+uint32_t grdev_display_get_height(grdev_display *display) {
+ assert_return(display, 0);
+
+ return display->height;
+}
+
bool grdev_display_is_enabled(grdev_display *display) {
return display && display->enabled;
}
bool grdev_display_is_enabled(grdev_display *display) {
return display && display->enabled;
}
@@
-330,7
+343,7
@@
void grdev_display_disable(grdev_display *display) {
}
}
}
}
-const grdev_display_target *grdev_display_next_target(grdev_display *display, const grdev_display_target *prev
, uint64_t minage
) {
+const grdev_display_target *grdev_display_next_target(grdev_display *display, const grdev_display_target *prev) {
grdev_display_cache *cache;
size_t idx;
grdev_display_cache *cache;
size_t idx;
@@
-345,7
+358,7
@@
const grdev_display_target *grdev_display_next_target(grdev_display *display, co
assert(cache->pipe->tile->display == display);
assert(display->pipes >= cache);
assert(cache->pipe->tile->display == display);
assert(display->pipes >= cache);
- idx =
(cache - display->pipes) / sizeof(*cache)
+ 1;
+ idx =
cache - display->pipes
+ 1;
} else {
idx = 0;
}
} else {
idx = 0;
}
@@
-361,52
+374,38
@@
const grdev_display_target *grdev_display_next_target(grdev_display *display, co
if (!pipe->running || !pipe->enabled)
continue;
if (!pipe->running || !pipe->enabled)
continue;
- /* if front-buffer is up-to-date, there's nothing to do */
- if (minage > 0 && pipe->front && pipe->front->age >= minage)
- continue;
-
/* find suitable back-buffer */
/* find suitable back-buffer */
- if (!(fb = pipe->back)) {
- if (!pipe->vtable->target || !(fb = pipe->vtable->target(pipe)))
+ if (!pipe->back) {
+ if (!pipe->vtable->target)
+ continue;
+ if (!(fb = pipe->vtable->target(pipe)))
continue;
continue;
- }
- /* if back-buffer is up-to-date, schedule flip */
- if (minage > 0 && fb->age >= minage) {
- grdev_display_flip_target(display, target, fb->age);
- continue;
+ assert(fb == pipe->back);
}
}
- /* we have an out-of-date back-buffer; return for redraw */
- target->fb = fb;
+ target->front = pipe->front;
+ target->back = pipe->back;
+
return target;
}
return NULL;
}
return target;
}
return NULL;
}
-void grdev_display_flip_target(grdev_display *display, const grdev_display_target *target
, uint64_t age
) {
+void grdev_display_flip_target(grdev_display *display, const grdev_display_target *target) {
grdev_display_cache *cache;
grdev_display_cache *cache;
- size_t i;
assert(display);
assert(!display->modified);
assert(display->enabled);
assert(target);
assert(display);
assert(!display->modified);
assert(display->enabled);
assert(target);
- assert(target->fb);
cache = container_of(target, grdev_display_cache, target);
assert(cache->pipe);
assert(cache->pipe->tile->display == display);
cache = container_of(target, grdev_display_cache, target);
assert(cache->pipe);
assert(cache->pipe->tile->display == display);
- /* reset age of all FB on overflow */
- if (age < target->fb->age)
- for (i = 0; i < cache->pipe->max_fbs; ++i)
- if (cache->pipe->fbs[i])
- cache->pipe->fbs[i]->age = 0;
-
- ((grdev_fb*)target->fb)->age = age;
cache->pipe->flip = true;
}
cache->pipe->flip = true;
}
@@
-571,6
+570,8
@@
static bool display_cache(grdev_display *display) {
}
display_cache_targets(display);
}
display_cache_targets(display);
+ display->width = display->tile->cache_w;
+ display->height = display->tile->cache_h;
r = 0;
r = 0;