Commit 1779b7fe authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

nativewindowpriv: use only one call to lock/unlock sw buffers

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 5a5ce58a
......@@ -470,20 +470,13 @@ static void AndroidWindow_UnlockPicture(vout_display_sys_t *sys,
picture_sys_t *p_picsys = p_pic->p_sys;
if (p_window->b_use_priv) {
int err = 0;
void *p_handle = p_picsys->priv.sw.p_handle;
if (p_handle == NULL)
return;
err = sys->anwp.unlockData(p_window->p_handle_priv, p_handle);
if (err == 0) {
if (p_picsys->b_render)
err = sys->anwp.queue(p_window->p_handle_priv, p_handle);
else
err = sys->anwp.cancel(p_window->p_handle_priv, p_handle);
}
sys->anwp.unlockData(p_window->p_handle_priv, p_handle,
p_picsys->b_render);
} else
sys->anw.unlockAndPost(p_window->p_handle);
}
......@@ -498,11 +491,9 @@ static int AndroidWindow_LockPicture(vout_display_sys_t *sys,
void *p_handle;
int err;
err = sys->anwp.dequeue(p_window->p_handle_priv, &p_handle);
err = err == 0 ? sys->anwp.lock(p_window->p_handle_priv, p_handle) : err;
err = err == 0 ? sys->anwp.lockData(p_window->p_handle_priv,
p_handle,
&p_picsys->priv.sw.buf) : err;
err = sys->anwp.lockData(p_window->p_handle_priv,
&p_handle,
&p_picsys->priv.sw.buf);
if (err != 0)
return -1;
p_picsys->priv.sw.p_handle = p_handle;
......
......@@ -291,15 +291,22 @@ int ANativeWindowPriv_cancel( native_window_priv *priv, void *p_handle )
return 0;
}
int ANativeWindowPriv_lockData( native_window_priv *priv, void *p_handle,
int ANativeWindowPriv_lockData( native_window_priv *priv, void **pp_handle,
ANativeWindow_Buffer *p_out_anb )
{
ANativeWindowBuffer_t *anb = (ANativeWindowBuffer_t *)p_handle;
ANativeWindowBuffer_t *anb;
status_t err = NO_ERROR;
void *p_data;
err = ANativeWindowPriv_dequeue( priv, pp_handle );
CHECK_ERR();
anb = (ANativeWindowBuffer_t *)*pp_handle;
CHECK_ANB();
err = ANativeWindowPriv_lock( priv, *pp_handle );
CHECK_ERR();
err = priv->gralloc->lock( priv->gralloc, anb->handle, priv->usage,
0, 0, anb->width, anb->height, &p_data );
CHECK_ERR();
......@@ -314,16 +321,22 @@ int ANativeWindowPriv_lockData( native_window_priv *priv, void *p_handle,
return 0;
}
int ANativeWindowPriv_unlockData( native_window_priv *priv, void *p_handle )
int ANativeWindowPriv_unlockData( native_window_priv *priv, void *p_handle,
bool b_render )
{
ANativeWindowBuffer_t *anb = (ANativeWindowBuffer_t *)p_handle;
status_t err = NO_ERROR;
CHECK_ANB();
err = priv->gralloc->unlock(priv->gralloc, anb->handle);
err = priv->gralloc->unlock( priv->gralloc, anb->handle );
CHECK_ERR();
if( b_render )
ANativeWindowPriv_queue( priv, p_handle );
else
ANativeWindowPriv_cancel( priv, p_handle );
return 0;
}
......
......@@ -82,8 +82,8 @@ typedef int (*ptr_ANativeWindowPriv_dequeue) (native_window_priv *, void **);
typedef int (*ptr_ANativeWindowPriv_lock) (native_window_priv *, void *);
typedef int (*ptr_ANativeWindowPriv_queue) (native_window_priv *, void *);
typedef int (*ptr_ANativeWindowPriv_cancel) (native_window_priv *, void *);
typedef int (*ptr_ANativeWindowPriv_lockData) (native_window_priv *, void *, ANativeWindow_Buffer *);
typedef int (*ptr_ANativeWindowPriv_unlockData) (native_window_priv *, void *);
typedef int (*ptr_ANativeWindowPriv_lockData) (native_window_priv *, void **, ANativeWindow_Buffer *);
typedef int (*ptr_ANativeWindowPriv_unlockData) (native_window_priv *, void *, bool b_render);
typedef int (*ptr_ANativeWindowPriv_setOrientation) (native_window_priv *, int);
typedef struct
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment