What's the best way to push video from QEMU to GStreamer?

Sorry, my bad this time, use log level 5, that log was moved to 4 very recently.

Sure, but there’s still nothing related to DMA buffers: https://katb.in/sedoyitamus
I guess that’s expected given that it doesn’t work. The question is, why so? My hardware clearly can handle them.

DMABuf is an EGL API, you are running with GLX platform. Also, not all formats a available with OpenGL 3+ API, you need to use GLES2+.

You may want try these env:

export GST_GL_PLATFORM=egl
export GST_GL_API=GLES2

Wayland users don’t have this issue, since these are defaults on Wayland.

1 Like

Thanks, it was actually what I needed.
Now how to deal with the following?

I guess this is related to the fact that I set modifier to linear while in reality it is implicit.

Is there a way to get the real modifier somehow?

Correct, this looks both tiled and compressed (compressed RGB have block wholes). You can re-run the command I gave you to dump the list of supported modifiers, if the list is not empty, you can go trial and error. But the right way is for QEMU not to use implicit modifiers in the first place.

Unfortunately, this is out of my control. What’s even worse is that implicit modifier seems to directly come from eglExportDMABUFImageQueryMESA. I’ve opened an issue about this about 3 days and haven’t got any reply yet.

The following format seem to be supported:

============= All DMA Formats With Modifiers =============
| Gst Format   | DRM Format              | External Flag |
|========================================================|
| (null)       | R8  :0x020000000056bb03 |               |
|              | R8  :0x0200000000401b03 |               |
|              | R8  :0x0200000000401902 |               |
|              | R8  :0x0200000000000a01 |               |
|              | R8  :0x0200000000000901 |               |
|              | R8                      |               |
|--------------------------------------------------------|
| (null)       | R16 :0x020000000056bb03 |               |
|              | R16 :0x0200000000401b03 |               |
|              | R16 :0x0200000000401902 |               |
|              | R16 :0x0200000000000a01 |               |
|              | R16 :0x0200000000000901 |               |
|              | R16                     |               |
|--------------------------------------------------------|
| P010_10LE    | P010:0x0200000000401b03 | external only |
|              | P010:0x0200000000401902 | external only |
|              | P010:0x0200000000000a01 | external only |
|              | P010:0x0200000000000901 | external only |
|              | P010                    | external only |
|--------------------------------------------------------|
| Y210         | Y210:0x020000000056bb03 | external only |
|              | Y210:0x0200000000401b03 | external only |
|              | Y210:0x0200000000401902 | external only |
|              | Y210:0x0200000000000a01 | external only |
|              | Y210:0x0200000000000901 | external only |
|              | Y210                    | external only |
|--------------------------------------------------------|
| Y410         | Y410:0x020000000056bb03 | external only |
|              | Y410:0x0200000000401b03 | external only |
|              | Y410:0x0200000000401902 | external only |
|              | Y410:0x0200000000000901 | external only |
|              | Y410                    | external only |
|--------------------------------------------------------|
| (null)       | P030:0x0200000000401b03 | external only |
|              | P030:0x0200000000401902 | external only |
|              | P030:0x0200000000000a01 | external only |
|              | P030:0x0200000000000901 | external only |
|              | P030                    | external only |
|--------------------------------------------------------|
| (null)       | AB30:0x020000000056bb03 |               |
|              | AB30:0x0200000000401b03 |               |
|              | AB30:0x0200000000401902 |               |
|              | AB30:0x0200000000000901 |               |
|              | AB30                    |               |
|--------------------------------------------------------|
| (null)       | XB30:0x020000000056bb03 |               |
|              | XB30:0x0200000000401b03 |               |
|              | XB30:0x0200000000401902 |               |
|              | XB30:0x0200000000000901 |               |
|              | XB30                    |               |
|--------------------------------------------------------|
| BGR10A2_LE   | AR30:0x020000000056bb03 |               |
|              | AR30:0x0200000000401b03 |               |
|              | AR30:0x0200000000401902 |               |
|              | AR30:0x0200000000000901 |               |
|              | AR30                    |               |
|--------------------------------------------------------|
| (null)       | XR30:0x020000000056bb03 |               |
|              | XR30:0x0200000000401b03 |               |
|              | XR30:0x0200000000401902 |               |
|              | XR30:0x0200000000000901 |               |
|              | XR30                    |               |
|--------------------------------------------------------|
| Y41B         | YU11:0x0200000000401b03 | external only |
|              | YU11:0x0200000000401902 | external only |
|              | YU11:0x0200000000000a01 | external only |
|              | YU11:0x0200000000000901 | external only |
|              | YU11                    | external only |
|--------------------------------------------------------|
| (null)       | YV11:0x0200000000401b03 | external only |
|              | YV11:0x0200000000401902 | external only |
|              | YV11:0x0200000000000a01 | external only |
|              | YV11:0x0200000000000901 | external only |
|              | YV11                    | external only |
|--------------------------------------------------------|
| NV21         | NV21:0x0200000000401b03 | external only |
|              | NV21:0x0200000000401902 | external only |
|              | NV21:0x0200000000000a01 | external only |
|              | NV21:0x0200000000000901 | external only |
|              | NV21                    | external only |
|--------------------------------------------------------|
| P012_LE      | P012:0x0200000000401b03 | external only |
|              | P012:0x0200000000401902 | external only |
|              | P012:0x0200000000000a01 | external only |
|              | P012:0x0200000000000901 | external only |
|              | P012                    | external only |
|--------------------------------------------------------|
| Y212_LE      | Y212:0x020000000056bb03 | external only |
|              | Y212:0x0200000000401b03 | external only |
|              | Y212:0x0200000000401902 | external only |
|              | Y212:0x0200000000000a01 | external only |
|              | Y212:0x0200000000000901 | external only |
|              | Y212                    | external only |
|--------------------------------------------------------|
| Y412_LE      | Y412:0x020000000056bb03 | external only |
|              | Y412:0x0200000000401b03 | external only |
|              | Y412:0x0200000000401902 | external only |
|              | Y412:0x0200000000000a01 | external only |
|              | Y412:0x0200000000000901 | external only |
|              | Y412                    | external only |
|--------------------------------------------------------|
| (null)       | AB12:0x020000000056bb03 |               |
|              | AB12:0x0200000000401b03 |               |
|              | AB12:0x0200000000401902 |               |
|              | AB12:0x0200000000000a01 |               |
|              | AB12:0x0200000000000901 |               |
|              | AB12                    |               |
|--------------------------------------------------------|
| (null)       | AR12:0x020000000056bb03 |               |
|              | AR12:0x0200000000401b03 |               |
|              | AR12:0x0200000000401902 |               |
|              | AR12:0x0200000000000a01 |               |
|              | AR12:0x0200000000000901 |               |
|              | AR12                    |               |
|--------------------------------------------------------|
| I420         | YU12:0x0200000000401b03 | external only |
|              | YU12:0x0200000000401902 | external only |
|              | YU12:0x0200000000000a01 | external only |
|              | YU12:0x0200000000000901 | external only |
|              | YU12                    | external only |
|--------------------------------------------------------|
| NV12         | NV12:0x0200000000401b03 | external only |
|              | NV12:0x0200000000401902 | external only |
|              | NV12:0x0200000000000a01 | external only |
|              | NV12:0x0200000000000901 | external only |
|              | NV12                    | external only |
|--------------------------------------------------------|
| YV12         | YV12:0x0200000000401b03 | external only |
|              | YV12:0x0200000000401902 | external only |
|              | YV12:0x0200000000000a01 | external only |
|              | YV12:0x0200000000000901 | external only |
|              | YV12                    | external only |
|--------------------------------------------------------|
| (null)       | GR32:0x020000000056bb03 |               |
|              | GR32:0x0200000000401b03 |               |
|              | GR32:0x0200000000401902 |               |
|              | GR32:0x0200000000000901 |               |
|              | GR32                    |               |
|--------------------------------------------------------|
| RGBA         | AB24:0x020000000056bb03 |               |
|              | AB24:0x0200000000401b03 |               |
|              | AB24:0x0200000000401902 |               |
|              | AB24:0x0200000000000901 |               |
|              | AB24                    |               |
|--------------------------------------------------------|
| RGBx         | XB24:0x020000000056bb03 |               |
|              | XB24:0x0200000000401b03 |               |
|              | XB24:0x0200000000401902 |               |
|              | XB24:0x0200000000000901 |               |
|              | XB24                    |               |
|--------------------------------------------------------|
| BGRA         | AR24:0x020000000056bb03 |               |
|              | AR24:0x0200000000401b03 |               |
|              | AR24:0x0200000000401902 |               |
|              | AR24:0x0200000000000901 |               |
|              | AR24                    |               |
|--------------------------------------------------------|
| BGRx         | XR24:0x020000000056bb03 |               |
|              | XR24:0x0200000000401b03 |               |
|              | XR24:0x0200000000401902 |               |
|              | XR24:0x0200000000000901 |               |
|              | XR24                    |               |
|--------------------------------------------------------|
| Y444         | YU24:0x0200000000401b03 | external only |
|              | YU24:0x0200000000401902 | external only |
|              | YU24:0x0200000000000a01 | external only |
|              | YU24:0x0200000000000901 | external only |
|              | YU24                    | external only |
|--------------------------------------------------------|
| (null)       | YV24:0x0200000000401b03 | external only |
|              | YV24:0x0200000000401902 | external only |
|              | YV24:0x0200000000000a01 | external only |
|              | YV24:0x0200000000000901 | external only |
|              | YV24                    | external only |
|--------------------------------------------------------|
| (null)       | AB15:0x020000000056bb03 |               |
|              | AB15:0x0200000000401b03 |               |
|              | AB15:0x0200000000401902 |               |
|              | AB15:0x0200000000000a01 |               |
|              | AB15:0x0200000000000901 |               |
|              | AB15                    |               |
|--------------------------------------------------------|
| (null)       | AR15:0x020000000056bb03 |               |
|              | AR15:0x0200000000401b03 |               |
|              | AR15:0x0200000000401902 |               |
|              | AR15:0x0200000000000a01 |               |
|              | AR15:0x0200000000000901 |               |
|              | AR15                    |               |
|--------------------------------------------------------|
| (null)       | P016:0x0200000000401b03 | external only |
|              | P016:0x0200000000401902 | external only |
|              | P016:0x0200000000000a01 | external only |
|              | P016:0x0200000000000901 | external only |
|              | P016                    | external only |
|--------------------------------------------------------|
| (null)       | Y216:0x020000000056bb03 | external only |
|              | Y216:0x0200000000401b03 | external only |
|              | Y216:0x0200000000401902 | external only |
|              | Y216:0x0200000000000a01 | external only |
|              | Y216:0x0200000000000901 | external only |
|              | Y216                    | external only |
|--------------------------------------------------------|
| (null)       | Y416:0x020000000056bb03 | external only |
|              | Y416:0x0200000000401b03 | external only |
|              | Y416:0x0200000000401902 | external only |
|              | Y416:0x0200000000000a01 | external only |
|              | Y416:0x0200000000000901 | external only |
|              | Y416                    | external only |
|--------------------------------------------------------|
| RGB16        | RG16:0x020000000056bb03 |               |
|              | RG16:0x0200000000401b03 |               |
|              | RG16:0x0200000000401902 |               |
|              | RG16:0x0200000000000a01 |               |
|              | RG16:0x0200000000000901 |               |
|              | RG16                    |               |
|--------------------------------------------------------|
| Y42B         | YU16:0x0200000000401b03 | external only |
|              | YU16:0x0200000000401902 | external only |
|              | YU16:0x0200000000000a01 | external only |
|              | YU16:0x0200000000000901 | external only |
|              | YU16                    | external only |
|--------------------------------------------------------|
| NV16         | NV16:0x0200000000401b03 | external only |
|              | NV16:0x0200000000401902 | external only |
|              | NV16:0x0200000000000a01 | external only |
|              | NV16:0x0200000000000901 | external only |
|              | NV16                    | external only |
|--------------------------------------------------------|
| (null)       | YV16:0x0200000000401b03 | external only |
|              | YV16:0x0200000000401902 | external only |
|              | YV16:0x0200000000000a01 | external only |
|              | YV16:0x0200000000000901 | external only |
|              | YV16                    | external only |
|--------------------------------------------------------|
| (null)       | AB48:0x020000000056bb03 |               |
|              | AB48:0x0200000000401b03 |               |
|              | AB48:0x0200000000401902 |               |
|              | AB48:0x0200000000000a01 |               |
|              | AB48:0x0200000000000901 |               |
|              | AB48                    |               |
|--------------------------------------------------------|
| (null)       | XB48:0x020000000056bb03 |               |
|              | XB48:0x0200000000401b03 |               |
|              | XB48:0x0200000000401902 |               |
|              | XB48:0x0200000000000a01 |               |
|              | XB48:0x0200000000000901 |               |
|              | XB48                    |               |
|--------------------------------------------------------|
| (null)       | GR88:0x020000000056bb03 |               |
|              | GR88:0x0200000000401b03 |               |
|              | GR88:0x0200000000401902 |               |
|              | GR88:0x0200000000000a01 |               |
|              | GR88:0x0200000000000901 |               |
|              | GR88                    |               |
|--------------------------------------------------------|
| YVU9         | YVU9:0x0200000000401b03 | external only |
|              | YVU9:0x0200000000401902 | external only |
|              | YVU9:0x0200000000000a01 | external only |
|              | YVU9:0x0200000000000901 | external only |
|              | YVU9                    | external only |
|--------------------------------------------------------|
| YUV9         | YUV9:0x0200000000401b03 | external only |
|              | YUV9:0x0200000000401902 | external only |
|              | YUV9:0x0200000000000a01 | external only |
|              | YUV9:0x0200000000000901 | external only |
|              | YUV9                    | external only |
|--------------------------------------------------------|
| (null)       | AB4H:0x020000000056bb03 |               |
|              | AB4H:0x0200000000401b03 |               |
|              | AB4H:0x0200000000401902 |               |
|              | AB4H:0x0200000000000a01 |               |
|              | AB4H:0x0200000000000901 |               |
|              | AB4H                    |               |
|--------------------------------------------------------|
| (null)       | XB4H:0x020000000056bb03 |               |
|              | XB4H:0x0200000000401b03 |               |
|              | XB4H:0x0200000000401902 |               |
|              | XB4H:0x0200000000000a01 |               |
|              | XB4H:0x0200000000000901 |               |
|              | XB4H                    |               |
|--------------------------------------------------------|
| YVYU         | YVYU:0x020000000056bb03 | external only |
|              | YVYU:0x0200000000401b03 | external only |
|              | YVYU:0x0200000000401902 | external only |
|              | YVYU:0x0200000000000901 | external only |
|              | YVYU                    | external only |
|--------------------------------------------------------|
| VUYA         | AYUV:0x020000000056bb03 | external only |
|              | AYUV:0x0200000000401b03 | external only |
|              | AYUV:0x0200000000401902 | external only |
|              | AYUV:0x0200000000000a01 | external only |
|              | AYUV:0x0200000000000901 | external only |
|              | AYUV                    | external only |
|--------------------------------------------------------|
| (null)       | XYUV:0x020000000056bb03 | external only |
|              | XYUV:0x0200000000401b03 | external only |
|              | XYUV:0x0200000000401902 | external only |
|              | XYUV:0x0200000000000a01 | external only |
|              | XYUV:0x0200000000000901 | external only |
|              | XYUV                    | external only |
|--------------------------------------------------------|
| YUY2         | YUYV:0x020000000056bb03 | external only |
|              | YUYV:0x0200000000401b03 | external only |
|              | YUYV:0x0200000000401902 | external only |
|              | YUYV:0x0200000000000901 | external only |
|              | YUYV                    | external only |
|--------------------------------------------------------|
| VYUY         | VYUY:0x020000000056bb03 | external only |
|              | VYUY:0x0200000000401b03 | external only |
|              | VYUY:0x0200000000401902 | external only |
|              | VYUY:0x0200000000000901 | external only |
|              | VYUY                    | external only |
|--------------------------------------------------------|
| UYVY         | UYVY:0x020000000056bb03 | external only |
|              | UYVY:0x0200000000401b03 | external only |
|              | UYVY:0x0200000000401902 | external only |
|              | UYVY:0x0200000000000901 | external only |
|              | UYVY                    | external only |
==========================================================

