summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Kroeger <svenni.kroeger@gmail.com>2020-03-02 16:22:10 +0100
committerAnton Kindestam <antonki@kth.se>2020-03-03 19:54:15 +0100
commit8b24510388c7af223ecdfd8ebe242be315424eaf (patch)
tree338815c240ed15116ef7c9b75735f213371ba509
parent24acddbdc4e18dd053ae873abc5764bea484d38d (diff)
downloadmpv-8b24510388c7af223ecdfd8ebe242be315424eaf.tar.bz2
mpv-8b24510388c7af223ecdfd8ebe242be315424eaf.tar.xz
drm_prime: forward modifiers from FFMPEG to drm API
* Change drmModeAddFB2 to drmModeAddFB2WithModifiers * Set modifiers flag in API call * fetch and set modifiers according to kernel constraints
-rw-r--r--video/out/drm_prime.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/video/out/drm_prime.c b/video/out/drm_prime.c
index 253fbb6c40..8eccb529a0 100644
--- a/video/out/drm_prime.c
+++ b/video/out/drm_prime.c
@@ -18,6 +18,7 @@
#include <unistd.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <drm_mode.h>
#include "common/msg.h"
#include "drm_common.h"
@@ -28,6 +29,7 @@ int drm_prime_create_framebuffer(struct mp_log *log, int fd, AVDRMFrameDescripto
{
AVDRMLayerDescriptor *layer = NULL;
uint32_t pitches[4], offsets[4], handles[4];
+ uint64_t modifiers[4];
int ret, layer_fd;
if (descriptor && descriptor->nb_layers) {
@@ -39,6 +41,9 @@ int drm_prime_create_framebuffer(struct mp_log *log, int fd, AVDRMFrameDescripto
mp_err(log, "Failed to retrieve the Prime Handle from handle %d (%d).\n", object, descriptor->objects[object].fd);
goto fail;
}
+ if(object == 0) {
+ modifiers[object] = descriptor->objects[object].format_modifier;
+ }
}
layer = &descriptor->layers[0];
@@ -49,15 +54,17 @@ int drm_prime_create_framebuffer(struct mp_log *log, int fd, AVDRMFrameDescripto
pitches[plane] = layer->planes[plane].pitch;
offsets[plane] = layer->planes[plane].offset;
handles[plane] = layer_fd;
+ modifiers[plane] = modifiers[0];
} else {
pitches[plane] = 0;
offsets[plane] = 0;
handles[plane] = 0;
+ modifiers[plane] = 0;
}
}
- ret = drmModeAddFB2(fd, width, height, layer->format,
- handles, pitches, offsets, &framebuffer->fb_id, 0);
+ ret = drmModeAddFB2WithModifiers(fd, width, height, layer->format,
+ handles, pitches, offsets, modifiers, &framebuffer->fb_id, DRM_MODE_FB_MODIFIERS);
if (ret < 0) {
mp_err(log, "Failed to create framebuffer on layer %d.\n", 0);
goto fail;