aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-06-10 16:44:04 +0200
committerdec05eba <dec05eba@protonmail.com>2024-06-10 16:44:04 +0200
commite4832f3d643abf8adf1f5872614b020c833afd0b (patch)
tree28aea0eb7192450aa4a66ec4d78c04ca67d96760
parentc17a717326d2cc1c0576e6dc9f2116e72e38b45a (diff)
Revert "Fix screen capture on intel arc gpu (on x11 and wayland)"
This reverts commit f8453bcaa4b488aea601af632ab5656979eb6024.
-rw-r--r--include/capture/kms.h2
-rw-r--r--src/capture/capture.c8
-rw-r--r--src/capture/kms.c21
-rw-r--r--src/capture/kms_cuda.c2
-rw-r--r--src/capture/kms_vaapi.c2
5 files changed, 24 insertions, 11 deletions
diff --git a/include/capture/kms.h b/include/capture/kms.h
index 0ad7ee6..674813a 100644
--- a/include/capture/kms.h
+++ b/include/capture/kms.h
@@ -44,7 +44,7 @@ struct gsr_capture_kms {
/* Returns 0 on success */
int gsr_capture_kms_start(gsr_capture_kms *self, const char *display_to_capture, gsr_egl *egl, AVCodecContext *video_codec_context, AVFrame *frame);
void gsr_capture_kms_stop(gsr_capture_kms *self);
-bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool cursor_texture_is_external, bool record_cursor);
+bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external, bool record_cursor);
void gsr_capture_kms_cleanup_kms_fds(gsr_capture_kms *self);
#endif /* GSR_CAPTURE_KMS_H */
diff --git a/src/capture/capture.c b/src/capture/capture.c
index 5e1f546..ed7faa9 100644
--- a/src/capture/capture.c
+++ b/src/capture/capture.c
@@ -116,7 +116,8 @@ bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *fram
const int layer = i;
const int plane = 0;
- const uint64_t modifier = prime->objects[prime->layers[layer].object_index[plane]].drm_format_modifier;
+ //const uint64_t modifier = prime->objects[prime->layers[layer].object_index[plane]].drm_format_modifier;
+
const intptr_t img_attr[] = {
EGL_LINUX_DRM_FOURCC_EXT, formats[i],
EGL_WIDTH, prime->width / div[i],
@@ -124,8 +125,9 @@ bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *fram
EGL_DMA_BUF_PLANE0_FD_EXT, prime->objects[prime->layers[layer].object_index[plane]].fd,
EGL_DMA_BUF_PLANE0_OFFSET_EXT, prime->layers[layer].offset[plane],
EGL_DMA_BUF_PLANE0_PITCH_EXT, prime->layers[layer].pitch[plane],
- EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier & 0xFFFFFFFFULL,
- EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier >> 32ULL,
+ // TODO:
+ //EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier & 0xFFFFFFFFULL,
+ //EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier >> 32ULL,
EGL_NONE
};
diff --git a/src/capture/kms.c b/src/capture/kms.c
index c2309d5..40db34b 100644
--- a/src/capture/kms.c
+++ b/src/capture/kms.c
@@ -195,7 +195,7 @@ static vec2i swap_vec2i(vec2i value) {
return value;
}
-bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool cursor_texture_is_external, bool record_cursor) {
+bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external, bool record_cursor) {
//egl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
self->base.egl->glClear(0);
@@ -262,18 +262,29 @@ bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bo
// Error: avcodec_send_frame failed, error: Input/output error
// Assertion pic->display_order == pic->encode_order failed at libavcodec/vaapi_encode_h265.c:765
// kms server info: kms client shutdown, shutting down the server
- const intptr_t img_attr[] = {
+ intptr_t img_attr[18] = {
EGL_LINUX_DRM_FOURCC_EXT, drm_fd->pixel_format,
EGL_WIDTH, drm_fd->width,
EGL_HEIGHT, drm_fd->height,
EGL_DMA_BUF_PLANE0_FD_EXT, drm_fd->fd,
EGL_DMA_BUF_PLANE0_OFFSET_EXT, drm_fd->offset,
EGL_DMA_BUF_PLANE0_PITCH_EXT, drm_fd->pitch,
- EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, drm_fd->modifier & 0xFFFFFFFFULL,
- EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, drm_fd->modifier >> 32ULL,
- EGL_NONE
};
+ if(screen_plane_use_modifiers) {
+ img_attr[12] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
+ img_attr[13] = drm_fd->modifier & 0xFFFFFFFFULL;
+
+ img_attr[14] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
+ img_attr[15] = drm_fd->modifier >> 32ULL;
+
+ img_attr[16] = EGL_NONE;
+ img_attr[17] = EGL_NONE;
+ } else {
+ img_attr[12] = EGL_NONE;
+ img_attr[13] = EGL_NONE;
+ }
+
EGLImage image = self->base.egl->eglCreateImage(self->base.egl->egl_display, 0, EGL_LINUX_DMA_BUF_EXT, NULL, img_attr);
self->base.egl->glBindTexture(GL_TEXTURE_2D, self->base.input_texture);
self->base.egl->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
diff --git a/src/capture/kms_cuda.c b/src/capture/kms_cuda.c
index 003b46d..a9f1f8e 100644
--- a/src/capture/kms_cuda.c
+++ b/src/capture/kms_cuda.c
@@ -85,7 +85,7 @@ static void gsr_capture_kms_unload_cuda_graphics(gsr_capture_kms_cuda *cap_kms)
static int gsr_capture_kms_cuda_capture(gsr_capture *cap, AVFrame *frame) {
gsr_capture_kms_cuda *cap_kms = cap->priv;
- gsr_capture_kms_capture(&cap_kms->kms, frame, cap_kms->params.hdr, true, cap_kms->params.record_cursor);
+ gsr_capture_kms_capture(&cap_kms->kms, frame, cap_kms->params.hdr, true, true, cap_kms->params.record_cursor);
const int div[2] = {1, 2}; // divide UV texture size by 2 because chroma is half size
for(int i = 0; i < 2; ++i) {
diff --git a/src/capture/kms_vaapi.c b/src/capture/kms_vaapi.c
index fb53e5d..a7e8182 100644
--- a/src/capture/kms_vaapi.c
+++ b/src/capture/kms_vaapi.c
@@ -57,7 +57,7 @@ static bool gsr_capture_kms_vaapi_should_stop(gsr_capture *cap, bool *err) {
static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
gsr_capture_kms_vaapi *cap_kms = cap->priv;
- gsr_capture_kms_capture(&cap_kms->kms, frame, cap_kms->params.hdr, false, cap_kms->params.record_cursor);
+ gsr_capture_kms_capture(&cap_kms->kms, frame, cap_kms->params.hdr, false, false, cap_kms->params.record_cursor);
return 0;
}