summaryrefslogtreecommitdiffstats
path: root/video/out/opengl
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2018-12-01 12:01:17 +0100
committerJan Ekström <jeebjp@gmail.com>2018-12-01 15:42:20 +0200
commitf0509d3738ec37cfa4afa81f070c8abd876e6561 (patch)
treecc2a7c485c01825b01b66e8277d4750bb9f23bf5 /video/out/opengl
parentc151fae054d12ef9b392f5b6dcc1bafe894005b0 (diff)
downloadmpv-f0509d3738ec37cfa4afa81f070c8abd876e6561.tar.bz2
mpv-f0509d3738ec37cfa4afa81f070c8abd876e6561.tar.xz
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/out/opengl')
-rw-r--r--video/out/opengl/context_drm_egl.c76
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c64
2 files changed, 70 insertions, 70 deletions
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 {