[vlc-commits] fb: create the picture during initialization

Rémi Denis-Courmont git at videolan.org
Mon Dec 10 20:10:29 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 10 20:56:24 2018 +0200| [7e0623f8dd6f09c3f255a14ac35620fee5b6df62] | committer: Rémi Denis-Courmont

fb: create the picture during initialization

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e0623f8dd6f09c3f255a14ac35620fee5b6df62
---

 modules/video_output/fb.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 524e3b63fd..b7e828e115 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -320,7 +320,7 @@ static void Close(vout_display_t *vd)
 
     if (sys->pool)
         picture_pool_Release(sys->pool);
-    if (!sys->is_hw_accel && sys->picture)
+    else if (sys->picture != NULL)
         picture_Release(sys->picture);
 
     CloseDisplay(vd);
@@ -337,19 +337,6 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
     vout_display_sys_t *sys = vd->sys;
 
     if (!sys->pool) {
-        if (!sys->picture) {
-            picture_resource_t rsc;
-
-            memset(&rsc, 0, sizeof(rsc));
-            rsc.p[0].p_pixels = sys->video_ptr;
-            rsc.p[0].i_lines  = sys->var_info.yres;
-            rsc.p[0].i_pitch = sys->line_length;
-
-            sys->picture = picture_NewFromResource(&vd->fmt, &rsc);
-            if (!sys->picture)
-                return NULL;
-        }
-
         if (sys->is_hw_accel)
             sys->pool = picture_pool_New(1, &sys->picture);
         else
@@ -624,6 +611,22 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
         return VLC_EGENERIC;
     }
 
+    picture_resource_t rsc = {
+       .p = {
+           [0] = {
+               .i_lines = sys->var_info.yres,
+               .i_pitch = fix_info.line_length,
+           },
+       },
+    };
+
+    sys->picture = picture_NewFromResource(&vd->fmt, &rsc);
+    if (unlikely(sys->picture == NULL)) {
+        munmap(rsc.p[0].p_pixels, sys->video_size);
+        ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
+        return VLC_ENOMEM;
+    }
+
     ClearScreen(sys);
 
     msg_Dbg(vd,



More information about the vlc-commits mailing list