Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
buffer: add missing convert_wl_shm_format_to_drm call
Browse files Browse the repository at this point in the history
Fixes: 27fba3d ("render: use DRM formats in wlr_texture_from_pixels")
Closes: #2757
  • Loading branch information
emersion committed Feb 23, 2021
1 parent 3695ae9 commit c2815fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions types/wlr_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#include "render/shm_format.h"
#include "util/signal.h"

void wlr_buffer_init(struct wlr_buffer *buffer,
Expand Down Expand Up @@ -182,14 +183,15 @@ struct wlr_client_buffer *wlr_client_buffer_import(

struct wl_shm_buffer *shm_buf = wl_shm_buffer_get(resource);
if (shm_buf != NULL) {
enum wl_shm_format fmt = wl_shm_buffer_get_format(shm_buf);
enum wl_shm_format wl_shm_format = wl_shm_buffer_get_format(shm_buf);
uint32_t drm_format = convert_wl_shm_format_to_drm(wl_shm_format);
int32_t stride = wl_shm_buffer_get_stride(shm_buf);
int32_t width = wl_shm_buffer_get_width(shm_buf);
int32_t height = wl_shm_buffer_get_height(shm_buf);

wl_shm_buffer_begin_access(shm_buf);
void *data = wl_shm_buffer_get_data(shm_buf);
texture = wlr_texture_from_pixels(renderer, fmt, stride,
texture = wlr_texture_from_pixels(renderer, drm_format, stride,
width, height, data);
wl_shm_buffer_end_access(shm_buf);

Expand Down

5 comments on commit c2815fd

@vvrein
Copy link

@vvrein vvrein commented on c2815fd Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Yay! Fixed almost everything!
Still no titles though :)
image

@vvrein
Copy link

@vvrein vvrein commented on c2815fd Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After new window opens - sway throw an error

00:01:16.672 [wlr] [render/gles2/texture.c:162] Unsupported pixel format 0x0
00:01:16.672 [wlr] [render/gles2/texture.c:162] Unsupported pixel format 0x0

@emersion
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in swaywm/sway@6634383.

Sorry, that could have been handled better.

@vvrein
Copy link

@vvrein vvrein commented on c2815fd Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇
Yup, fixed! Thank you very much! Sorry for disturbing :)

@emersion
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads-up!

Please sign in to comment.