[Mesa-dev] [PATCH] st/va: Support fractional framerate in misc parameter

Mark Thompson sw at jkqxz.net
Fri Jan 27 22:03:10 UTC 2017


Signed-off-by: Mark Thompson <sw at jkqxz.net>
---
See <https://cgit.freedesktop.org/libva/tree/va/va.h#n1277> - this is a recent addition, but is backwards-compatible.

Depends on Andy's patch <https://lists.freedesktop.org/archives/mesa-dev/2017-January/142242.html> for actual support for fractional framerate.

 src/gallium/state_trackers/va/picture.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index a024437bff..8073ad8906 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -357,7 +357,13 @@ static VAStatus
 handleVAEncMiscParameterTypeFrameRate(vlVaContext *context, VAEncMiscParameterBuffer *misc)
 {
    VAEncMiscParameterFrameRate *fr = (VAEncMiscParameterFrameRate *)misc->data;
-   context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate;
+   if (fr->framerate & 0xffff0000) {
+      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate       & 0xffff;
+      context->desc.h264enc.rate_ctrl.frame_rate_den = fr->framerate >> 16 & 0xffff;
+   } else {
+      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate;
+      context->desc.h264enc.rate_ctrl.frame_rate_den = 1;
+   }
    return VA_STATUS_SUCCESS;
 }
 
-- 
2.11.0



More information about the mesa-dev mailing list