I’ve tried changing modifier to 0x0200000000000901, 0x0200000000401902, 0x0200000000401b03 and 0x020000000056bb03, but all of them lead to error out with Failed to upload buffer

GL stack only have pretty generic errors, you’ll likely find out why the buffer is rejected by walking the code with a debugger. One guess for which you may give it a try, sometimes modifiers introduce extra planes, perhaps the number of planes must be set to 2 ?

This extract from drm_fourcc.h aligns with my wild guess:

/*
 * AMD modifiers
 *
 * Memory layout:
 *
 * without DCC:
 *   - main surface
 *
 * with DCC & without DCC_RETILE:
 *   - main surface in plane 0
 *   - DCC surface in plane 1 (RB-aligned, pipe-aligned if DCC_PIPE_ALIGN is set)
 *
 * with DCC & DCC_RETILE:
 *   - main surface in plane 0
 *   - displayable DCC surface in plane 1 (not RB-aligned & not pipe-aligned)
 *   - pipe-aligned DCC surface in plane 2 (RB-aligned & pipe-aligned)
 *
 * For multi-plane formats the above surfaces get merged into one plane for
 * each format plane, based on the required alignment only.

I don’t think so, QEMU demands 1 plane:

But you’re kind of correct here. Number of planes could be the issue:

0:00:00.221986789 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Dmabuf Passthrough
0:00:00.221990075 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader GLMemory
0:00:00.221993061 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader DirectDmabuf
0:00:00.221996627 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:129:gst_meta_api_type_register: register API "GstVideoMetaAPI"
0:00:00.222000094 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:136:gst_meta_api_type_register:   adding tag "video"
0:00:00.222004392 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:136:gst_meta_api_type_register:   adding tag "memory"
0:00:00.222008279 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:136:gst_meta_api_type_register:   adding tag "colorspace"
0:00:00.222011876 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:136:gst_meta_api_type_register:   adding tag "size"
0:00:00.222016325 484141 0x780ea0000b90 DEBUG               GST_META gstmeta.c:551:gst_meta_info_register: register "GstVideoMeta" implementing "GstVideoMetaAPI" of size 144
0:00:00.222021755 484141 0x780ea0000b90 DEBUG               glupload gstglupload.c:1535:_dma_buf_upload_accept:<glupload0> number of memory (1) != number of planes (0)
0:00:00.222024680 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader DirectDmabufExternal
0:00:00.222029459 484141 0x780ea0000b90 DEBUG               glupload gstglupload.c:1535:_dma_buf_upload_accept:<glupload0> number of memory (1) != number of planes (0)
0:00:00.222032255 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Dmabuf
0:00:00.222035371 484141 0x780ea0000b90 DEBUG               glupload gstglupload.c:1508:_dma_buf_upload_accept:<glupload0> Indirect uploads are only support for linear formats.
0:00:00.222038106 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader UploadMeta
0:00:00.222041292 484141 0x780ea0000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Raw Data

Apparently, it’s 0 for some reason.

Not sure why it isn’t a problem for linear format though.

That gives me the hint that you didn’t add a video meta, which is strictly required for DMABuf sharing (since we support modifiers in an opaque way). We should have detected it in the uploader, but its a bit generic and ended doing something weird instead (n_planes being 0).

This is optional if you don’t have special stride with video/x-raw, but it always needed when you use video/x-raw(memory:DMABuf). We don’t try and guess the missing information in the second case.

Before passing buffers to appsrc, so something similar to:

// TODO if you get an offset from qemu, use it
gsize offset[4] = { 0, };
gint stride[4] = { pitch, };
gst_buffer_add_video_meta_full (buffer,
                                GST_VIDEO_FRAME_FLAG_NONE,
                                gst_video_dma_drm_fourcc_to_format (fourcc),
                                with, height, n_planes, offset, stride);
1 Like

I looked into Mesa code, if you look at si_texture_create() (which I believe is the path when a texture is created without a specific storage), DRM_FORMAT_MOD_INVALID is passed to the common function. That will later call si_init_surface() which will then select the best flag for the GPU architecture detected. But they don’t translate back the chosen flags into a modifier, and simply save DRM_FORMAT_MOD_INVALID. So when you use the MESA extension to query for the format and modifier you actually get “invalid modifier” even though modifier support is in place. This seems like a bug to me.

And this issue was already reported by GTK4 developpers here. There, Marek reports that the list of modifiers the EGL query returns may not cover the modifier actually used internally (as they have millions of possible combination).

1 Like

Thanks, that worked much better!
But 0x020000000056bb03 is still failing:

0:00:00.061950980 541208 0x7466b4000b90 INFO                 basesrc gstbasesrc.c:3068:gst_base_src_loop:<src> marking pending DISCONT
0:00:00.061958504 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Dmabuf Passthrough
0:00:00.061962492 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader GLMemory
0:00:00.061966059 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader DirectDmabuf
0:00:00.061981949 541208 0x7466b4000b90 WARN              gleglimage gsteglimage.c:994:gst_egl_image_from_dmabuf_direct_target_with_dma_drm: eglCreateImage failed: EGL_BAD_MATCH
0:00:00.061985616 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader DirectDmabufExternal
0:00:00.061994282 541208 0x7466b4000b90 WARN              gleglimage gsteglimage.c:994:gst_egl_image_from_dmabuf_direct_target_with_dma_drm: eglCreateImage failed: EGL_BAD_MATCH
0:00:00.061997428 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Dmabuf
0:00:00.062000885 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader UploadMeta
0:00:00.062004361 541208 0x7466b4000b90 INFO                glupload gstglupload.c:3518:_upload_find_method:<glupload0> attempting upload with uploader Raw Data
0:00:00.062009821 541208 0x7466b4000b90 WARN         gluploadelement gstgluploadelement.c:313:gst_gl_upload_element_prepare_output_buffer:<gluploadelement0> error: Failed to upload buffer

And other three show basically the same picture:

Picture also seems to have y inverted, which is expected, so I’ve added glupload ! glviewconvert input-flags-override=left-flipped input-mode-override=left to the pipeline and it appears to have the correct orientation (glvideoflip video-direction=vert does not work though, glimagesink windows isn’t even opened with that).

Performance is much better too, but the picture is still garbled.

In addition, I’ve also tried to also add video post-processing on the CPU (as one of the things I’ll need to do in the future is to encode it, potentially with different plugins) with the following pipeline:

appsrc format=time do-timestamp=true stream-type=stream is-live=true name=src ! glupload ! gldownload ! video/x-raw ! videoflip video-direction=vert ! glimagesink

But the picture is basically always just black:

I guess this is the same as your two years old (ouch!) issue.

Was there any progress on that?

Someone have to get his hand dirty. My understanding is that there is a translation from addrlib flags to the modifiers. But to use a modifier it has to be enumerated through another GL extension, meaning we need to find all the values that may be exported. Marek was saying for all GPU, but I don’t see why this has to be done in one go.

Actually, some work has been done already mainline, and is https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31658 that aligns with your needs. Perhaps you can try that? mesa is like GStreamer, you can build and test the same way:

meson setup build
cd build
ninja
meson devenv

I’ve tried and it’s just broken. Reported there

So maybe it’s time to reconsider the decision not to support implicit modifiers? It’s just not possible to get explicit ones as of now on AMD and it’ll probably be many months before they’ll become available.

I’m fine with some kind of environment variable that enables them as a workaround, i.e. GST_ENABLE_IMPLICIT_DRM_MODIFIERS=1 and a huge warning like Implicit modifiers are known to not work reliably, make sure you know what you're doing.

If its under an env that is acceptable. We tried for general playback in the past, and it was a big hit and miss. For your case, you just want glupload support, you may want to start from there and propose a patch. But remember, software using that will not always work. To work, you to know exactly which GPU have exported it, and you must use a similar GL configuration. After all, AMD call this the “optimal” modifier, meaning they don’t actually save the details, they just assume it will be guessed correctly when re-imported.

Looks like it somewhat worked. I’ve opened MR here: gl: Add environment variable to allow implicit modifiers to be used (!8213) · Merge requests · GStreamer / gstreamer · GitLab

I’m still getting just black screen sometimes though, but restart usually fixes that.