summaryrefslogtreecommitdiff
path: root/src/i965_decoder_utils.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-04-23 17:23:21 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-04-24 11:28:27 +0200
commit61fbb1bba1ad8a41ffae4fd1ba90391adf819b6e (patch)
tree676948fcaf4315b2f002985ab52f3edddbadf41a /src/i965_decoder_utils.c
parent0d3462360f624750233d77771d55f48bc00039e5 (diff)
downloadlibva-intel-driver-61fbb1bba1ad8a41ffae4fd1ba90391adf819b6e.tar.gz
libva-intel-driver-61fbb1bba1ad8a41ffae4fd1ba90391adf819b6e.tar.bz2
libva-intel-driver-61fbb1bba1ad8a41ffae4fd1ba90391adf819b6e.zip
vp8: fix support for segmentation-enabled streams.
If segmentation is enabled, then the segmentation map shall be live across frames until the current frame updates the segment ids. This means that the driver needs to maintain the segmentation map buffer allocation and enable writes (resp. reads) whenever necessary. This fixes decoding of 00-comprehensive-010. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'src/i965_decoder_utils.c')
-rw-r--r--src/i965_decoder_utils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index e80749c..2533381 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -827,3 +827,27 @@ intel_mpeg2_find_next_slice(struct decode_state *decode_state,
return NULL;
}
+
+/* Ensure the segmentation buffer is large enough for the supplied
+ number of MBs, or re-allocate it */
+bool
+intel_ensure_vp8_segmentation_buffer(VADriverContextP ctx, GenBuffer *buf,
+ unsigned int mb_width, unsigned int mb_height)
+{
+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
+ /* The segmentation map is a 64-byte aligned linear buffer, with
+ each cache line holding only 8 bits for 4 continuous MBs */
+ const unsigned int buf_size = ((mb_width + 3) / 4) * 64 * mb_height;
+
+ if (buf->valid) {
+ if (buf->bo && buf->bo->size >= buf_size)
+ return true;
+ drm_intel_bo_unreference(buf->bo);
+ buf->valid = false;
+ }
+
+ buf->bo = drm_intel_bo_alloc(i965->intel.bufmgr, "segmentation map",
+ buf_size, 0x1000);
+ buf->valid = buf->bo != NULL;
+ return buf->valid;
+}