<html><head></head><body>Hi,<br><br>It works but can you provide a rationale? Does it really get closer to removing the pool callback, which should presumably be the target?<br><br><div class="gmail_quote">Le 18 novembre 2019 13:13:33 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">We already know the size is going to be 1<br><br>Moved CustomDestroyPicture to avoid forward declaration.<hr> modules/video_output/kms.c | 97 ++++++++++++++++++--------------------<br> 1 file changed, 47 insertions(+), 50 deletions(-)<br><br>diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c<br>index 7626254b658..a70ec213d61 100644<br>--- a/modules/video_output/kms.c<br>+++ b/modules/video_output/kms.c<br>@@ -495,6 +495,22 @@ static bool ChromaNegotiation(vout_display_t *vd)<br>     return false;<br> }<br> <br>+static void CustomDestroyPicture(picture_t *p_picture)<br>+{<br>+    picture_sys_t *psys = (picture_sys_t*)p_picture->p_sys;<br>+    vout_display_sys_t *sys = (vout_display_sys_t *)psys->p_voutsys;<br>+    int c;<br>+<br>+    for (c = 0; c < MAXHWBUF; c++)<br>+        DestroyFB(sys, c);<br>+<br>+    drmSetClientCap(sys->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0);<br>+    drmDropMaster(sys->drm_fd);<br>+    vlc_close(sys->drm_fd);<br>+    sys->drm_fd = 0;<br>+    free(p_picture->p_sys);<br>+}<br>+<br> <br> static int OpenDisplay(vout_display_t *vd)<br> {<br>@@ -573,6 +589,37 @@ static int OpenDisplay(vout_display_t *vd)<br>     if (!found_connector)<br>         goto err_out;<br> <br>+    picture_resource_t rsc;<br>+    memset(&rsc, 0, sizeof(rsc));<br>+<br>+    for (size_t i = 0; i < PICTURE_PLANE_MAX; i++) {<br>+        rsc.p[i].p_pixels = sys->map[0] + sys->offsets[i];<br>+        rsc.p[i].i_lines  = sys->height;<br>+        rsc.p[i].i_pitch  = sys->stride;<br>+    }<br>+<br>+    picture_sys_t *psys = calloc(1, sizeof(*psys));<br>+    if (psys == NULL)<br>+        goto err_out;<br>+<br>+    psys->p_voutsys = sys;<br>+    rsc.p_sys = psys;<br>+    rsc.pf_destroy = CustomDestroyPicture;<br>+<br>+    sys->picture = picture_NewFromResource(&vd->fmt, &rsc);<br>+<br>+    if (!sys->picture)<br>+    {<br>+        free(psys);<br>+        goto err_out;<br>+    }<br>+<br>+    sys->pool = picture_pool_New(1, &sys->picture);<br>+    if (!sys->pool) {<br>+        picture_Release(sys->picture);<br>+        goto error;<br>+    }<br>+<br>     return VLC_SUCCESS;<br> err_out:<br>     drmDropMaster(sys->drm_fd);<br>@@ -598,60 +645,10 @@ static int Control(vout_display_t *vd, int query, va_list args)<br> }<br> <br> <br>-static void CustomDestroyPicture(picture_t *p_picture)<br>-{<br>-    picture_sys_t *psys = (picture_sys_t*)p_picture->p_sys;<br>-    vout_display_sys_t *sys = (vout_display_sys_t *)psys->p_voutsys;<br>-    int c;<br>-<br>-    for (c = 0; c < MAXHWBUF; c++)<br>-        DestroyFB(sys, c);<br>-<br>-    drmSetClientCap(sys->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0);<br>-    drmDropMaster(sys->drm_fd);<br>-    vlc_close(sys->drm_fd);<br>-    sys->drm_fd = 0;<br>-    free(p_picture->p_sys);<br>-}<br>-<br>-<br> static picture_pool_t *Pool(vout_display_t *vd, unsigned count)<br> {<br>     VLC_UNUSED(count);<br>     vout_display_sys_t *sys = vd->sys;<br>-    picture_sys_t *psys;<br>-    picture_resource_t rsc;<br>-    int i;<br>-<br>-    if (!sys->pool && !sys->picture) {<br>-        memset(&rsc, 0, sizeof(rsc));<br>-<br>-        for (i = 0; i < PICTURE_PLANE_MAX; i++) {<br>-            rsc.p[i].p_pixels = sys->map[0]+sys->offsets[i];<br>-            rsc.p[i].i_lines  = sys->height;<br>-            rsc.p[i].i_pitch  = sys->stride;<br>-        }<br>-<br>-        psys = calloc(1, sizeof(*psys));<br>-        if (psys == NULL)<br>-            return NULL;<br>-<br>-        psys->p_voutsys = sys;<br>-        rsc.p_sys = psys;<br>-        rsc.pf_destroy = CustomDestroyPicture;<br>-<br>-        sys->picture = picture_NewFromResource(&vd->fmt, &rsc);<br>-<br>-        if (!sys->picture) {<br>-            free((void*)psys);<br>-            return NULL;<br>-        }<br>-<br>-        sys->pool = picture_pool_New(1, &sys->picture);<br>-        if (!sys->pool)<br>-            picture_Release(sys->picture);<br>-    }<br>-<br>     return sys->pool;<br> }<br> </pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>