aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--DOCS/client-api-changes.rst3
-rw-r--r--DOCS/interface-changes.rst11
-rw-r--r--DOCS/man/vo.rst50
-rw-r--r--libmpv/client.h2
-rw-r--r--libmpv/render.h12
-rw-r--r--libmpv/render_gl.h11
-rw-r--r--video/out/drm_atomic.c58
-rw-r--r--video/out/drm_atomic.h10
-rw-r--r--video/out/drm_common.c19
-rw-r--r--video/out/drm_common.h8
-rw-r--r--video/out/gpu/libmpv_gpu.c6
-rw-r--r--video/out/opengl/context_drm_egl.c76
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c64
-rw-r--r--video/out/vo_drm.c4
14 files changed, 187 insertions, 147 deletions
diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst
index cb80d0a698..6197e48a39 100644
--- a/DOCS/client-api-changes.rst
+++ b/DOCS/client-api-changes.rst
@@ -31,6 +31,9 @@ API changes
===========
::
+ --- mpv 0.30.0 ---
+ 1.102 - rename struct mpv_opengl_drm_osd_size to mpv_opengl_drm_draw_surface_size
+ - rename MPV_RENDER_PARAM_DRM_OSD_SIZE to MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE
--- mpv 0.29.0 ---
1.101 - add MPV_RENDER_PARAM_ADVANCED_CONTROL and related API
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index f7ed1597ab..26f39beba7 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -20,9 +20,16 @@ Interface changes
::
--- mpv 0.30.0 ---
- - the `--drm-osd-plane-id` and `--drm-video-plane-id`
+ - rename `--drm-osd-plane-id` to `--drm-draw-plane`, `--drm-video-plane-id` to
+ `--drm-drmprime-video-plane` and `--drm-osd-size` to `--drm-draw-surface-size`
+ to better reflect what the options actually control, that the values they
+ accept aren't actually internal DRM ID's (like with similar options in
+ ffmpeg's KMS support), and that the video plane is only used when the drmprime
+ overlay hwdec interop is active, with the video being drawn to the draw plane
+ otherwise.
+ - in addition to the above, the `--drm-draw-plane` and `--drm-drmprime-video-plane`
options now accept either an integer index, or the values primary or overlay.
- `--drm-osd-plane-id` now defaults to primary and `--drm-video-plane-id`
+ `--drm-draw-plane` now defaults to primary and `--drm-drmprime-video-plane`
defaults to overlay. This should be similar to previous behavior on most drivers
due to how planes are usually sorted.
- rename --opensles-frames-per-buffer to --opensles-frames-per-enqueue to
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index a3cc328b1d..69e4341b44 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -488,21 +488,28 @@ Available video output drivers are:
Mode ID to use (resolution and frame rate).
(default: 0)
- ``--drm-osd-plane-id=<primary|overlay|N>``
- Select the DRM plane to use for OSD (or OSD and video). The plane can be
- specified as ``primary``, which will pick the first applicable primary
- plane; ``overlay``, which will pick the first applicable overlay plane;
- or by index. The index is zero based, and related to the CRTC. When using
- this option with the drm_prime renderer, it will only affect the OSD
- contents. Otherwise it will set OSD & video plane.
+ ``--drm-draw-plane=<primary|overlay|N>``
+ Select the DRM plane to which video and OSD is drawn to, under normal
+ circumstances. The plane can be specified as ``primary``, which will
+ pick the first applicable primary plane; ``overlay``, which will pick
+ the first applicable overlay plane; or by index. The index is zero
+ based, and related to the CRTC.
(default: primary)
- ``--drm-video-plane-id=<primary|overlay|N>``
- Select the DRM plane index to use for video layer. This option accepts
- the same values as ``--drm-osd-plane-id``. This option has an effect
- only when using the drm_prime renderer (which supports several layers)
- together with ``vo=gpu`` and ``gpu-context=drm``.
- (default: overlay)
+ When using this option with the drmprime-drm hwdec interop, only the OSD
+ is rendered to this plane.
+
+ ``--drm-drmprime-video-plane=<primary|overlay|N>``
+ Select the DRM plane to use for video with the drmprime-drm hwdec
+ interop (used by e.g. the rkmpp hwdec on RockChip SoCs, and v4l2 hwdec:s
+ on various other SoC:s). The plane is unused otherwise. This option
+ accepts the same values as ``--drm-draw-plane``. (default: overlay)
+
+ To be able to successfully play 4K video on various SoCs you might need
+ to set ``--drm-draw-plane=overlay --drm-drmprime-video-plane=primary``
+ and setting ``--drm-draw-surface-size=1920x1080``, to render the OSD at a
+ lower resolution (the video when handled by the hwdec will be on the
+ drmprime-video plane and at full 4K resolution)
``--drm-format=<xrgb8888|xrgb2101010>``
Select the DRM format to use (default: xrgb8888). This allows you to
@@ -517,11 +524,18 @@ Available video output drivers are:
This currently only has an effect when used together with the ``drm``
backend for the ``gpu`` VO. The ``drm`` VO always uses xrgb8888.
- ``--drm-osd-size=<[WxH]>``
- Sets the OSD OpenGL size to the specified size. OSD will then be upscaled
- to the current screen resolution. This option can be useful when using
- several layers in high resolutions with a GPU which cannot handle it.
- Note : this option is only available with DRM atomic support.
+ ``--drm-draw-surface-size=<[WxH]>``
+ Sets the size of the surface used on the draw plane. The surface will
+ then be upscaled to the current screen resolution. This option can be
+ useful when used together with the drmprime-drm hwdec interop at high
+ resolutions, as it allows scaling the draw plane (which in this case
+ only handles the OSD) down to a size the GPU can handle.
+
+ When used without the drmprime-drm hwdec interop this option will just
+ cause the video to get rendered at a different resolution and then
+ scaled to screen size.
+
+ Note: this option is only available with DRM atomic support.
(default: display resolution)
``mediacodec_embed`` (Android)
diff --git a/libmpv/client.h b/libmpv/client.h
index 488ccb332c..39df20a8c0 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -210,7 +210,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 101)
+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 102)
/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
diff --git a/libmpv/render.h b/libmpv/render.h
index 253b2b43f9..304a21a932 100644
--- a/libmpv/render.h
+++ b/libmpv/render.h
@@ -283,14 +283,20 @@ typedef enum mpv_render_param_type {
*/
MPV_RENDER_PARAM_DRM_DISPLAY = 14,
/**
- * DRM osd size, contains osd dimensions.
+ * DRM draw surface size, contains draw surface dimensions.
* Valid for mpv_render_context_create().
- * Type : struct mpv_opengl_drm_osd_size*
+ * Type : struct mpv_opengl_drm_draw_surface_size*
*/
- MPV_RENDER_PARAM_DRM_OSD_SIZE = 15,
+ MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE = 15,
} mpv_render_param_type;
/**
+ * For backwards compatibility with the old naming of
+ * MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE
+ */
+#define MPV_RENDER_PARAM_DRM_OSD_SIZE MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE
+
+/**
* Used to pass arbitrary parameters to some mpv_render_* functions. The
* meaning of the data parameter is determined by the type, and each
* MPV_RENDER_PARAM_* documents what type the value must point to.
diff --git a/libmpv/render_gl.h b/libmpv/render_gl.h
index 4d771f2958..690b126906 100644
--- a/libmpv/render_gl.h
+++ b/libmpv/render_gl.h
@@ -177,12 +177,17 @@ typedef struct mpv_opengl_drm_params {
int render_fd;
} mpv_opengl_drm_params;
-typedef struct mpv_opengl_drm_osd_size {
+typedef struct mpv_opengl_drm_draw_surface_size {
/**
- * size of the OSD in pixels.
+ * size of the draw plane surface in pixels.
*/
int width, height;
-} mpv_opengl_drm_osd_size;
+} mpv_opengl_drm_draw_surface_size;
+
+/**
+ * For backwards compatibility with the old naming of mpv_opengl_drm_draw_surface_size
+ */
+#define mpv_opengl_drm_osd_size mpv_opengl_drm_draw_surface_size
#ifdef __cplusplus
}
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index fea8ffa88e..51b3da89c6 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -139,7 +139,7 @@ void drm_object_print_info(struct mp_log *log, struct drm_object *object)
struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd, int crtc_id,
int connector_id,
- int osd_plane_idx, int video_plane_idx)
+ int draw_plane_idx, int drmprime_video_plane_idx)
{
drmModePlaneRes *plane_res = NULL;
drmModeRes *res = NULL;
@@ -229,13 +229,13 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
if ((!overlay_id) && (value == DRM_PLANE_TYPE_OVERLAY))
overlay_id = plane_id;
- if (layercount == osd_plane_idx) {
- ctx->osd_plane = plane;
+ if (layercount == draw_plane_idx) {
+ ctx->draw_plane = plane;
continue;
}
- if (layercount == video_plane_idx) {
- ctx->video_plane = plane;
+ if (layercount == drmprime_video_plane_idx) {
+ ctx->drmprime_video_plane = plane;
continue;
}
}
@@ -245,34 +245,34 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
}
}
- // OSD plane was specified as either of the special options: any primary plane or any overlay plane
- if (!ctx->osd_plane) {
- const int osd_plane_id = (osd_plane_idx == DRM_OPTS_OVERLAY_PLANE) ? overlay_id : primary_id;
- const char *plane_type = (osd_plane_idx == DRM_OPTS_OVERLAY_PLANE) ? "overlay" : "primary";
- if (osd_plane_id) {
- mp_verbose(log, "Using %s plane %d for OSD\n", plane_type, osd_plane_id);
- ctx->osd_plane = drm_object_create(log, ctx->fd, osd_plane_id, DRM_MODE_OBJECT_PLANE);
+ // draw plane was specified as either of the special options: any primary plane or any overlay plane
+ if (!ctx->draw_plane) {
+ const int draw_plane_id = (draw_plane_idx == DRM_OPTS_OVERLAY_PLANE) ? overlay_id : primary_id;
+ const char *plane_type = (draw_plane_idx == DRM_OPTS_OVERLAY_PLANE) ? "overlay" : "primary";
+ if (draw_plane_id) {
+ mp_verbose(log, "Using %s plane %d as draw plane\n", plane_type, draw_plane_id);
+ ctx->draw_plane = drm_object_create(log, ctx->fd, draw_plane_id, DRM_MODE_OBJECT_PLANE);
} else {
- mp_err(log, "Failed to find OSD plane with idx=%d\n", osd_plane_idx);
+ mp_err(log, "Failed to find draw plane with idx=%d\n", draw_plane_idx);
goto fail;
}
} else {
- mp_verbose(log, "Found OSD plane with ID %d\n", ctx->osd_plane->id);
+ mp_verbose(log, "Found draw plane with ID %d\n", ctx->draw_plane->id);
}
- // video plane was specified as either of the special options: any primary plane or any overlay plane
- if (!ctx->video_plane) {
- const int video_plane_id = (video_plane_idx == DRM_OPTS_PRIMARY_PLANE) ? primary_id : overlay_id;
- const char *plane_type = (video_plane_idx == DRM_OPTS_PRIMARY_PLANE) ? "primary" : "overlay";
+ // drmprime plane was specified as either of the special options: any primary plane or any overlay plane
+ if (!ctx->drmprime_video_plane) {
+ const int drmprime_video_plane_id = (drmprime_video_plane_idx == DRM_OPTS_PRIMARY_PLANE) ? primary_id : overlay_id;
+ const char *plane_type = (drmprime_video_plane_idx == DRM_OPTS_PRIMARY_PLANE) ? "primary" : "overlay";
- if (video_plane_id) {
- mp_verbose(log, "Using %s plane %d for video\n", plane_type, video_plane_id);
- ctx->video_plane = drm_object_create(log, ctx->fd, video_plane_id, DRM_MODE_OBJECT_PLANE);
+ if (drmprime_video_plane_id) {
+ mp_verbose(log, "Using %s plane %d as drmprime plane\n", plane_type, drmprime_video_plane_id);
+ ctx->drmprime_video_plane = drm_object_create(log, ctx->fd, drmprime_video_plane_id, DRM_MODE_OBJECT_PLANE);
} else {
- mp_verbose(log, "Failed to find video plane with idx=%d. drmprime-drm hwdec interop will not work\n", video_plane_idx);
+ mp_verbose(log, "Failed to find drmprime plane with idx=%d. drmprime-drm hwdec interop will not work\n", drmprime_video_plane_idx);
}
} else {
- mp_verbose(log, "Found video plane with ID %d\n", ctx->video_plane->id);
+ mp_verbose(log, "Found drmprime plane with ID %d\n", ctx->drmprime_video_plane->id);
}
drmModeFreePlaneResources(plane_res);
@@ -294,8 +294,8 @@ void drm_atomic_destroy_context(struct drm_atomic_context *ctx)
drm_mode_destroy_blob(ctx->fd, &ctx->old_state.crtc.mode);
drm_object_free(ctx->crtc);
drm_object_free(ctx->connector);
- drm_object_free(ctx->osd_plane);
- drm_object_free(ctx->video_plane);
+ drm_object_free(ctx->draw_plane);
+ drm_object_free(ctx->drmprime_video_plane);
talloc_free(ctx);
}
@@ -387,9 +387,9 @@ bool drm_atomic_save_old_state(struct drm_atomic_context *ctx)
if (0 > drm_object_get_property(ctx->connector, "CRTC_ID", &ctx->old_state.connector.crtc_id))
ret = false;
- if (!drm_atomic_save_plane_state(ctx->osd_plane, &ctx->old_state.osd_plane))
+ if (!drm_atomic_save_plane_state(ctx->draw_plane, &ctx->old_state.draw_plane))
ret = false;
- if (!drm_atomic_save_plane_state(ctx->video_plane, &ctx->old_state.video_plane))
+ if (!drm_atomic_save_plane_state(ctx->drmprime_video_plane, &ctx->old_state.drmprime_video_plane))
ret = false;
ctx->old_state.saved = true;
@@ -414,9 +414,9 @@ bool drm_atomic_restore_old_state(drmModeAtomicReqPtr request, struct drm_atomic
if (0 > drm_object_set_property(request, ctx->crtc, "ACTIVE", ctx->old_state.crtc.active))
ret = false;
- if (!drm_atomic_restore_plane_state(request, ctx->osd_plane, &ctx->old_state.osd_plane))
+ if (!drm_atomic_restore_plane_state(request, ctx->draw_plane, &ctx->old_state.draw_plane))
ret = false;
- if (!drm_atomic_restore_plane_state(request, ctx->video_plane, &ctx->old_state.video_plane))
+ if (!drm_atomic_restore_plane_state(request, ctx->drmprime_video_plane, &ctx->old_state.drmprime_video_plane))
ret = false;
ctx->old_state.saved = false;
diff --git a/video/out/drm_atomic.h b/video/out/drm_atomic.h
index bfbec2bde2..5b2dc5976d 100644
--- a/video/out/drm_atomic.h
+++ b/video/out/drm_atomic.h
@@ -57,8 +57,8 @@ struct drm_atomic_state {
struct drm_mode mode;
uint64_t active;
} crtc;
- struct drm_atomic_plane_state osd_plane;
- struct drm_atomic_plane_state video_plane;
+ struct drm_atomic_plane_state draw_plane;
+ struct drm_atomic_plane_state drmprime_video_plane;
};
struct drm_object {
@@ -74,8 +74,8 @@ struct drm_atomic_context {
struct drm_object *crtc;
struct drm_object *connector;
- struct drm_object *osd_plane;
- struct drm_object *video_plane;
+ struct drm_object *draw_plane;
+ struct drm_object *drmprime_video_plane;
drmModeAtomicReq *request;
@@ -92,7 +92,7 @@ struct drm_object * drm_object_create(struct mp_log *log, int fd, uint32_t objec
void drm_object_free(struct drm_object *object);
void drm_object_print_info(struct mp_log *log, struct drm_object *object);
struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd, int crtc_id, int connector_id,
- int osd_plane_idx, int video_plane_idx);
+ int draw_plane_idx, int drmprime_video_plane_idx);
void drm_atomic_destroy_context(struct drm_atomic_context *ctx);
bool drm_atomic_save_old_state(struct drm_atomic_context *ctx);
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index 647d545eb9..2971d77094 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -48,21 +48,25 @@ const struct m_sub_options drm_conf = {
OPT_STRING_VALIDATE("drm-connector", drm_connector_spec,
0, drm_validate_connector_opt),
OPT_INT("drm-mode", drm_mode_id, 0),
- OPT_CHOICE_OR_INT("drm-osd-plane-id", drm_osd_plane_id, 0, 0, INT_MAX,
+ OPT_CHOICE_OR_INT("drm-draw-plane", drm_draw_plane, 0, 0, INT_MAX,
({"primary", DRM_OPTS_PRIMARY_PLANE},
{"overlay", DRM_OPTS_OVERLAY_PLANE})),
- OPT_CHOICE_OR_INT("drm-video-plane-id", drm_video_plane_id, 0, 0, INT_MAX,
+ OPT_CHOICE_OR_INT("drm-drmprime-video-plane", drm_drmprime_video_plane, 0, 0, INT_MAX,
({"primary", DRM_OPTS_PRIMARY_PLANE},
{"overlay", DRM_OPTS_OVERLAY_PLANE})),
OPT_CHOICE("drm-format", drm_format, 0,
({"xrgb8888", DRM_OPTS_FORMAT_XRGB8888},
{"xrgb2101010", DRM_OPTS_FORMAT_XRGB2101010})),
- OPT_SIZE_BOX("drm-osd-size", drm_osd_size, 0),
+ OPT_SIZE_BOX("drm-draw-surface-size", drm_draw_surface_size, 0),
+
+ OPT_REPLACED("drm-osd-plane-id", "drm-draw-plane"),
+ OPT_REPLACED("drm-video-plane-id", "drm-drmprime-video-plane"),
+ OPT_REPLACED("drm-osd-size", "drm-draw-surface-size"),
{0},
},
.defaults = &(const struct drm_opts) {
- .drm_osd_plane_id = DRM_OPTS_PRIMARY_PLANE,
- .drm_video_plane_id = DRM_OPTS_OVERLAY_PLANE,
+ .drm_draw_plane = DRM_OPTS_PRIMARY_PLANE,
+ .drm_drmprime_video_plane = DRM_OPTS_OVERLAY_PLANE,
},
.size = sizeof(struct drm_opts),
};
@@ -274,7 +278,7 @@ static void parse_connector_spec(struct mp_log *log,
struct kms *kms_create(struct mp_log *log, const char *connector_spec,
- int mode_id, int osd_plane_id, int video_plane_id)
+ int mode_id, int draw_plane, int drmprime_video_plane)
{
int card_no = -1;
char *connector_name = NULL;
@@ -322,7 +326,8 @@ struct kms *kms_create(struct mp_log *log, const char *connector_spec,
} else {
mp_verbose(log, "DRM Atomic support found\n");
kms->atomic_context = drm_atomic_create_context(kms->log, kms->fd, kms->crtc_id,
- kms->connector->connector_id, osd_plane_id, video_plane_id);
+ kms->connector->connector_id,
+ draw_plane, drmprime_video_plane);
if (!kms->atomic_context) {
mp_err(log, "Failed to create DRM atomic context\n");
goto err;
diff --git a/video/out/drm_common.h b/video/out/drm_common.h
index 3f144102ec..d9f086cd4e 100644
--- a/video/out/drm_common.h
+++ b/video/out/drm_common.h
@@ -48,10 +48,10 @@ struct vt_switcher {
struct drm_opts {
char *drm_connector_spec;
int drm_mode_id;
- int drm_osd_plane_id;
- int drm_video_plane_id;
+ int drm_draw_plane;
+ int drm_drmprime_video_plane;
int drm_format;
- struct m_geometry drm_osd_size;
+ struct m_geometry drm_draw_surface_size;
};
bool vt_switcher_init(struct vt_switcher *s, struct mp_log *log);
@@ -65,7 +65,7 @@ void vt_switcher_release(struct vt_switcher *s, void (*handler)(void*),
void *user_data);
struct kms *kms_create(struct mp_log *log, const char *connector_spec,
- int mode_id, int osd_plane_id, int video_plane_id);
+ int mode_id, int draw_plane, int drmprime_video_plane);
void kms_destroy(struct kms *kms);
double kms_get_display_fps(const struct kms *kms);
diff --git a/video/out/gpu/libmpv_gpu.c b/video/out/gpu/libmpv_gpu.c
index f597d2bb29..5ca4ebb7ca 100644
--- a/video/out/gpu/libmpv_gpu.c
+++ b/video/out/gpu/libmpv_gpu.c
@@ -36,9 +36,9 @@ static const struct native_resource_entry native_resource_map[] = {
.name = "drm_params",
.size = sizeof (mpv_opengl_drm_params),
},
- [MPV_RENDER_PARAM_DRM_OSD_SIZE] = {
- .name = "drm_osd_size",
- .size = sizeof (mpv_opengl_drm_osd_size),
+ [MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE] = {
+ .name = "drm_draw_surface_size",
+ .size = sizeof (mpv_opengl_drm_draw_surface_size),
},
};
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 72eb2e3b98..6aa3d95e79 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -81,7 +81,7 @@ struct priv {
struct vt_switcher vt_switcher;
struct mpv_opengl_drm_params drm_params;
- struct mpv_opengl_drm_osd_size osd_size;
+ struct mpv_opengl_drm_draw_surface_size draw_surface_size;
};
// Not general. Limited to only the formats being used in this module
@@ -195,11 +195,11 @@ static bool init_gbm(struct ra_ctx *ctx)
}
MP_VERBOSE(ctx->vo, "Initializing GBM surface (%d x %d)\n",
- p->osd_size.width, p->osd_size.height);
+ p->draw_surface_size.width, p->draw_surface_size.height);
p->gbm.surface = gbm_surface_create(
p->gbm.device,
- p->osd_size.width,
- p->osd_size.height,
+ p->draw_surface_size.width,
+ p->draw_surface_size.height,
p->gbm_format,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
if (!p->gbm.surface) {
@@ -280,16 +280,16 @@ static bool crtc_setup_atomic(struct ra_ctx *ctx)
goto err;
}
- drm_object_set_property(request, atomic_ctx->osd_plane, "FB_ID", p->fb->id);
- drm_object_set_property(request, atomic_ctx->osd_plane, "CRTC_ID", p->kms->crtc_id);
- drm_object_set_property(request, atomic_ctx->osd_plane, "SRC_X", 0);
- drm_object_set_property(request, atomic_ctx->osd_plane, "SRC_Y", 0);
- drm_object_set_property(request, atomic_ctx->osd_plane, "SRC_W", p->osd_size.width << 16);
- drm_object_set_property(request, atomic_ctx->osd_plane, "SRC_H", p->osd_size.height << 16);
- drm_object_set_property(request, atomic_ctx->osd_plane, "CRTC_X", 0);
- drm_object_set_property(request, atomic_ctx->osd_plane, "CRTC_Y", 0);
- drm_object_set_property(request, atomic_ctx->osd_plane, "CRTC_W", p->kms->mode.mode.hdisplay);
- drm_object_set_property(request, atomic_ctx->osd_plane, "CRTC_H", p->kms->mode.mode.vdisplay);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "FB_ID", p->fb->id);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_ID", p->kms->crtc_id);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "SRC_X", 0);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "SRC_Y", 0);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "SRC_W", p->draw_surface_size.width << 16);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "SRC_H", p->draw_surface_size.height << 16);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_X", 0);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_Y", 0);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_W", p->kms->mode.mode.hdisplay);
+ drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_H", p->kms->mode.mode.vdisplay);
int ret = drmModeAtomicCommit(p->kms->fd, request, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
if (ret)
@@ -446,9 +446,9 @@ static void drm_egl_swap_buffers(struct ra_ctx *ctx)
update_framebuffer_from_bo(ctx, p->gbm.next_bo);
if (atomic_ctx) {
- drm_object_set_property(atomic_ctx->request, atomic_ctx->osd_plane, "FB_ID", p->fb->id);
- drm_object_set_property(atomic_ctx->request, atomic_ctx->osd_plane, "CRTC_ID", atomic_ctx->crtc->id);
- drm_object_set_property(atomic_ctx->request, atomic_ctx->osd_plane, "ZPOS", 1);
+ drm_object_set_property(atomic_ctx->request, atomic_ctx->draw_plane, "FB_ID", p->fb->id);
+ drm_object_set_property(atomic_ctx->request, atomic_ctx->draw_plane, "CRTC_ID", atomic_ctx->crtc->id);
+ drm_object_set_property(atomic_ctx->request, atomic_ctx->draw_plane, "ZPOS", 1);
ret = drmModeAtomicCommit(p->kms->fd, atomic_ctx->request,
DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT, NULL);
@@ -521,24 +521,24 @@ static void drm_egl_uninit(struct ra_ctx *ctx)
}
}
-// If the OSD plane supports ARGB we want to use that, but if it doesn't we fall
-// back on XRGB. If the driver does not support atomic there is no particular
-// reason to be using ARGB (drmprime hwdec will not work without atomic,
-// anyway), so we fall back to XRGB (another reason is that we do not have the
-// convenient atomic_ctx and its convenient plane fields).
+// If the draw plane supports ARGB we want to use that, but if it doesn't we
+// fall back on XRGB. If we do not have atomic there is no particular reason to
+// be using ARGB (drmprime hwdec will not work without atomic, anyway), so we
+// fall back to XRGB (another reason is that we do not have the convenient
+// atomic_ctx and its convenient plane fields).
static bool probe_gbm_format(struct ra_ctx *ctx, uint32_t argb_format, uint32_t xrgb_format)
{
struct priv *p = ctx->priv;
if (!p->kms->atomic_context) {
p->gbm_format = xrgb_format;
- MP_VERBOSE(ctx->vo, "Not using DRM Atomic: Use %s for OSD plane.\n",
+ MP_VERBOSE(ctx->vo, "Not using DRM Atomic: Use %s for draw plane.\n",
gbm_format_to_string(xrgb_format));
return true;
}
drmModePlane *drmplane =
- drmModeGetPlane(p->kms->fd, p->kms->atomic_context->osd_plane->id);
+ drmModeGetPlane(p->kms->fd, p->kms->atomic_context->draw_plane->id);
bool have_argb = false;
bool have_xrgb = false;
bool result = false;
@@ -552,11 +552,11 @@ static bool probe_gbm_format(struct ra_ctx *ctx, uint32_t argb_format, uint32_t
if (have_argb) {
p->gbm_format = argb_format;
- MP_VERBOSE(ctx->vo, "%s supported by OSD plane.\n", gbm_format_to_string(argb_format));
+ MP_VERBOSE(ctx->vo, "%s supported by draw plane.\n", gbm_format_to_string(argb_format));
result = true;
} else if (have_xrgb) {
p->gbm_format = xrgb_format;
- MP_VERBOSE(ctx->vo, "%s not supported by OSD plane: Falling back to %s.\n",
+ MP_VERBOSE(ctx->vo, "%s not supported by draw plane: Falling back to %s.\n",
gbm_format_to_string(argb_format), gbm_format_to_string(xrgb_format));
result = true;
}
@@ -586,25 +586,25 @@ static bool drm_egl_init(struct ra_ctx *ctx)
MP_VERBOSE(ctx, "Initializing KMS\n");
p->kms = kms_create(ctx->log, ctx->vo->opts->drm_opts->drm_connector_spec,
ctx->vo->opts->drm_opts->drm_mode_id,
- ctx->vo->opts->drm_opts->drm_osd_plane_id,
- ctx->vo->opts->drm_opts->drm_video_plane_id);
+ ctx->vo->opts->drm_opts->drm_draw_plane,
+ ctx->vo->opts->drm_opts->drm_drmprime_video_plane);
if (!p->kms) {
MP_ERR(ctx, "Failed to create KMS.\n");
return false;
}
- if (ctx->vo->opts->drm_opts->drm_osd_size.wh_valid) {
+ if (ctx->vo->opts->drm_opts->drm_draw_surface_size.wh_valid) {
if (p->kms->atomic_context) {
- p->osd_size.width = ctx->vo->opts->drm_opts->drm_osd_size.w;
- p->osd_size.height = ctx->vo->opts->drm_opts->drm_osd_size.h;
+ p->draw_surface_size.width = ctx->vo->opts->drm_opts->drm_draw_surface_size.w;
+ p->draw_surface_size.height = ctx->vo->opts->drm_opts->drm_draw_surface_size.h;
} else {
- p->osd_size.width = p->kms->mode.mode.hdisplay;
- p->osd_size.height = p->kms->mode.mode.vdisplay;
- MP_WARN(ctx, "Setting OSD size is only available with DRM atomic, defaulting to screen resolution\n");
+ p->draw_surface_size.width = p->kms->mode.mode.hdisplay;
+ p->draw_surface_size.height = p->kms->mode.mode.vdisplay;
+ MP_WARN(ctx, "Setting draw plane size is only available with DRM atomic, defaulting to screen resolution\n");
}
} else {
- p->osd_size.width = p->kms->mode.mode.hdisplay;
- p->osd_size.height = p->kms->mode.mode.vdisplay;
+ p->draw_surface_size.width = p->kms->mode.mode.hdisplay;
+ p->draw_surface_size.height = p->kms->mode.mode.vdisplay;
}
uint32_t argb_format;
@@ -618,7 +618,7 @@ static bool drm_egl_init(struct ra_ctx *ctx)
}
if (!probe_gbm_format(ctx, argb_format, xrgb_format)) {
- MP_ERR(ctx->vo, "No suitable format found on DRM primary plane (tried: %s and %s).\n",
+ MP_ERR(ctx->vo, "No suitable format found on draw plane (tried: %s and %s).\n",
gbm_format_to_string(argb_format), gbm_format_to_string(xrgb_format));
return false;
}
@@ -689,7 +689,7 @@ static bool drm_egl_init(struct ra_ctx *ctx)
return false;
ra_add_native_resource(ctx->ra, "drm_params", &p->drm_params);
- ra_add_native_resource(ctx->ra, "drm_osd_size", &p->osd_size);
+ ra_add_native_resource(ctx->ra, "drm_draw_surface_size", &p->draw_surface_size);
return true;
}
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c
index c02c9eafb6..fd3d383c55 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/opengl/hwdec_drmprime_drm.c
@@ -114,17 +114,17 @@ static void disable_video_plane(struct ra_hwdec *hw)
if (!p->ctx)
return;
- if (!p->ctx->video_plane)
+ if (!p->ctx->drmprime_video_plane)
return;
- // Disabling video plane is needed on some devices when using the
- // primary plane for video. Primary buffer can't be active with no
- // framebuffer associated. So we need this function to commit it
- // right away as mpv will free all framebuffers on playback end.
+ // Disabling the drmprime video plane is needed on some devices when using
+ // the primary plane for video. Primary buffer can't be active with no
+ // framebuffer associated. So we need this function to commit it right away
+ // as mpv will free all framebuffers on playback end.
drmModeAtomicReqPtr request = drmModeAtomicAlloc();
if (request) {
- drm_object_set_property(request, p->ctx->video_plane, "FB_ID", 0);
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_ID", 0);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "FB_ID", 0);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_ID", 0);
int ret = drmModeAtomicCommit(p->ctx->fd, request,
DRM_MODE_ATOMIC_NONBLOCK, NULL);
@@ -162,11 +162,11 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image,
if (hw_image) {
- // grab osd windowing info to eventually upscale the overlay
- // as egl windows could be upscaled to osd plane.
- struct mpv_opengl_drm_osd_size *osd_size = ra_get_native_resource(hw->ra, "drm_osd_size");
- if (osd_size) {
- scale_dst_rect(hw, osd_size->width, osd_size->height, dst, &p->dst);
+ // grab draw plane windowing info to eventually upscale the overlay
+ // as egl windows could be upscaled to draw plane.
+ struct mpv_opengl_drm_draw_surface_size *draw_surface_size = ra_get_native_resource(hw->ra, "drm_draw_surface_size");
+ if (draw_surface_size) {
+ scale_dst_rect(hw, draw_surface_size->width, draw_surface_size->height, dst, &p->dst);
} else {
p->dst = *dst;
}
@@ -187,24 +187,24 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image,
}
if (request) {
- drm_object_set_property(request, p->ctx->video_plane, "FB_ID", next_frame.fb.fb_id);
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_ID", p->ctx->crtc->id);
- drm_object_set_property(request, p->ctx->video_plane, "SRC_X", p->src.x0 << 16);
- drm_object_set_property(request, p->ctx->video_plane, "SRC_Y", p->src.y0 << 16);
- drm_object_set_property(request, p->ctx->video_plane, "SRC_W", srcw << 16);
- drm_object_set_property(request, p->ctx->video_plane, "SRC_H", srch << 16);
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_X", MP_ALIGN_DOWN(p->dst.x0, 2));
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_Y", MP_ALIGN_DOWN(p->dst.y0, 2));
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_W", dstw);
- drm_object_set_property(request, p->ctx->video_plane, "CRTC_H", dsth);
- drm_object_set_property(request, p->ctx->video_plane, "ZPOS", 0);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "FB_ID", next_frame.fb.fb_id);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_ID", p->ctx->crtc->id);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "SRC_X", p->src.x0 << 16);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "SRC_Y", p->src.y0 << 16);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "SRC_W", srcw << 16);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "SRC_H", srch << 16);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_X", MP_ALIGN_DOWN(p->dst.x0, 2));
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_Y", MP_ALIGN_DOWN(p->dst.y0, 2));
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_W", dstw);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "CRTC_H", dsth);
+ drm_object_set_property(request, p->ctx->drmprime_video_plane, "ZPOS", 0);
} else {
- ret = drmModeSetPlane(p->ctx->fd, p->ctx->video_plane->id, p->ctx->crtc->id, next_frame.fb.fb_id, 0,
+ ret = drmModeSetPlane(p->ctx->fd, p->ctx->drmprime_video_plane->id, p->ctx->crtc->id, next_frame.fb.fb_id, 0,
MP_ALIGN_DOWN(p->dst.x0, 2), MP_ALIGN_DOWN(p->dst.y0, 2), dstw, dsth,
p->src.x0 << 16, p->src.y0 << 16 , srcw << 16, srch << 16);
if (ret < 0) {
- MP_ERR(hw, "Failed to set the plane %d (buffer %d).\n", p->ctx->video_plane->id,
- next_frame.fb.fb_id);
+ MP_ERR(hw, "Failed to set the drmprime video plane %d (buffer %d).\n",
+ p->ctx->drmprime_video_plane->id, next_frame.fb.fb_id);
goto fail;
}
}
@@ -240,14 +240,14 @@ static void uninit(struct ra_hwdec *hw)
static int init(struct ra_hwdec *hw)
{
struct priv *p = hw->priv;
- int osd_plane_id, video_plane_id;
+ int draw_plane, drmprime_video_plane;
p->log = hw->log;
void *tmp = talloc_new(NULL);
struct drm_opts *opts = mp_get_config_group(tmp, hw->global, &drm_conf);
- osd_plane_id = opts->drm_osd_plane_id;
- video_plane_id = opts->drm_video_plane_id;
+ draw_plane = opts->drm_draw_plane;
+ drmprime_video_plane = opts->drm_drmprime_video_plane;
talloc_free(tmp);
struct mpv_opengl_drm_params *drm_params;
@@ -255,13 +255,13 @@ static int init(struct ra_hwdec *hw)
drm_params = ra_get_native_resource(hw->ra, "drm_params");
if (drm_params) {
p->ctx = drm_atomic_create_context(p->log, drm_params->fd, drm_params->crtc_id,
- drm_params->connector_id, osd_plane_id, video_plane_id);
+ drm_params->connector_id, draw_plane, drmprime_video_plane);
if (!p->ctx) {
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");
+ if (!p->ctx->drmprime_video_plane) {
+ mp_warn(p->log, "No drmprime video plane. You might need to specify it manually using --drm-drmprime-video-plane\n");
goto err;
}
} else {
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index 7f5290110f..fbd644005c 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -420,8 +420,8 @@ static int preinit(struct vo *vo)
p->kms = kms_create(
vo->log, vo->opts->drm_opts->drm_connector_spec,
vo->opts->drm_opts->drm_mode_id,
- vo->opts->drm_opts->drm_osd_plane_id,
- vo->opts->drm_opts->drm_video_plane_id);
+ vo->opts->drm_opts->drm_draw_plane,
+ vo->opts->drm_opts->drm_drmprime_video_plane);
if (!p->kms) {
MP_ERR(vo, "Failed to create KMS.\n");
goto err;