along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <inttypes.h>
#include <libudev.h>
#include <stdbool.h>
#include <stdlib.h>
#include <systemd/sd-bus.h>
#include <systemd/sd-event.h>
-#include <systemd/sd-login.h>
#include "grdev.h"
#include "grdev-internal.h"
#include "hashmap.h"
#include "login-shared.h"
#include "macro.h"
-#include "udev-util.h"
#include "util.h"
static void pipe_enable(grdev_pipe *pipe);
}
}
-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;
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 */
- 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;
assert(fb == pipe->back);
}
- /* if back-buffer is up-to-date, schedule flip */
- if (minage > 0 && fb->age >= minage) {
- grdev_display_flip_target(display, target, fb->age);
- continue;
- }
+ target->front = pipe->front;
+ target->back = pipe->back;
- /* we have an out-of-date back-buffer; return for redraw */
- target->fb = fb;
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;
- size_t i;
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);
- /* 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;
}
out:
if (r < 0)
- log_debug("grdev: %s/%s: cannot cache pipes: %s",
- display->session->name, display->name, strerror(-r));
+ log_debug_errno(r, "grdev: %s/%s: cannot cache pipes: %m",
+ display->session->name, display->name);
return true;
}
/* grdev_pipe_ready() is used by backends to notify about pipe state
* changed. If a pipe is ready, it can be fully used by us (available,
- * enabled and accessable). Backends can disable pipes at any time
+ * enabled and accessible). Backends can disable pipes at any time
* (like for async revocation), but can only enable them from parent
* context. Otherwise, we might call user-callbacks recursively. */
return;
error:
- log_debug("grdev: %s/%s/%s: cannot schedule vsync timer: %s",
- pipe->card->session->name, pipe->card->name, pipe->name, strerror(-r));
+ log_debug_errno(r, "grdev: %s/%s/%s: cannot schedule vsync timer: %m",
+ pipe->card->session->name, pipe->card->name, pipe->name);
}
/*
r = grdev_drm_card_new(&card, session, ud);
if (r < 0) {
- log_debug("grdev: %s: cannot add DRM device for %s: %s",
- session->name, udev_device_get_syspath(ud), strerror(-r));
+ log_debug_errno(r, "grdev: %s: cannot add DRM device for %s: %m",
+ session->name, udev_device_get_syspath(ud));
return;
}
} else if (!display) {
r = grdev_display_new(&display, session, pipe->name);
if (r < 0) {
- log_debug("grdev: %s/%s: cannot create display for pipe %s: %s",
- session->name, card->name, pipe->name, strerror(-r));
+ log_debug_errno(r, "grdev: %s/%s: cannot create display for pipe %s: %m",
+ session->name, card->name, pipe->name);
continue;
}
}