summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/omx
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2015-12-08 21:50:03 +0000
committerJulien Isorce <[email protected]>2016-06-27 17:52:15 +0100
commite10f1fcebe28a3a37c143d33ff3be2ef0399e2e1 (patch)
treec5a0f78ae4ce38184f997cda476409f64a5119ff /src/gallium/state_trackers/omx
parent23b7a83cc1484336e8af2b965d89ab532f4ee691 (diff)
st/omx: add support for nouveau / interlaced
Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/omx')
-rw-r--r--src/gallium/state_trackers/omx/vid_dec.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c
index 564ca2f5da8..85ffb88a5bf 100644
--- a/src/gallium/state_trackers/omx/vid_dec.c
+++ b/src/gallium/state_trackers/omx/vid_dec.c
@@ -48,6 +48,7 @@
#include "pipe/p_video_codec.h"
#include "util/u_memory.h"
#include "util/u_surface.h"
+#include "vl/vl_video_buffer.h"
#include "vl/vl_vlc.h"
#include "entrypoint.h"
@@ -515,34 +516,34 @@ static void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buff
OMX_VIDEO_PORTDEFINITIONTYPE *def = &port->sPortParam.format.video;
struct pipe_sampler_view **views;
- struct pipe_transfer *transfer;
- struct pipe_box box = { };
- uint8_t *src, *dst;
+ unsigned i, j;
+ unsigned width, height;
views = buf->get_sampler_view_planes(buf);
- dst = output->pBuffer;
-
- box.width = def->nFrameWidth;
- box.height = def->nFrameHeight;
- box.depth = 1;
-
- src = priv->pipe->transfer_map(priv->pipe, views[0]->texture, 0,
- PIPE_TRANSFER_READ, &box, &transfer);
- util_copy_rect(dst, views[0]->texture->format, def->nStride, 0, 0,
- box.width, box.height, src, transfer->stride, 0, 0);
- pipe_transfer_unmap(priv->pipe, transfer);
-
- dst = ((uint8_t*)output->pBuffer) + (def->nStride * box.height);
-
- box.width = def->nFrameWidth / 2;
- box.height = def->nFrameHeight / 2;
-
- src = priv->pipe->transfer_map(priv->pipe, views[1]->texture, 0,
- PIPE_TRANSFER_READ, &box, &transfer);
- util_copy_rect(dst, views[1]->texture->format, def->nStride, 0, 0,
- box.width, box.height, src, transfer->stride, 0, 0);
- pipe_transfer_unmap(priv->pipe, transfer);
+ for (i = 0; i < 2 /* NV12 */; i++) {
+ if (!views[i]) continue;
+ width = buf->width;
+ height = buf->height;
+ vl_video_buffer_adjust_size(&width, &height, i, buf->interlaced, buf->chroma_format);
+ for (j = 0; j < views[i]->texture->array_size; ++j) {
+ struct pipe_box box = {0, 0, j, width, height, 1};
+ struct pipe_transfer *transfer;
+ uint8_t *map, *dst;
+ map = priv->pipe->transfer_map(priv->pipe, views[i]->texture, 0,
+ PIPE_TRANSFER_READ, &box, &transfer);
+ if (!map)
+ return;
+
+ dst = ((uint8_t*)output->pBuffer + output->nOffset) + j * def->nStride + i * buf->width * buf->height;
+ util_copy_rect(dst,
+ views[i]->texture->format,
+ def->nStride * views[i]->texture->array_size, 0, 0,
+ box.width, box.height, map, transfer->stride, 0, 0);
+
+ pipe_transfer_unmap(priv->pipe, transfer);
+ }
+ }
}
static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, OMX_BUFFERHEADERTYPE* input,