drm_prime: fallback to drmModeAddFB2

Fallback to drmModeAddFB2 if drmModeAddFB2WithModifiers fails. I've
observed it failing on a pinebook pro running manjaro. We also got "0"
as modifiers from FFmpeg anyway, which might or might not have
something to do with this.

Instead of trying to find the source of the problem, just add this
fallback.
This commit is contained in:
Anton Kindestam 2020-05-04 20:47:38 +02:00
parent 6c04eb0508
commit 9dfcc496a5
1 changed files with 9 additions and 3 deletions

View File

@ -73,10 +73,16 @@ int drm_prime_create_framebuffer(struct mp_log *log, int fd,
modifiers, &framebuffer->fb_id,
DRM_MODE_FB_MODIFIERS);
if (ret < 0) {
mp_err(log, "Failed to create framebuffer on layer %d: %s\n",
0, mp_strerror(errno));
goto fail;
ret = drmModeAddFB2(fd, width, height, layer->format,
handles, pitches, offsets,
&framebuffer->fb_id, 0);
if (ret < 0) {
mp_err(log, "Failed to create framebuffer with drmModeAddFB2 on layer %d: %s\n",
0, mp_strerror(errno));
goto fail;
}
}
for (int plane = 0; plane < AV_DRM_MAX_PLANES; plane++) {
drm_prime_add_handle_ref(handle_refs, framebuffer->gem_handles[plane]);
}