summaryrefslogtreecommitdiffstats
path: root/video/out/opengl
diff options
context:
space:
mode:
authorLongChair <longchair@hotmail.com>2018-04-29 17:46:23 +0200
committerJan Ekström <jeebjp@gmail.com>2018-05-01 20:48:02 +0300
commited94f8dc00dd75bf5d88bdf73b9d69a579c0f8ef (patch)
treea7464c8db4f154423ee148c2c6e08f047b41a762 /video/out/opengl
parent49bc07faea5f3c621eed437fadf68653b4b2498b (diff)
downloadmpv-ed94f8dc00dd75bf5d88bdf73b9d69a579c0f8ef.tar.bz2
mpv-ed94f8dc00dd75bf5d88bdf73b9d69a579c0f8ef.tar.xz
drm/atomic: refactor planes names
We are currently using primary / overlay planes drm objects, assuming that primary plane is osd and overlay plane is video. This commit is doing two things : - replace the primary / overlay planes members with osd and video planes member without the assumption - Add two more options to determine which one of the primary / overlay is associated to osd / video. - It will default osd to overlay and video to primary if unspecified
Diffstat (limited to 'video/out/opengl')
-rw-r--r--video/out/opengl/context_drm_egl.c11
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c34
2 files changed, 23 insertions, 22 deletions
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 27b1ab968a..c0f7fa244e 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -352,9 +352,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->primary_plane, "FB_ID", p->fb->id);
- drm_object_set_property(atomic_ctx->request, atomic_ctx->primary_plane, "CRTC_ID", atomic_ctx->crtc->id);
- drm_object_set_property(atomic_ctx->request, atomic_ctx->primary_plane, "ZPOS", 1);
+ 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);
ret = drmModeAtomicCommit(p->kms->fd, atomic_ctx->request,
DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT, NULL);
@@ -442,7 +442,7 @@ static bool probe_gbm_format(struct ra_ctx *ctx, uint32_t argb_format, uint32_t
}
drmModePlane *drmplane =
- drmModeGetPlane(p->kms->fd, p->kms->atomic_context->primary_plane->id);
+ drmModeGetPlane(p->kms->fd, p->kms->atomic_context->osd_plane->id);
bool have_argb = false;
bool have_xrgb = false;
bool result = false;
@@ -490,7 +490,8 @@ 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_overlay_id);
+ ctx->vo->opts->drm_opts->drm_osd_plane_id,
+ ctx->vo->opts->drm_opts->drm_video_plane_id);
if (!p->kms) {
MP_ERR(ctx, "Failed to create KMS.\n");
return false;
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c
index f99550442a..2e1859f6bb 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/opengl/hwdec_drmprime_drm.c
@@ -160,23 +160,23 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image,
}
if (request) {
- drm_object_set_property(request, p->ctx->overlay_plane, "FB_ID", next_frame.fb.fb_id);
- drm_object_set_property(request, p->ctx->overlay_plane, "CRTC_ID", p->ctx->crtc->id);
- drm_object_set_property(request, p->ctx->overlay_plane, "SRC_X", p->src.x0 << 16);
- drm_object_set_property(request, p->ctx->overlay_plane, "SRC_Y", p->src.y0 << 16);
- drm_object_set_property(request, p->ctx->overlay_plane, "SRC_W", srcw << 16);
- drm_object_set_property(request, p->ctx->overlay_plane, "SRC_H", srch << 16);
- drm_object_set_property(request, p->ctx->overlay_plane, "CRTC_X", MP_ALIGN_DOWN(p->dst.x0, 2));
- drm_object_set_property(request, p->ctx->overlay_plane, "CRTC_Y", MP_ALIGN_DOWN(p->dst.y0, 2));
- drm_object_set_property(request, p->ctx->overlay_plane, "CRTC_W", dstw);
- drm_object_set_property(request, p->ctx->overlay_plane, "CRTC_H", dsth);
- drm_object_set_property(request, p->ctx->overlay_plane, "ZPOS", 0);
+ 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);
} else {
- ret = drmModeSetPlane(p->ctx->fd, p->ctx->overlay_plane->id, p->ctx->crtc->id, next_frame.fb.fb_id, 0,
+ ret = drmModeSetPlane(p->ctx->fd, p->ctx->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->overlay_plane->id,
+ MP_ERR(hw, "Failed to set the plane %d (buffer %d).\n", p->ctx->video_plane->id,
next_frame.fb.fb_id);
goto fail;
}
@@ -210,13 +210,14 @@ static void uninit(struct ra_hwdec *hw)
static int init(struct ra_hwdec *hw)
{
struct priv *p = hw->priv;
- int drm_overlay;
+ int osd_plane_id, video_plane_id;
p->log = hw->log;
void *tmp = talloc_new(NULL);
struct drm_opts *opts = mp_get_config_group(tmp, hw->global, &drm_conf);
- drm_overlay = opts->drm_overlay_id;
+ osd_plane_id = opts->drm_osd_plane_id;
+ video_plane_id = opts->drm_video_plane_id;
talloc_free(tmp);
struct mpv_opengl_drm_params *drm_params;
@@ -224,7 +225,7 @@ 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, drm_overlay);
+ drm_params->connector_id, osd_plane_id, video_plane_id);
if (!p->ctx) {
mp_err(p->log, "Failed to retrieve DRM atomic context.\n");
goto err;
@@ -242,7 +243,6 @@ static int init(struct ra_hwdec *hw)
drmModeFreeCrtc(crtc);
}
-
uint64_t has_prime;
if (drmGetCap(p->ctx->fd, DRM_CAP_PRIME, &has_prime) < 0) {
MP_ERR(hw, "Card does not support prime handles.\n");