Module: Mesa
Branch: master
Commit: d9b2c4048d55011bb04bd9848a3b47af7216389f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9b2c4048d55011bb04bd9848a3b47af7216389f

Author: Leo Liu <leo....@amd.com>
Date:   Mon Oct 24 14:03:10 2016 -0400

st/omx/dec: result buffers size should match codec decoder size

Otherwise fails the check of matching between decoder size and buffers
size in kernel.

Signed-off-by: Leo Liu <leo....@amd.com>
Cc: 13.0 <mesa-sta...@lists.freedesktop.org>

---

 src/gallium/state_trackers/omx/vid_dec.c      |  9 ++-------
 src/gallium/state_trackers/omx/vid_dec_h264.c | 16 +++++++++-------
 src/gallium/state_trackers/omx/vid_dec_h265.c | 12 +++++++-----
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec.c 
b/src/gallium/state_trackers/omx/vid_dec.c
index 90f435b..e51a747 100644
--- a/src/gallium/state_trackers/omx/vid_dec.c
+++ b/src/gallium/state_trackers/omx/vid_dec.c
@@ -425,24 +425,19 @@ void vid_dec_NeedTarget(vid_dec_PrivateType *priv)
    struct pipe_video_buffer templat = {};
    struct vl_screen *omx_screen;
    struct pipe_screen *pscreen;
-   omx_base_video_PortType *port;
 
    omx_screen = priv->screen;
-   port = (omx_base_video_PortType 
*)priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
-
    assert(omx_screen);
-   assert(port);
 
    pscreen = omx_screen->pscreen;
-
    assert(pscreen);
 
    if (!priv->target) {
       memset(&templat, 0, sizeof(templat));
 
       templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
-      templat.width = port->sPortParam.format.video.nFrameWidth;
-      templat.height = port->sPortParam.format.video.nFrameHeight;
+      templat.width = priv->codec->width;
+      templat.height = priv->codec->height;
       templat.buffer_format = pscreen->get_video_param(
             pscreen,
             PIPE_VIDEO_PROFILE_UNKNOWN,
diff --git a/src/gallium/state_trackers/omx/vid_dec_h264.c 
b/src/gallium/state_trackers/omx/vid_dec_h264.c
index 10f2959..a680844 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264.c
@@ -105,13 +105,6 @@ static void vid_dec_h264_BeginFrame(vid_dec_PrivateType 
*priv)
    if (priv->frame_started)
       return;
 
-   vid_dec_NeedTarget(priv);
-   if (priv->first_buf_in_frame)
-      priv->timestamp = priv->timestamps[0];
-   priv->first_buf_in_frame = false;
-
-   priv->picture.h264.num_ref_frames = 
priv->picture.h264.pps->sps->max_num_ref_frames;
-
    if (!priv->codec) {
       struct pipe_video_codec templat = {};
       omx_base_video_PortType *port;
@@ -128,6 +121,15 @@ static void vid_dec_h264_BeginFrame(vid_dec_PrivateType 
*priv)
 
       priv->codec = priv->pipe->create_video_codec(priv->pipe, &templat);
    }
+
+   vid_dec_NeedTarget(priv);
+
+   if (priv->first_buf_in_frame)
+      priv->timestamp = priv->timestamps[0];
+   priv->first_buf_in_frame = false;
+
+   priv->picture.h264.num_ref_frames = 
priv->picture.h264.pps->sps->max_num_ref_frames;
+
    priv->picture.h264.slice_count = 0;
    priv->codec->begin_frame(priv->codec, priv->target, &priv->picture.base);
    priv->frame_started = true;
diff --git a/src/gallium/state_trackers/omx/vid_dec_h265.c 
b/src/gallium/state_trackers/omx/vid_dec_h265.c
index 6deae82..b9ac654 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h265.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h265.c
@@ -612,11 +612,6 @@ static void vid_dec_h265_BeginFrame(vid_dec_PrivateType 
*priv)
    if (priv->frame_started)
       return;
 
-   vid_dec_NeedTarget(priv);
-   if (priv->first_buf_in_frame)
-      priv->timestamp = priv->timestamps[0];
-   priv->first_buf_in_frame = false;
-
    if (!priv->codec) {
       struct pipe_video_codec templat = {};
 
@@ -629,6 +624,13 @@ static void vid_dec_h265_BeginFrame(vid_dec_PrivateType 
*priv)
       templat.level =  priv->codec_data.h265.level_idc;
       priv->codec = priv->pipe->create_video_codec(priv->pipe, &templat);
    }
+
+   vid_dec_NeedTarget(priv);
+
+   if (priv->first_buf_in_frame)
+      priv->timestamp = priv->timestamps[0];
+   priv->first_buf_in_frame = false;
+
    priv->codec->begin_frame(priv->codec, priv->target, &priv->picture.base);
    priv->frame_started = true;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to