summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2018-07-01 09:12:52 +0200
committerJan Ekström <jeebjp@gmail.com>2018-09-30 14:22:49 +0300
commit810acf32d6cf0dfbad66c602689ef1218fc0a6e3 (patch)
tree01246af1dba582f684380ee2760c1e90fb63f13f /video
parentf277f9f6d2fe36110aa55b5d606154c629694c7b (diff)
downloadmpv-810acf32d6cf0dfbad66c602689ef1218fc0a6e3.tar.bz2
mpv-810acf32d6cf0dfbad66c602689ef1218fc0a6e3.tar.xz
drm_atomic: Allow to create atomic context w/o drmprime video plane
This is to improve the experience when running with default settings on a driver that doesn't have any overlay planes (or indeed only one plane), but still supports DRM atomic. Since the drmprime video plane is set to pick an overlay plane by default it would fail on these drivers due to not being able to create any atomic context. Users with such cards had to specify --drm-video-plane-id manually to some bogus value (it's not used after all). The "video" plane is only ever used by the drmprime-drm hwdec interop, which is not used at all in the typical usecase where everything is actually rendered on to the "OSD" plane using EGL, so having an atomic context without the "video" plane should be fine most of the time.
Diffstat (limited to 'video')
-rw-r--r--video/out/drm_atomic.c13
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index 5c6b3bbe21..f530d91b66 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -263,21 +263,16 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
mp_verbose(log, "Using default plane %d for video\n", overlay_id);
ctx->video_plane = drm_object_create(log, ctx->fd, overlay_id, DRM_MODE_OBJECT_PLANE);
} else {
- mp_err(log, "Failed to find video plane with id=%d\n", video_plane_id);
- goto fail;
+ mp_verbose(log, "Failed to find video plane with id=%d. drmprime-drm hwdec interop will not work\n", video_plane_id);
}
} else {
mp_verbose(log, "Found video plane with ID %d\n", ctx->video_plane->id);
}
- mp_verbose(log, "Found Video plane with ID %d, OSD with ID %d\n",
- ctx->video_plane->id, ctx->osd_plane->id);
-
drmModeFreePlaneResources(plane_res);
drmModeFreeResources(res);
return ctx;
-
fail:
if (res)
drmModeFreeResources(res);
@@ -301,6 +296,9 @@ void drm_atomic_destroy_context(struct drm_atomic_context *ctx)
static bool drm_atomic_save_plane_state(struct drm_object *plane,
struct drm_atomic_plane_state *plane_state)
{
+ if (!plane)
+ return true;
+
bool ret = true;
if (0 > drm_object_get_property(plane, "FB_ID", &plane_state->fb_id))
@@ -333,6 +331,9 @@ static bool drm_atomic_restore_plane_state(drmModeAtomicReq *request,
struct drm_object *plane,
const struct drm_atomic_plane_state *plane_state)
{
+ if (!plane)
+ return true;
+
bool ret = true;
if (0 > drm_object_set_property(request, plane, "FB_ID", plane_state->fb_id))
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c
index 5e09c5a215..d4543b0f47 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/opengl/hwdec_drmprime_drm.c
@@ -257,6 +257,10 @@ static int init(struct ra_hwdec *hw)
mp_err(p->log, "Failed to retrieve DRM atomic context.\n");
goto err;
}
+ if (!p->ctx->video_plane) {
+ mp_warn(p->log, "No video plane. You might need to specify it manually using --drm-video-plane-id\n");
+ goto err;
+ }
} else {
mp_verbose(p->log, "Failed to retrieve DRM fd from native display.\n");
goto err;