mirror of
https://github.com/mpv-player/mpv
synced 2025-02-07 23:51:49 +00:00
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.
This commit is contained in:
parent
f277f9f6d2
commit
810acf32d6
@ -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))
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user