aboutsummaryrefslogtreecommitdiffhomepage
path: root/video
diff options
context:
space:
mode:
authorGravatar Anton Kindestam <antonki@kth.se>2018-12-01 12:01:17 +0100
committerGravatar Jan Ekström <jeebjp@gmail.com>2018-12-01 15:42:20 +0200
commitf0509d3738ec37cfa4afa81f070c8abd876e6561 (patch)
treecc2a7c485c01825b01b66e8277d4750bb9f23bf5 /video
parentc151fae054d12ef9b392f5b6dcc1bafe894005b0 (diff)
drm: rename plane options to better, invariant, names
This commit bumps the libmpv version to 1.102 drm-osd-plane -> drm-draw-plane drm-video-plane -> drm-drmprime-video-plane drm-osd-size -> drm-draw-surface-size "draw plane", as in the plane that OpenGL draws to, whether it be video + OSD or just OSD. "drmprime video plane", as in the plane used for hwdec video imported via drmprime. "draw surface size", as in the size of the surface used for the draw plane The new names are invariant whether or not hwdec_drmprime_drm is being used or not. The original naming was very confusing, as when doing regular rendering (swdec or vaapi) the video would be displayed on the "OSD plane", and the "Video plane" would remain unused.
Diffstat (limited to 'video')
-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
8 files changed, 125 insertions, 120 deletions
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;