From patchwork Fri Jul 25 14:20:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 4623481 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2976CC033C for ; Fri, 25 Jul 2014 14:21:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E80962020E for ; Fri, 25 Jul 2014 14:21:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0FE1D20211 for ; Fri, 25 Jul 2014 14:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752615AbaGYOVa (ORCPT ); Fri, 25 Jul 2014 10:21:30 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:61852 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760469AbaGYOV2 (ORCPT ); Fri, 25 Jul 2014 10:21:28 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9900MOBUJRIA30@mailout4.samsung.com>; Fri, 25 Jul 2014 23:21:27 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-6d-53d267e70e55 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B4.1E.04943.7E762D35; Fri, 25 Jul 2014 23:21:27 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N99004WBUIW3L00@mmp2.samsung.com>; Fri, 25 Jul 2014 23:21:27 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, j.anaszewski@samsung.com, Sylwester Nawrocki Subject: [PATCH v3 6/9] s5p-jpeg: Assure proper crop rectangle initialization Date: Fri, 25 Jul 2014 16:20:50 +0200 Message-id: <1406298053-30184-7-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1406298053-30184-1-git-send-email-s.nawrocki@samsung.com> References: <1406298053-30184-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPJMWRmVeSWpSXmKPExsVy+t9jQd3n6ZeCDY43i1v0Xn3OaNGzYSur xYzz+5gsDr9pZ3Vg8ejbsorR4/MmuQCmKC6blNSczLLUIn27BK6M1zOOsRfs4K5YcZGngfEo ZxcjB4eEgInE0Rd5XYycQKaYxIV769lAbCGB6YwS9/8LQdgdTBJvtsWB2GwChhK9R/sYQWwR AXmJJ703wOqZBfIkvn56zgQyUljAV2LvFLByFgFViQX9D5lAbF4BN4kv8zqYILYqSMyZZANi cgq4SxyaZgWxyE1i9dK3TBMYeRcwMqxiFE0tSC4oTkrPNdQrTswtLs1L10vOz93ECA6GZ1I7 GFc2WBxiFOBgVOLh7ai/GCzEmlhWXJl7iFGCg1lJhNco/lKwEG9KYmVValF+fFFpTmrxIUZp DhYlcd4DrdaBQgLpiSWp2ampBalFMFkmDk6pBsaurSVdzP9D36u8cztX5NC2uX+1h7B7vuKr afl/V/tNd1u2PPb61MvFW43WR89eMs3DrjLON9PfZ/352+o1wa/Pzd6hw67AlST4WDelXJtb fJ5ex5zDa1S7RR7c0DVV+PD1c9zeJQ43ny2Zcf/61pBvu/yZuR1OK0SpP3kgwbvx27+O+woi F34qsRRnJBpqMRcVJwIAWKvnlAICAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jacek Anaszewski Assure proper crop_rect initialization in case the user space doesn't call S_SELECTION ioctl. Signed-off-by: Jacek Anaszewski Signed-off-by: Sylwester Nawrocki --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index d11357f..3e3d94d 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f) V4L2_CID_JPEG_CHROMA_SUBSAMPLING); if (ctrl_subs) v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling); + ct->crop_altered = false; + } + + /* + * For decoding init crop_rect with capture buffer dimmensions which + * contain aligned dimensions of the input JPEG image and do it only + * if crop rectangle hasn't been altered by the user space e.g. with + * S_SELECTION ioctl. For encoding assign output buffer dimensions. + */ + if (!ct->crop_altered && + ((ct->mode == S5P_JPEG_DECODE && f_type == FMT_TYPE_CAPTURE) || + (ct->mode == S5P_JPEG_ENCODE && f_type == FMT_TYPE_OUTPUT))) { + ct->crop_rect.width = pix->width; + ct->crop_rect.height = pix->height; + } } return 0;