diff options
Diffstat (limited to 'render/allocator')
-rw-r--r-- | render/allocator/drm_dumb.c | 6 | ||||
-rw-r--r-- | render/allocator/gbm.c | 14 | ||||
-rw-r--r-- | render/allocator/shm.c | 3 |
3 files changed, 14 insertions, 9 deletions
diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c index 684ba2e3..03ff8e3f 100644 --- a/render/allocator/drm_dumb.c +++ b/render/allocator/drm_dumb.c @@ -25,7 +25,8 @@ static const struct wlr_buffer_impl buffer_impl; static struct wlr_drm_dumb_buffer *drm_dumb_buffer_from_buffer( struct wlr_buffer *wlr_buf) { assert(wlr_buf->impl == &buffer_impl); - return (struct wlr_drm_dumb_buffer *)wlr_buf; + struct wlr_drm_dumb_buffer *buf = wl_container_of(wlr_buf, buf, base); + return buf; } static struct wlr_drm_dumb_buffer *create_buffer( @@ -163,7 +164,8 @@ static const struct wlr_allocator_interface allocator_impl; static struct wlr_drm_dumb_allocator *drm_dumb_alloc_from_alloc( struct wlr_allocator *wlr_alloc) { assert(wlr_alloc->impl == &allocator_impl); - return (struct wlr_drm_dumb_allocator *)wlr_alloc; + struct wlr_drm_dumb_allocator *alloc = wl_container_of(wlr_alloc, alloc, base); + return alloc; } static struct wlr_buffer *allocator_create_buffer( diff --git a/render/allocator/gbm.c b/render/allocator/gbm.c index 149ff6b9..32636d30 100644 --- a/render/allocator/gbm.c +++ b/render/allocator/gbm.c @@ -17,9 +17,10 @@ static const struct wlr_buffer_impl buffer_impl; static struct wlr_gbm_buffer *get_gbm_buffer_from_buffer( - struct wlr_buffer *buffer) { - assert(buffer->impl == &buffer_impl); - return (struct wlr_gbm_buffer *)buffer; + struct wlr_buffer *wlr_buffer) { + assert(wlr_buffer->impl == &buffer_impl); + struct wlr_gbm_buffer *buffer = wl_container_of(wlr_buffer, buffer, base); + return buffer; } static bool export_gbm_bo(struct gbm_bo *bo, @@ -179,9 +180,10 @@ static const struct wlr_buffer_impl buffer_impl = { static const struct wlr_allocator_interface allocator_impl; static struct wlr_gbm_allocator *get_gbm_alloc_from_alloc( - struct wlr_allocator *alloc) { - assert(alloc->impl == &allocator_impl); - return (struct wlr_gbm_allocator *)alloc; + struct wlr_allocator *wlr_alloc) { + assert(wlr_alloc->impl == &allocator_impl); + struct wlr_gbm_allocator *alloc = wl_container_of(wlr_alloc, alloc, base); + return alloc; } struct wlr_allocator *wlr_gbm_allocator_create(int fd) { diff --git a/render/allocator/shm.c b/render/allocator/shm.c index 55a8fab2..b6d3138c 100644 --- a/render/allocator/shm.c +++ b/render/allocator/shm.c @@ -17,7 +17,8 @@ static const struct wlr_buffer_impl buffer_impl; static struct wlr_shm_buffer *shm_buffer_from_buffer( struct wlr_buffer *wlr_buffer) { assert(wlr_buffer->impl == &buffer_impl); - return (struct wlr_shm_buffer *)wlr_buffer; + struct wlr_shm_buffer *buffer = wl_container_of(wlr_buffer, buffer, base); + return buffer; } static void buffer_destroy(struct wlr_buffer *wlr_buffer) { |