From patchwork Mon Feb 20 10:19:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 10004 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1RzQLQ-0006Hj-KT for patchwork@linuxtv.org; Mon, 20 Feb 2012 11:19:44 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp for id 1RzQLP-0005MH-Ch; Mon, 20 Feb 2012 11:19:44 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519Ab2BTKTl (ORCPT ); Mon, 20 Feb 2012 05:19:41 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:16319 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752492Ab2BTKTl (ORCPT ); Mon, 20 Feb 2012 05:19:41 -0500 Received: from euspt1 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LZO00JIDSORJJ@mailout2.w1.samsung.com> for linux-media@vger.kernel.org; Mon, 20 Feb 2012 10:19:39 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LZO00406SORNH@spt1.w1.samsung.com> for linux-media@vger.kernel.org; Mon, 20 Feb 2012 10:19:39 +0000 (GMT) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id B9EC2270003; Mon, 20 Feb 2012 11:20:38 +0100 (CET) Date: Mon, 20 Feb 2012 11:19:34 +0100 From: Andrzej Pietrasiewicz Subject: [PATCH] s5p-jpeg: Adapt to new controls To: linux-media@vger.kernel.org Cc: Andrzej Pietrasiewicz , Kyungmin Park , Marek Szyprowski , Sylwester Nawrocki Message-id: <1329733174-21608-1-git-send-email-andrzej.p@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.2.20.100314 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' BODY_PARA_IS_SENTENCE_URL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NS ' Adapt to new controls (subsampling) This is a follow up to http://www.spinics.net/lists/linux-media/msg44348.html For encoding, the destination format now needs to be set to V4L2_PIX_FMT_JPEG and the subsampling (4:2:2 or 4:2:0) needs to be set using the respective control (V4L2_CID_JPEG_CHROMA_SUBSAMPLING). Required buffer size for destination image during encoding is no longer deduced from the format (which generally implied overestimation), but needs to be given from userspace in sizeimage. Not strictly related to the added controls, this patch also fixes setting the subsampling of the destination image for decoding, depending on the destination format. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park --- drivers/media/video/s5p-jpeg/jpeg-core.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/s5p-jpeg/jpeg-core.c b/drivers/media/video/s5p-jpeg/jpeg-core.c index c104aeb..5a49c30 100644 --- a/drivers/media/video/s5p-jpeg/jpeg-core.c +++ b/drivers/media/video/s5p-jpeg/jpeg-core.c @@ -32,10 +32,9 @@ static struct s5p_jpeg_fmt formats_enc[] = { { - .name = "YUV 4:2:0 planar, YCbCr", - .fourcc = V4L2_PIX_FMT_YUV420, - .depth = 12, - .colplanes = 3, + .name = "JPEG JFIF", + .fourcc = V4L2_PIX_FMT_JPEG, + .colplanes = 1, .types = MEM2MEM_CAPTURE, }, { @@ -43,7 +42,7 @@ static struct s5p_jpeg_fmt formats_enc[] = { .fourcc = V4L2_PIX_FMT_YUYV, .depth = 16, .colplanes = 1, - .types = MEM2MEM_CAPTURE | MEM2MEM_OUTPUT, + .types = MEM2MEM_OUTPUT, }, { .name = "RGB565", @@ -1025,11 +1024,14 @@ static void s5p_jpeg_device_run(void *priv) jpeg_htbl_dc(jpeg->regs, 2); jpeg_htbl_ac(jpeg->regs, 3); jpeg_htbl_dc(jpeg->regs, 3); - } else { + } else { /* S5P_JPEG_DECODE */ jpeg_rst_int_enable(jpeg->regs, true); jpeg_data_num_int_enable(jpeg->regs, true); jpeg_final_mcu_num_int_enable(jpeg->regs, true); - jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_422); + if (ctx->cap_q.fmt->fourcc == V4L2_PIX_FMT_YUYV) + jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_422); + else + jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_420); jpeg_jpgadr(jpeg->regs, src_addr); jpeg_imgadr(jpeg->regs, dst_addr); } @@ -1269,6 +1271,7 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id) curr_ctx->subsampling = jpeg_get_subsampling_mode(jpeg->regs); spin_unlock(&jpeg->slock); + jpeg_clear_int(jpeg->regs); return IRQ_HANDLED;