Fix portal capture on intel, support multiple planes in one egl image (might fix capture on intel iris)

This commit is contained in:
dec05eba
2024-07-22 04:58:41 +02:00
parent b077177081
commit b5b4d6b2bd
12 changed files with 397 additions and 214 deletions

View File

@@ -56,8 +56,23 @@ typedef void(*__GLXextFuncPtr)(void);
#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
#define EGL_LINUX_DMA_BUF_EXT 0x3270
#define EGL_RED_SIZE 0x3024
#define EGL_ALPHA_SIZE 0x3021

View File

@@ -9,7 +9,8 @@
#include <spa/param/video/format.h>
#define GSR_PIPEWIRE_MAX_MODIFIERS 1024
#define GSR_PIPEWIRE_NUM_VIDEO_FORMATS 10
#define GSR_PIPEWIRE_NUM_VIDEO_FORMATS 6
#define GSR_PIPEWIRE_DMABUF_MAX_PLANES 4
typedef struct gsr_egl gsr_egl;
@@ -78,7 +79,8 @@ typedef struct {
gsr_pipewire_data_version server_version;
gsr_pipewire_video_info video_info;
gsr_pipewire_dmabuf_data dmabuf_data;
gsr_pipewire_dmabuf_data dmabuf_data[GSR_PIPEWIRE_DMABUF_MAX_PLANES];
size_t dmabuf_num_planes;
bool started;
bool stopped;
@@ -95,7 +97,8 @@ typedef struct {
bool gsr_pipewire_init(gsr_pipewire *self, int pipewire_fd, uint32_t pipewire_node, int fps, bool capture_cursor, gsr_egl *egl);
void gsr_pipewire_deinit(gsr_pipewire *self);
bool gsr_pipewire_map_texture(gsr_pipewire *self, unsigned int texture_id, unsigned int cursor_texture_id, gsr_pipewire_region *region, gsr_pipewire_region *cursor_region, int *plane_fd);
/* |plane_fds| should be at GSR_PIPEWIRE_DMABUF_MAX_PLANES in size */
bool gsr_pipewire_map_texture(gsr_pipewire *self, unsigned int texture_id, unsigned int cursor_texture_id, gsr_pipewire_region *region, gsr_pipewire_region *cursor_region, int *plane_fds, int *num_plane_fds);
bool gsr_pipewire_recording_stopped(gsr_pipewire *self);
#endif /* GSR_PIPEWIRE_H */

View File

@@ -44,4 +44,7 @@ bool gsr_card_path_get_render_path(const char *card_path, char *render_path);
int create_directory_recursive(char *path);
/* |img_attr| needs to be at least 44 in size */
void setup_dma_buf_attrs(intptr_t *img_attr, uint32_t format, uint32_t width, uint32_t height, const int *fds, const uint32_t *offsets, const uint32_t *pitches, const uint64_t *modifiers, int num_planes, bool use_modifier);
#endif /* GSR_UTILS_H */