diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-11-10 11:01:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-11-10 11:01:13 +0100 |
commit | 0b56509a495a26164f3a1bf14a4085b217ad48b2 (patch) | |
tree | ed84fe920e70a6692d4532804f9d6e521723e507 | |
parent | 9305ead655a34b0c5012994873d9b00e44019bdb (diff) | |
download | gst-plugins-fsl-vpu-0b56509a495a26164f3a1bf14a4085b217ad48b2.tar.gz gst-plugins-fsl-vpu-0b56509a495a26164f3a1bf14a4085b217ad48b2.tar.xz |
vpu module: Add module parameter to adjust bitrate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | module/imx-vpu.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/module/imx-vpu.c b/module/imx-vpu.c index 69ebd5e..47eefac 100644 --- a/module/imx-vpu.c +++ b/module/imx-vpu.c @@ -64,6 +64,13 @@ #define V2_IRAM_SIZE 0x14000 +#define VPU_MAX_BITRATE 32767 + +static unsigned int vpu_bitrate; +module_param(vpu_bitrate, uint, 0644); +MODULE_PARM_DESC(vpu_bitrate, "bitrate: Specify bitrate for encoder. " + "0..32767, use 0 for auto bitrate. Default 0"); + struct fw_header_info { u8 platform[12]; u32 size; @@ -606,7 +613,6 @@ static int noinline vpu_enc_get_initial_info(struct vpu_instance *instance) u32 val; u32 sliceSizeMode = 0; u32 sliceMode = 0; - u32 bitrate = 0; /* auto bitrate */ u32 enableAutoSkip = 0; u32 initialDelay = 1; u32 sliceReport = 0; @@ -700,10 +706,10 @@ static int noinline vpu_enc_get_initial_info(struct vpu_instance *instance) vpu_write(vpu, CMD_ENC_SEQ_SLICE_MODE, data); vpu_write(vpu, CMD_ENC_SEQ_GOP_NUM, 30); /* gop size */ - if (bitrate) { /* rate control enabled */ + if (vpu_bitrate) { /* rate control enabled */ data = (!enableAutoSkip) << 31 | initialDelay << 16 | - bitrate << 1 | + vpu_bitrate << 1 | 0; vpu_write(vpu, CMD_ENC_SEQ_RC_PARA, data); } else { @@ -1818,6 +1824,12 @@ static int vpu_dev_probe(struct platform_device *pdev) goto err_out_work; } + if (vpu_bitrate > VPU_MAX_BITRATE) { + vpu_bitrate = VPU_MAX_BITRATE; + dev_warn(&pdev->dev, "specified bitrate too high. Limiting to %d\n", + VPU_MAX_BITRATE); + } + INIT_WORK(&vpu->work, vpu_work); init_completion(&vpu->complete); strcpy(vpu->vdev->name, "imx-vpu"); |