summaryrefslogtreecommitdiffstats
path: root/video/out/drm_atomic.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-04 21:34:26 -0600
committerDudemanguy <random342@airmail.cc>2023-01-21 17:08:29 +0000
commit92a6f2d687e90452c9080a2e0b471ced7557518f (patch)
tree0676341e88224c4e670e7ed0f3904b04e204b8bd /video/out/drm_atomic.c
parent8c617765fe88a5d5597fb58d4b593161049de710 (diff)
downloadmpv-92a6f2d687e90452c9080a2e0b471ced7557518f.tar.bz2
mpv-92a6f2d687e90452c9080a2e0b471ced7557518f.tar.xz
drm: rewrite based around vo_drm_state
A longstanding pain point of the drm VOs is the relative lack of state sharing. While drm_common does provide some sharing, it's far less than other platforms like x11 or wayland. What we do here is essentially copy them by creating a new vo_drm_state struct and using it in vo_drm and context_drm_egl. Much of the functionality that was essentially duplicated in both VOs/contexts is now reduced simple functions in drm_common. The usage of the term 'kms' was also mostly eliminated since this is libdrm nowadays from a userspace perspective.
Diffstat (limited to 'video/out/drm_atomic.c')
-rw-r--r--video/out/drm_atomic.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index dfd27c6f52..5754504e98 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -107,14 +107,14 @@ int drm_object_set_property(drmModeAtomicReq *request, struct drm_object *object
return -EINVAL;
}
-struct drm_object * drm_object_create(struct mp_log *log, int fd,
- uint32_t object_id, uint32_t type)
+struct drm_object *drm_object_create(struct mp_log *log, int fd,
+ uint32_t object_id, uint32_t type)
{
struct drm_object *obj = NULL;
obj = talloc_zero(NULL, struct drm_object);
+ obj->fd = fd;
obj->id = object_id;
obj->type = type;
- obj->fd = fd;
if (drm_object_create_properties(log, fd, obj)) {
talloc_free(obj);
@@ -195,7 +195,6 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
if (connector->connector_id == connector_id)
ctx->connector = drm_object_create(log, ctx->fd, connector->connector_id,
DRM_MODE_OBJECT_CONNECTOR);
-
drmModeFreeConnector(connector);
if (ctx->connector)
break;
@@ -211,8 +210,7 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
drmplane = NULL;
if (possible_crtcs & (1 << crtc_index)) {
- plane = drm_object_create(log, ctx->fd, plane_id,
- DRM_MODE_OBJECT_PLANE);
+ plane = drm_object_create(log, ctx->fd, plane_id, DRM_MODE_OBJECT_PLANE);
if (!plane) {
mp_err(log, "Failed to create Plane object from plane ID %d\n",