[vlc-commits] [Git][videolan/vlc][master] 4 commits: vout: libplacebo: don't use vd->fmt on Open

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue May 31 12:26:16 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
51e4fdff by Steve Lhomme at 2022-05-31T12:11:13+00:00
vout: libplacebo: don't use vd->fmt on Open

vd->fmt is the format the display is requesting to receive. On open it's set to
the same as vd->source for convenience. But it might as well not be set at all
before Open has finished.

Partially reverts 183c8d997139e39a424debea97e195f6e02d1dc4

- - - - -
e1514c63 by Steve Lhomme at 2022-05-31T12:11:13+00:00
vout: mmal: don't use vd->fmt on Open

vd->fmt is the format the display is requesting to receive. On open it's set to
the same as vd->source for convenience. But it might as well not set be at all
before Open has finished.

- - - - -
e810115c by Steve Lhomme at 2022-05-31T12:11:13+00:00
vout: drm: don't use vd->fmt on Open

vd->fmt is the format the display is requesting to receive. On open it's set to
the same as vd->source for convenience. But it might as well not set be at all
before Open has finished.

- - - - -
90741103 by Steve Lhomme at 2022-05-31T12:11:13+00:00
display: use display_fmt directly

vd->fmt is only a read-only version to use outside of this file.

- - - - -


4 changed files:

- modules/hw/mmal/vout.c
- modules/video_output/drm/display.c
- modules/video_output/libplacebo/display.c
- src/video_output/display.c


Changes:

=====================================
modules/hw/mmal/vout.c
=====================================
@@ -1086,9 +1086,9 @@ static int OpenMmalVout(vout_display_t *vd,
     MMAL_STATUS_T status;
     int ret = VLC_EGENERIC;
     // At the moment all copy is via I420
-    const bool needs_copy = !hw_mmal_chroma_is_mmal(vd->fmt->i_chroma);
+    const bool needs_copy = !hw_mmal_chroma_is_mmal(vd->source->i_chroma);
     const MMAL_FOURCC_T enc_in = needs_copy ? MMAL_ENCODING_I420 :
-        vout_vlc_to_mmal_pic_fourcc(vd->fmt->i_chroma);
+        vout_vlc_to_mmal_pic_fourcc(vd->source->i_chroma);
 
     sys = calloc(1, sizeof(struct vout_display_sys_t));
     if (!sys)


=====================================
modules/video_output/drm/display.c
=====================================
@@ -207,7 +207,7 @@ static int Open(vout_display_t *vd,
     msg_Dbg(vd, "using DRM pixel format %4.4s (0x%08"PRIXFAST32")",
             (char *)&drm_fourcc, drm_fourcc);
 
-    video_format_ApplyRotation(&fmt, vd->fmt);
+    video_format_ApplyRotation(&fmt, vd->source);
     if (!vlc_video_format_drm(&fmt, drm_fourcc)) {
         /* This can only occur if $vlc-drm-chroma is unknown. */
         assert(chroma != NULL);


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -139,18 +139,19 @@ static int Open(vout_display_t *vd,
     vlc_placebo_ReleaseCurrent(sys->pl);
 
     // Attempt using the input format as the display format
-    if (vlc_placebo_FormatSupported(gpu, vd->fmt->i_chroma)) {
-        fmt->i_chroma = vd->fmt->i_chroma;
+    if (vlc_placebo_FormatSupported(gpu, vd->source->i_chroma)) {
+        fmt->i_chroma = vd->source->i_chroma;
     } else {
+        fmt->i_chroma = 0;
         const vlc_fourcc_t *fcc;
-        for (fcc = vlc_fourcc_GetFallback(vd->fmt->i_chroma); *fcc; fcc++) {
+        for (fcc = vlc_fourcc_GetFallback(vd->source->i_chroma); *fcc; fcc++) {
             if (vlc_placebo_FormatSupported(gpu, *fcc)) {
                 fmt->i_chroma = *fcc;
                 break;
             }
         }
 
-        if (!fmt->i_chroma) {
+        if (fmt->i_chroma == 0) {
             fmt->i_chroma = VLC_CODEC_RGBA;
             msg_Warn(vd, "Failed picking any suitable input format, falling "
                      "back to RGBA for sanity!");


=====================================
src/video_output/display.c
=====================================
@@ -43,24 +43,6 @@
 #include "display.h"
 #include "vout_internal.h"
 
-/*****************************************************************************
- * FIXME/TODO see how to have direct rendering here (interact with vout.c)
- *****************************************************************************/
-static picture_t *VideoBufferNew(filter_t *filter)
-{
-    vout_display_t *vd = filter->owner.sys;
-    const video_format_t *fmt = &filter->fmt_out.video;
-
-    assert(vd->fmt->i_chroma == fmt->i_chroma &&
-           vd->fmt->i_width  == fmt->i_width  &&
-           vd->fmt->i_height == fmt->i_height);
-
-    picture_pool_t *pool = vout_GetPool(vd, 3);
-    if (!pool)
-        return NULL;
-    return picture_pool_Get(pool);
-}
-
 static int vout_display_Control(vout_display_t *vd, int query)
 {
     return vd->ops->control(vd, query);
@@ -264,6 +246,25 @@ typedef struct {
     picture_pool_t *pool;
 } vout_display_priv_t;
 
+/*****************************************************************************
+ * FIXME/TODO see how to have direct rendering here (interact with vout.c)
+ *****************************************************************************/
+static picture_t *VideoBufferNew(filter_t *filter)
+{
+    vout_display_t *vd = filter->owner.sys;
+    vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
+    const video_format_t *fmt = &filter->fmt_out.video;
+
+    assert(osys->display_fmt.i_chroma == fmt->i_chroma &&
+           osys->display_fmt.i_width  == fmt->i_width  &&
+           osys->display_fmt.i_height == fmt->i_height);
+
+    picture_pool_t *pool = vout_GetPool(vd, 3);
+    if (!pool)
+        return NULL;
+    return picture_pool_Get(pool);
+}
+
 static vlc_decoder_device * DisplayHoldDecoderDevice(vlc_object_t *o, void *sys)
 {
     VLC_UNUSED(o);
@@ -292,7 +293,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     v_src.i_sar_num = 0;
     v_src.i_sar_den = 0;
 
-    video_format_t v_dst = *vd->fmt;
+    video_format_t v_dst = osys->display_fmt;
     v_dst.i_sar_num = 0;
     v_dst.i_sar_den = 0;
 
@@ -352,7 +353,7 @@ picture_pool_t *vout_GetPool(vout_display_t *vd, unsigned count)
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
 
     if (osys->pool == NULL)
-        osys->pool = picture_pool_NewFromFormat(vd->fmt, count);
+        osys->pool = picture_pool_NewFromFormat(&osys->display_fmt, count);
     return osys->pool;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/492561fa5f64cb501e4f39520ebd62da29757865...90741103c92f243739c7869ace7baaa555752f30

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/492561fa5f64cb501e4f39520ebd62da29757865...90741103c92f243739c7869ace7baaa555752f30
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