aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/allocator/drm_dumb.c6
-rw-r--r--render/allocator/gbm.c14
-rw-r--r--render/allocator/shm.c3
-rw-r--r--render/gles2/renderer.c5
-rw-r--r--render/gles2/texture.c3
-rw-r--r--render/pixman/renderer.c6
-rw-r--r--render/vulkan/renderer.c3
-rw-r--r--render/vulkan/texture.c3
8 files changed, 27 insertions, 16 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) {
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 9cbc646e..2b6c04b9 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -45,7 +45,8 @@ bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer) {
assert(wlr_renderer_is_gles2(wlr_renderer));
- return (struct wlr_gles2_renderer *)wlr_renderer;
+ struct wlr_gles2_renderer *renderer = wl_container_of(wlr_renderer, renderer, wlr_renderer);
+ return renderer;
}
static struct wlr_gles2_renderer *gles2_get_renderer_in_context(
@@ -634,7 +635,7 @@ static int gles2_get_render_time(struct wlr_render_timer *wlr_timer) {
}
static void gles2_render_timer_destroy(struct wlr_render_timer *wlr_timer) {
- struct wlr_gles2_render_timer *timer = (struct wlr_gles2_render_timer *)wlr_timer;
+ struct wlr_gles2_render_timer *timer = wl_container_of(wlr_timer, timer, base);
struct wlr_gles2_renderer *renderer = timer->renderer;
struct wlr_egl_context prev_ctx;
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 4f884d73..6cfd103d 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -25,7 +25,8 @@ bool wlr_texture_is_gles2(struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture) {
assert(wlr_texture_is_gles2(wlr_texture));
- return (struct wlr_gles2_texture *)wlr_texture;
+ struct wlr_gles2_texture *texture = wl_container_of(wlr_texture, texture, wlr_texture);
+ return texture;
}
static bool gles2_texture_update_from_buffer(struct wlr_texture *wlr_texture,
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index e7185e56..770f47ca 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -20,7 +20,8 @@ bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer) {
static struct wlr_pixman_renderer *get_renderer(
struct wlr_renderer *wlr_renderer) {
assert(wlr_renderer_is_pixman(wlr_renderer));
- return (struct wlr_pixman_renderer *)wlr_renderer;
+ struct wlr_pixman_renderer *renderer = wl_container_of(wlr_renderer, renderer, wlr_renderer);
+ return renderer;
}
bool begin_pixman_data_ptr_access(struct wlr_buffer *wlr_buffer, pixman_image_t **image_ptr,
@@ -76,7 +77,8 @@ bool wlr_texture_is_pixman(struct wlr_texture *texture) {
static struct wlr_pixman_texture *get_texture(
struct wlr_texture *wlr_texture) {
assert(wlr_texture_is_pixman(wlr_texture));
- return (struct wlr_pixman_texture *)wlr_texture;
+ struct wlr_pixman_texture *texture = wl_container_of(wlr_texture, texture, wlr_texture);
+ return texture;
}
static void texture_destroy(struct wlr_texture *wlr_texture) {
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index 76da79fe..4419cf2c 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -52,7 +52,8 @@ bool wlr_renderer_is_vk(struct wlr_renderer *wlr_renderer) {
struct wlr_vk_renderer *vulkan_get_renderer(struct wlr_renderer *wlr_renderer) {
assert(wlr_renderer_is_vk(wlr_renderer));
- return (struct wlr_vk_renderer *)wlr_renderer;
+ struct wlr_vk_renderer *renderer = wl_container_of(wlr_renderer, renderer, wlr_renderer);
+ return renderer;
}
static struct wlr_vk_render_format_setup *find_or_create_render_setup(
diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c
index 083931ff..a72124d2 100644
--- a/render/vulkan/texture.c
+++ b/render/vulkan/texture.c
@@ -22,7 +22,8 @@ bool wlr_texture_is_vk(struct wlr_texture *wlr_texture) {
struct wlr_vk_texture *vulkan_get_texture(struct wlr_texture *wlr_texture) {
assert(wlr_texture_is_vk(wlr_texture));
- return (struct wlr_vk_texture *)wlr_texture;
+ struct wlr_vk_texture *texture = wl_container_of(wlr_texture, texture, wlr_texture);
+ return texture;
}
static VkImageAspectFlagBits mem_plane_aspect(unsigned i) {