[vlc-commits] [Git][videolan/vlc][master] 2 commits: drm: fix/clean up Display() error handling
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Mon Mar 21 15:54:45 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
1a033eab by Rémi Denis-Courmont at 2022-03-21T15:34:49+00:00
drm: fix/clean up Display() error handling
drmModeSetPlane() is just a glorified ioctl(). Errors are negative
values, and the error code is in errno.
- - - - -
cf0b7fcb by Rémi Denis-Courmont at 2022-03-21T15:34:49+00:00
drm: remove stray typedef
- - - - -
1 changed file:
- modules/video_output/drm/display.c
Changes:
=====================================
modules/video_output/drm/display.c
=====================================
@@ -3,6 +3,7 @@
*****************************************************************************
* Copyright © 2018 Intel Corporation
* Copyright © 2021 Videolabs
+ * Copyright © 2022 Rémi Denis-Courmont
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -34,6 +35,7 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <drm_mode.h>
#include <drm_fourcc.h>
#include <vlc_common.h>
@@ -52,8 +54,6 @@
#define DRM_CHROMA_TEXT "Image format used by DRM"
#define DRM_CHROMA_LONGTEXT "Chroma fourcc override for DRM framebuffer format selection"
-typedef enum { drvSuccess, drvTryNext, drvFail } deviceRval;
-
/*
* how many hw buffers are allocated for page flipping. I think
* 3 is enough so we shouldn't get unexpected stall from kernel.
@@ -318,22 +318,29 @@ static void Display(vout_display_t *vd, picture_t *picture)
VLC_UNUSED(picture);
vout_display_sys_t *sys = vd->sys;
vout_window_t *wnd = vd->cfg->window;
+ const video_format_t *fmt = vd->fmt;
picture_t *pic = sys->buffers[sys->front_buf];
- uint32_t fb_id = vlc_drm_dumb_get_fb_id(pic);
-
vout_display_place_t place;
+
vout_display_PlacePicture(&place, vd->fmt, vd->cfg);
- int ret = drmModeSetPlane(wnd->display.drm_fd,
- sys->plane_id, wnd->handle.crtc, fb_id, 0,
- place.x, place.y, place.width, place.height,
- vd->fmt->i_x_offset << 16, vd->fmt->i_y_offset << 16,
- vd->fmt->i_visible_width << 16, vd->fmt->i_visible_height << 16);
- if (ret != drvSuccess)
- {
- msg_Err(vd, "Cannot do set plane for plane id %u, fb %"PRIu32,
- sys->plane_id, fb_id);
- assert(ret != -EINVAL);
+ struct drm_mode_set_plane sp = {
+ .plane_id = sys->plane_id,
+ .crtc_id = wnd->handle.crtc,
+ .fb_id = vlc_drm_dumb_get_fb_id(pic),
+ .crtc_x = place.x,
+ .crtc_y = place.y,
+ .crtc_w = place.width,
+ .crtc_h = place.height,
+ /* Source values as U16.16 fixed point */
+ .src_x = fmt->i_x_offset << 16,
+ .src_y = fmt->i_y_offset << 16,
+ .src_w = fmt->i_visible_width << 16,
+ .src_h = fmt->i_visible_height << 16,
+ };
+
+ if (vlc_drm_ioctl(wnd->display.drm_fd, DRM_IOCTL_MODE_SETPLANE, &sp) < 0) {
+ msg_Err(vd, "DRM plane setting error: %s", vlc_strerror_c(errno));
return;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c857056738aec2e66d21b54d2d086c60255e6a91...cf0b7fcb23b3e7804af512a46dfecf991bc3a5bb
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c857056738aec2e66d21b54d2d086c60255e6a91...cf0b7fcb23b3e7804af512a46dfecf991bc3a5bb
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list