Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Jeff, On Mon, Jul 21, 2014 at 09:07:50AM +0200, Robert Schwebel wrote: > On Fri, Jul 11, 2014 at 02:33:18PM +0200, Robert Schwebel wrote: > > On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: > > > > It would be really nice if the firmware was available in the > > > > linux-firmware repository. Do you think this would be possible? > > > > > > > > Best wishes, > > > > -- > > > > Kamil Debski > > > > Samsung R&D Institute Poland > > > > > > I tried to convince Freescale to put the firmware into linux-firmware > > > for 15 months now, but recently got no reply any more. > > > > > > Fabio, Shawn, could you try to discuss this with the responsible folks > > > inside FSL again? Maybe responsibilities have changed in the meantime > > > and I might have tried to talk to the wrong people. > > > > Any news? > > Did you get some feedback? I didn't. Jeff, does Freescale have concerns putting the MX6 CODA firmware into the linux-firmware repository? If yes, it would be interesting to learn about those and discuss the possibilities. Support for the CODA960 has been added to the mainline kernel in 3.16, which is basically unusable without distributable firmware. Please make it possible that your customers can actually use your hardware. Best regards, Robert -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi Robert, On Mon, Jul 21, 2014 at 4:07 AM, Robert Schwebel wrote: > Hi Fabio, > > On Fri, Jul 11, 2014 at 02:33:18PM +0200, Robert Schwebel wrote: >> On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: >> > > It would be really nice if the firmware was available in the >> > > linux-firmware repository. Do you think this would be possible? >> > > >> > > Best wishes, >> > > -- >> > > Kamil Debski >> > > Samsung R&D Institute Poland >> > >> > I tried to convince Freescale to put the firmware into linux-firmware >> > for 15 months now, but recently got no reply any more. >> > >> > Fabio, Shawn, could you try to discuss this with the responsible folks >> > inside FSL again? Maybe responsibilities have changed in the meantime >> > and I might have tried to talk to the wrong people. >> >> Any news? > > Did you get some feedback? I didn't. I am adding Jeff Kudrick on Cc as he was looking into this. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi Fabio, On Fri, Jul 11, 2014 at 02:33:18PM +0200, Robert Schwebel wrote: > On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: > > > It would be really nice if the firmware was available in the > > > linux-firmware repository. Do you think this would be possible? > > > > > > Best wishes, > > > -- > > > Kamil Debski > > > Samsung R&D Institute Poland > > > > I tried to convince Freescale to put the firmware into linux-firmware > > for 15 months now, but recently got no reply any more. > > > > Fabio, Shawn, could you try to discuss this with the responsible folks > > inside FSL again? Maybe responsibilities have changed in the meantime > > and I might have tried to talk to the wrong people. > > Any news? Did you get some feedback? I didn't. rsc -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi Robert, On Fri, Jul 11, 2014 at 9:33 AM, Robert Schwebel wrote: > Hi Fabio, > > On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: >> > It would be really nice if the firmware was available in the >> > linux-firmware repository. Do you think this would be possible? >> > >> > Best wishes, >> > -- >> > Kamil Debski >> > Samsung R&D Institute Poland >> >> I tried to convince Freescale to put the firmware into linux-firmware >> for 15 months now, but recently got no reply any more. >> >> Fabio, Shawn, could you try to discuss this with the responsible folks >> inside FSL again? Maybe responsibilities have changed in the meantime >> and I might have tried to talk to the wrong people. > > Any news? I raised this issue again internally last week. Let's hope we will progress this time. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi Fabio, On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: > > It would be really nice if the firmware was available in the > > linux-firmware repository. Do you think this would be possible? > > > > Best wishes, > > -- > > Kamil Debski > > Samsung R&D Institute Poland > > I tried to convince Freescale to put the firmware into linux-firmware > for 15 months now, but recently got no reply any more. > > Fabio, Shawn, could you try to discuss this with the responsible folks > inside FSL again? Maybe responsibilities have changed in the meantime > and I might have tried to talk to the wrong people. Any news? rsc -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi, On Wed, Jul 02, 2014 at 03:37:06PM +0200, Kamil Debski wrote: > > From: Philipp Zabel [mailto:p.za...@pengutronix.de] > > Sent: Tuesday, July 01, 2014 7:53 PM > > To: Nicolas Dufresne > > Cc: linux-media@vger.kernel.org; Mauro Carvalho Chehab; Kamil Debski; > > Fabio Estevam; ker...@pengutronix.de > > Subject: Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support > > for CODA960 > > > > Hi Nicolas, > > > > Am Dienstag, den 24.06.2014, 12:16 -0400 schrieb Nicolas Dufresne: > > [...] > > > > @@ -2908,6 +3183,7 @@ static void coda_timeout(struct work_struct > > > > *work) static u32 coda_supported_firmwares[] = { > > > > CODA_FIRMWARE_VERNUM(CODA_DX6, 2, 2, 5), > > > > CODA_FIRMWARE_VERNUM(CODA_7541, 1, 4, 50), > > > > + CODA_FIRMWARE_VERNUM(CODA_960, 2, 1, 5), > > > > > > Where can we find these firmwares ? > > > > The firmware images are distributed with an EULA in Freescale's BSPs > > that can be downloaded from their website. The file you are looking for > > is vpu_fw_imx6q.bin (for i.MX6Q/D) or vpu_fw_imx6d.bin (for i.MX6DL/S). > > This has to be stripped of the 16-byte header and must be reordered to > > fit the CODA memory access pattern by reversing the order of each set > > of four 16-bit values (imagine little-endian 64-bit values made of four > > 16-bit wide bytes). > > It would be really nice if the firmware was available in the linux-firmware > repository. Do you think this would be possible? > > Best wishes, > -- > Kamil Debski > Samsung R&D Institute Poland I tried to convince Freescale to put the firmware into linux-firmware for 15 months now, but recently got no reply any more. Fabio, Shawn, could you try to discuss this with the responsible folks inside FSL again? Maybe responsibilities have changed in the meantime and I might have tried to talk to the wrong people. rsc -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi, > From: Philipp Zabel [mailto:p.za...@pengutronix.de] > Sent: Tuesday, July 01, 2014 7:53 PM > To: Nicolas Dufresne > Cc: linux-media@vger.kernel.org; Mauro Carvalho Chehab; Kamil Debski; > Fabio Estevam; ker...@pengutronix.de > Subject: Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support > for CODA960 > > Hi Nicolas, > > Am Dienstag, den 24.06.2014, 12:16 -0400 schrieb Nicolas Dufresne: > [...] > > > @@ -2908,6 +3183,7 @@ static void coda_timeout(struct work_struct > > > *work) static u32 coda_supported_firmwares[] = { > > > CODA_FIRMWARE_VERNUM(CODA_DX6, 2, 2, 5), > > > CODA_FIRMWARE_VERNUM(CODA_7541, 1, 4, 50), > > > + CODA_FIRMWARE_VERNUM(CODA_960, 2, 1, 5), > > > > Where can we find these firmwares ? > > The firmware images are distributed with an EULA in Freescale's BSPs > that can be downloaded from their website. The file you are looking for > is vpu_fw_imx6q.bin (for i.MX6Q/D) or vpu_fw_imx6d.bin (for i.MX6DL/S). > This has to be stripped of the 16-byte header and must be reordered to > fit the CODA memory access pattern by reversing the order of each set > of four 16-bit values (imagine little-endian 64-bit values made of four > 16-bit wide bytes). It would be really nice if the firmware was available in the linux-firmware repository. Do you think this would be possible? Best wishes, -- Kamil Debski Samsung R&D Institute Poland -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Hi Nicolas, Am Dienstag, den 24.06.2014, 12:16 -0400 schrieb Nicolas Dufresne: [...] > > @@ -2908,6 +3183,7 @@ static void coda_timeout(struct work_struct *work) > > static u32 coda_supported_firmwares[] = { > > CODA_FIRMWARE_VERNUM(CODA_DX6, 2, 2, 5), > > CODA_FIRMWARE_VERNUM(CODA_7541, 1, 4, 50), > > + CODA_FIRMWARE_VERNUM(CODA_960, 2, 1, 5), > > Where can we find these firmwares ? The firmware images are distributed with an EULA in Freescale's BSPs that can be downloaded from their website. The file you are looking for is vpu_fw_imx6q.bin (for i.MX6Q/D) or vpu_fw_imx6d.bin (for i.MX6DL/S). This has to be stripped of the 16-byte header and must be reordered to fit the CODA memory access pattern by reversing the order of each set of four 16-bit values (imagine little-endian 64-bit values made of four 16-bit wide bytes). regards Philipp -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Le mardi 24 juin 2014 à 16:55 +0200, Philipp Zabel a écrit : > This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs. > > It enables h.264 and MPEG4 encoding and decoding support. Besides the usual > register shifting, the CODA960 gains frame memory control and GDI registers > that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be > set beyond the number of internal buffers for some reason, and has subsampling > buffers that need to be set up. Also, the work buffer size is increased to > 80 KiB. > > The CODA960 firmware spins if there is not enough input data in the bitstream > buffer. To make it continue, buffers need to be copied into the bitstream as > soon as they are queued. As the bitstream fifo is written into from two > places, > it must be protected with a mutex. For that, using a threaded interrupt > handler > is necessary. > > Signed-off-by: Philipp Zabel > --- > drivers/media/platform/coda.c | 397 > +- > drivers/media/platform/coda.h | 115 +++- > 2 files changed, 464 insertions(+), 48 deletions(-) > > diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c > index 50051fe..2da7e29 100644 > --- a/drivers/media/platform/coda.c > +++ b/drivers/media/platform/coda.c > @@ -44,19 +44,24 @@ > #define CODA_FMO_BUF_SIZE32 > #define CODADX6_WORK_BUF_SIZE(288 * 1024 + CODA_FMO_BUF_SIZE * 8 * > 1024) > #define CODA7_WORK_BUF_SIZE (128 * 1024) > +#define CODA9_WORK_BUF_SIZE (80 * 1024) > #define CODA7_TEMP_BUF_SIZE (304 * 1024) > +#define CODA9_TEMP_BUF_SIZE (204 * 1024) > #define CODA_PARA_BUF_SIZE (10 * 1024) > #define CODA_ISRAM_SIZE (2048 * 2) > #define CODADX6_IRAM_SIZE0xb000 > #define CODA7_IRAM_SIZE 0x14000 > +#define CODA9_IRAM_SIZE 0x21000 > > #define CODA7_PS_BUF_SIZE0x28000 > +#define CODA9_PS_SAVE_SIZE (512 * 1024) > > #define CODA_MAX_FRAMEBUFFERS8 > > #define CODA_MAX_FRAME_SIZE 0x10 > #define FMO_SLICE_SAVE_BUF_SIZE (32) > #define CODA_DEFAULT_GAMMA 4096 > +#define CODA9_DEFAULT_GAMMA 24576 /* 0.75 * 32768 */ > > #define MIN_W 176 > #define MIN_H 144 > @@ -84,6 +89,7 @@ enum coda_inst_type { > enum coda_product { > CODA_DX6 = 0xf001, > CODA_7541 = 0xf012, > + CODA_960 = 0xf020, > }; > > struct coda_fmt { > @@ -177,6 +183,16 @@ struct coda_iram_info { > phys_addr_t next_paddr; > }; > > +struct gdi_tiled_map { > + int xy2ca_map[16]; > + int xy2ba_map[16]; > + int xy2ra_map[16]; > + int rbc2axi_map[32]; > + int xy2rbc_config; > + int map_type; > +#define GDI_LINEAR_FRAME_MAP 0 > +}; > + > struct coda_ctx { > struct coda_dev *dev; > struct mutexbuffer_mutex; > @@ -215,8 +231,10 @@ struct coda_ctx { > int idx; > int reg_idx; > struct coda_iram_info iram_info; > + struct gdi_tiled_maptiled_map; > u32 bit_stream_param; > u32 frm_dis_flg; > + u32 frame_mem_ctrl; > int display_idx; > }; > > @@ -265,15 +283,23 @@ static void coda_command_async(struct coda_ctx *ctx, > int cmd) > { > struct coda_dev *dev = ctx->dev; > > - if (dev->devtype->product == CODA_7541) { > + if (dev->devtype->product == CODA_960 || > + dev->devtype->product == CODA_7541) { > /* Restore context related registers to CODA */ > coda_write(dev, ctx->bit_stream_param, > CODA_REG_BIT_BIT_STREAM_PARAM); > coda_write(dev, ctx->frm_dis_flg, > CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx)); > + coda_write(dev, ctx->frame_mem_ctrl, > + CODA_REG_BIT_FRAME_MEM_CTRL); > coda_write(dev, ctx->workbuf.paddr, CODA_REG_BIT_WORK_BUF_ADDR); > } > > + if (dev->devtype->product == CODA_960) { > + coda_write(dev, 1, CODA9_GDI_WPROT_ERR_CLR); > + coda_write(dev, 0, CODA9_GDI_WPROT_RGN_EN); > + } > + > coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY); > > coda_write(dev, ctx->idx, CODA_REG_BIT_RUN_INDEX); > @@ -349,6 +375,13 @@ static struct coda_codec coda7_codecs[] = { > CODA_CODEC(CODA7_MODE_DECODE_MP4, V4L2_PIX_FMT_MPEG4, > V4L2_PIX_FMT_YUV420, 1920, 1080), > }; > > +static struct coda_codec coda9_codecs[] = { > + CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, > V4L2_PIX_FMT_H264, 1920, 1080), > + CODA_CODEC(CODA9_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, > V4L2_PIX_FMT_MPEG4, 1920, 1080), > + CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264, > V4L2_PIX_FMT_YUV420, 1920, 1080), > + CODA_CODEC(CODA9_MO
[PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs. It enables h.264 and MPEG4 encoding and decoding support. Besides the usual register shifting, the CODA960 gains frame memory control and GDI registers that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be set beyond the number of internal buffers for some reason, and has subsampling buffers that need to be set up. Also, the work buffer size is increased to 80 KiB. The CODA960 firmware spins if there is not enough input data in the bitstream buffer. To make it continue, buffers need to be copied into the bitstream as soon as they are queued. As the bitstream fifo is written into from two places, it must be protected with a mutex. For that, using a threaded interrupt handler is necessary. Signed-off-by: Philipp Zabel --- drivers/media/platform/coda.c | 397 +- drivers/media/platform/coda.h | 115 +++- 2 files changed, 464 insertions(+), 48 deletions(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 50051fe..2da7e29 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -44,19 +44,24 @@ #define CODA_FMO_BUF_SIZE 32 #define CODADX6_WORK_BUF_SIZE (288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 1024) #define CODA7_WORK_BUF_SIZE(128 * 1024) +#define CODA9_WORK_BUF_SIZE(80 * 1024) #define CODA7_TEMP_BUF_SIZE(304 * 1024) +#define CODA9_TEMP_BUF_SIZE(204 * 1024) #define CODA_PARA_BUF_SIZE (10 * 1024) #define CODA_ISRAM_SIZE(2048 * 2) #define CODADX6_IRAM_SIZE 0xb000 #define CODA7_IRAM_SIZE0x14000 +#define CODA9_IRAM_SIZE0x21000 #define CODA7_PS_BUF_SIZE 0x28000 +#define CODA9_PS_SAVE_SIZE (512 * 1024) #define CODA_MAX_FRAMEBUFFERS 8 #define CODA_MAX_FRAME_SIZE0x10 #define FMO_SLICE_SAVE_BUF_SIZE (32) #define CODA_DEFAULT_GAMMA 4096 +#define CODA9_DEFAULT_GAMMA24576 /* 0.75 * 32768 */ #define MIN_W 176 #define MIN_H 144 @@ -84,6 +89,7 @@ enum coda_inst_type { enum coda_product { CODA_DX6 = 0xf001, CODA_7541 = 0xf012, + CODA_960 = 0xf020, }; struct coda_fmt { @@ -177,6 +183,16 @@ struct coda_iram_info { phys_addr_t next_paddr; }; +struct gdi_tiled_map { + int xy2ca_map[16]; + int xy2ba_map[16]; + int xy2ra_map[16]; + int rbc2axi_map[32]; + int xy2rbc_config; + int map_type; +#define GDI_LINEAR_FRAME_MAP 0 +}; + struct coda_ctx { struct coda_dev *dev; struct mutexbuffer_mutex; @@ -215,8 +231,10 @@ struct coda_ctx { int idx; int reg_idx; struct coda_iram_info iram_info; + struct gdi_tiled_maptiled_map; u32 bit_stream_param; u32 frm_dis_flg; + u32 frame_mem_ctrl; int display_idx; }; @@ -265,15 +283,23 @@ static void coda_command_async(struct coda_ctx *ctx, int cmd) { struct coda_dev *dev = ctx->dev; - if (dev->devtype->product == CODA_7541) { + if (dev->devtype->product == CODA_960 || + dev->devtype->product == CODA_7541) { /* Restore context related registers to CODA */ coda_write(dev, ctx->bit_stream_param, CODA_REG_BIT_BIT_STREAM_PARAM); coda_write(dev, ctx->frm_dis_flg, CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx)); + coda_write(dev, ctx->frame_mem_ctrl, + CODA_REG_BIT_FRAME_MEM_CTRL); coda_write(dev, ctx->workbuf.paddr, CODA_REG_BIT_WORK_BUF_ADDR); } + if (dev->devtype->product == CODA_960) { + coda_write(dev, 1, CODA9_GDI_WPROT_ERR_CLR); + coda_write(dev, 0, CODA9_GDI_WPROT_RGN_EN); + } + coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY); coda_write(dev, ctx->idx, CODA_REG_BIT_RUN_INDEX); @@ -349,6 +375,13 @@ static struct coda_codec coda7_codecs[] = { CODA_CODEC(CODA7_MODE_DECODE_MP4, V4L2_PIX_FMT_MPEG4, V4L2_PIX_FMT_YUV420, 1920, 1080), }; +static struct coda_codec coda9_codecs[] = { + CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_H264, 1920, 1080), + CODA_CODEC(CODA9_MODE_ENCODE_MP4, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG4, 1920, 1080), + CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264, V4L2_PIX_FMT_YUV420, 1920, 1080), + CODA_CODEC(CODA9_MODE_DECODE_MP4, V4L2_PIX_FMT_MPEG4, V4L2_PIX_FMT_YUV420, 1920, 1080), +}; + static bool coda_format_is_yuv(u32 fourcc) { switch (fourcc) { @@ -427,6 +460,8 @@ static char *coda_product_name(int product)