mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-25 06:03:40 +03:00
terminal/grdev: allow arbitrary fb-age contexts
Instead of limiting fb-aging to 64bit integers, allow any arbitrary context together with a release function to free it once the FB is destroyed.
This commit is contained in:
parent
51cff8bded
commit
66695cc343
@ -1442,6 +1442,9 @@ grdrm_fb *grdrm_fb_free(grdrm_fb *fb) {
|
||||
|
||||
assert(fb->card);
|
||||
|
||||
if (fb->base.free_fn)
|
||||
fb->base.free_fn(fb->base.data.ptr);
|
||||
|
||||
if (fb->id > 0 && fb->card->fd >= 0) {
|
||||
r = ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id);
|
||||
if (r < 0)
|
||||
|
@ -393,28 +393,19 @@ const grdev_display_target *grdev_display_next_target(grdev_display *display, co
|
||||
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->back);
|
||||
|
||||
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->back->age)
|
||||
for (i = 0; i < cache->pipe->max_fbs; ++i)
|
||||
if (cache->pipe->fbs[i])
|
||||
cache->pipe->fbs[i]->age = 0;
|
||||
|
||||
((grdev_fb*)target->back)->age = age;
|
||||
cache->pipe->flip = true;
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,15 @@ struct grdev_fb {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t format;
|
||||
uint64_t age;
|
||||
int32_t strides[4];
|
||||
void *maps[4];
|
||||
|
||||
union {
|
||||
void *ptr;
|
||||
uint64_t u64;
|
||||
} data;
|
||||
|
||||
void (*free_fn) (void *ptr);
|
||||
};
|
||||
|
||||
struct grdev_display_target {
|
||||
@ -105,8 +111,8 @@ struct grdev_display_target {
|
||||
uint32_t height;
|
||||
unsigned int rotate;
|
||||
unsigned int flip;
|
||||
const grdev_fb *front;
|
||||
const grdev_fb *back;
|
||||
grdev_fb *front;
|
||||
grdev_fb *back;
|
||||
};
|
||||
|
||||
void grdev_display_set_userdata(grdev_display *display, void *userdata);
|
||||
@ -121,7 +127,7 @@ void grdev_display_enable(grdev_display *display);
|
||||
void grdev_display_disable(grdev_display *display);
|
||||
|
||||
const grdev_display_target *grdev_display_next_target(grdev_display *display, const grdev_display_target *prev);
|
||||
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);
|
||||
|
||||
#define GRDEV_DISPLAY_FOREACH_TARGET(_display, _t) \
|
||||
for ((_t) = grdev_display_next_target((_display), NULL); \
|
||||
|
@ -258,7 +258,7 @@ static void modeset_render(Modeset *m, grdev_display *d) {
|
||||
|
||||
GRDEV_DISPLAY_FOREACH_TARGET(d, t) {
|
||||
modeset_draw(m, t);
|
||||
grdev_display_flip_target(d, t, 1);
|
||||
grdev_display_flip_target(d, t);
|
||||
}
|
||||
|
||||
grdev_session_commit(m->grdev_session);
|
||||
|
Loading…
x
Reference in New Issue
Block a user