From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE44C54EED for ; Tue, 24 Jan 2023 21:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234895AbjAXVUA (ORCPT ); Tue, 24 Jan 2023 16:20:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235079AbjAXVTt (ORCPT ); Tue, 24 Jan 2023 16:19:49 -0500 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C605518CE for ; Tue, 24 Jan 2023 13:19:47 -0800 (PST) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9B8CD85695; Tue, 24 Jan 2023 22:19:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1674595184; bh=3zLG2SAoZbp0/KJeFi85r/F4UncIB7fHEaEWRMcT5K8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Xi2tUnTe8KcsRDoq1xC3q1XG9PCwVJN4Xl/ym6GjUasvdr96RLXTUh7wMSJmUDbmg /kHLc1IHnheJLpki3RHvQpRNhl5Btnmbn1Q8/wnAu7vvgmmLU2REwnI85quPOYk6KS RAuByN4SOcbRIynR0Z1/VBDW+2ZF+C7FnPUvAA/ZHovkFBLxm+dxjNr07ZsoWaOH6x ognzcnmd2QUTS8wLINVlixryxri2vRuWDHcbaxJvlGFVusb5FN9HqtmLQyxYkUa7iu wh6glmAJB9y9ZcpsCjEuik9XAjGx2mHVaQ/p+N2xXqMrF+LGFycxEw/64RYB1YQRGF rsIrAAOTDDk/Q== Message-ID: Date: Tue, 24 Jan 2023 22:19:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RESEND PATCH v11 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts Content-Language: en-US To: Jagan Teki Cc: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula References: <20230123151212.269082-1-jagan@amarulasolutions.com> <20230123151212.269082-12-jagan@amarulasolutions.com> <75b01e4c-5994-5931-7030-ab86705d67b3@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On 1/24/23 22:16, Jagan Teki wrote: > On Wed, Jan 25, 2023 at 2:15 AM Marek Vasut wrote: >> >> On 1/23/23 16:12, Jagan Teki wrote: >> >> [...] >> >>> +static bool exynos_dsi_pixel_output_fmt_supported(u32 fmt) >>> +{ >>> + int i; >> >> if (fmt == MEDIA_BUS_FMT_FIXED) >> return false; >> >>> + for (i = 0; i < ARRAY_SIZE(exynos_dsi_pixel_output_fmts); i++) { >>> + if (exynos_dsi_pixel_output_fmts[i] == fmt) >>> + return true; >>> + } >>> + >>> + return false; >>> +} >>> + >>> +static u32 * >>> +exynos_dsi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, >>> + struct drm_bridge_state *bridge_state, >>> + struct drm_crtc_state *crtc_state, >>> + struct drm_connector_state *conn_state, >>> + u32 output_fmt, >>> + unsigned int *num_input_fmts) >>> +{ >>> + u32 *input_fmts; >>> + >>> + if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) >>> + /* >>> + * Some bridge/display drivers are still not able to pass the >>> + * correct format, so handle those pipelines by falling back >>> + * to the default format till the supported formats finalized. >>> + */ >>> + output_fmt = MEDIA_BUS_FMT_RGB888_1X24; >> >> You can move this ^ past the kmalloc() call, so in unlikely case the >> kmalloc() fails, it would fail first. > > I didn't get this point, what do we need to do if > exynos_dsi_pixel_output_fmt_supported returns false? { u32 *input_fmts; input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); if (!input_fmts) return NULL; if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) /* ... the comment ... */ output_fmt = MEDIA_BUS_FMT_RGB888_1X24; input_fmts[0] = output_fmt; *num_input_fmts = 1; return input_fmts; } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8AEBC54EED for ; Tue, 24 Jan 2023 21:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JFEEP/macXHyDcjxzwj2RLVrnpxANeYh04urfMfSfAE=; b=YnRoMI8qYy3r8N X8YEsRbyWQHYZn1Tlwgaf6mB0qN1mHB934ERM48opaGOo5GkVHx/eJHJt2UdbQXMiDhzOkoatR+ml G/D1M436N/0qZpRNUjsBX9NGzaoQrycLGXF0iOMYx7CaLRadgR9j9F2nezy70bmNA+9uRIiFuPofd K5Iie+dVC/QslNluLNCH89fGnkKzxJGFbqORH/Eq+OB6I/pkIfn4Z+ov++gG/aU55F94tXGjK83ey XiXu7OCLG6BZG+OryEd14jSpNbL/0pJNNs6Ld8h+CcnNqE+xxZXCgW4nZn+GCfl9+VedlNdCj9dQ8 m4A77ZJe3QXLMXUxSFsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKQhq-005Ny1-R5; Tue, 24 Jan 2023 21:19:50 +0000 Received: from phobos.denx.de ([85.214.62.61]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKQhm-005Nw0-VZ for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 21:19:48 +0000 Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9B8CD85695; Tue, 24 Jan 2023 22:19:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1674595184; bh=3zLG2SAoZbp0/KJeFi85r/F4UncIB7fHEaEWRMcT5K8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Xi2tUnTe8KcsRDoq1xC3q1XG9PCwVJN4Xl/ym6GjUasvdr96RLXTUh7wMSJmUDbmg /kHLc1IHnheJLpki3RHvQpRNhl5Btnmbn1Q8/wnAu7vvgmmLU2REwnI85quPOYk6KS RAuByN4SOcbRIynR0Z1/VBDW+2ZF+C7FnPUvAA/ZHovkFBLxm+dxjNr07ZsoWaOH6x ognzcnmd2QUTS8wLINVlixryxri2vRuWDHcbaxJvlGFVusb5FN9HqtmLQyxYkUa7iu wh6glmAJB9y9ZcpsCjEuik9XAjGx2mHVaQ/p+N2xXqMrF+LGFycxEw/64RYB1YQRGF rsIrAAOTDDk/Q== Message-ID: Date: Tue, 24 Jan 2023 22:19:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RESEND PATCH v11 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts Content-Language: en-US To: Jagan Teki Cc: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula References: <20230123151212.269082-1-jagan@amarulasolutions.com> <20230123151212.269082-12-jagan@amarulasolutions.com> <75b01e4c-5994-5931-7030-ab86705d67b3@denx.de> From: Marek Vasut In-Reply-To: X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230124_131947_436071_9FCCF79F X-CRM114-Status: GOOD ( 18.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/24/23 22:16, Jagan Teki wrote: > On Wed, Jan 25, 2023 at 2:15 AM Marek Vasut wrote: >> >> On 1/23/23 16:12, Jagan Teki wrote: >> >> [...] >> >>> +static bool exynos_dsi_pixel_output_fmt_supported(u32 fmt) >>> +{ >>> + int i; >> >> if (fmt == MEDIA_BUS_FMT_FIXED) >> return false; >> >>> + for (i = 0; i < ARRAY_SIZE(exynos_dsi_pixel_output_fmts); i++) { >>> + if (exynos_dsi_pixel_output_fmts[i] == fmt) >>> + return true; >>> + } >>> + >>> + return false; >>> +} >>> + >>> +static u32 * >>> +exynos_dsi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, >>> + struct drm_bridge_state *bridge_state, >>> + struct drm_crtc_state *crtc_state, >>> + struct drm_connector_state *conn_state, >>> + u32 output_fmt, >>> + unsigned int *num_input_fmts) >>> +{ >>> + u32 *input_fmts; >>> + >>> + if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) >>> + /* >>> + * Some bridge/display drivers are still not able to pass the >>> + * correct format, so handle those pipelines by falling back >>> + * to the default format till the supported formats finalized. >>> + */ >>> + output_fmt = MEDIA_BUS_FMT_RGB888_1X24; >> >> You can move this ^ past the kmalloc() call, so in unlikely case the >> kmalloc() fails, it would fail first. > > I didn't get this point, what do we need to do if > exynos_dsi_pixel_output_fmt_supported returns false? { u32 *input_fmts; input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); if (!input_fmts) return NULL; if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) /* ... the comment ... */ output_fmt = MEDIA_BUS_FMT_RGB888_1X24; input_fmts[0] = output_fmt; *num_input_fmts = 1; return input_fmts; } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9734EC54EED for ; Tue, 24 Jan 2023 21:19:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B4FB10E6FA; Tue, 24 Jan 2023 21:19:48 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B36310E6FA for ; Tue, 24 Jan 2023 21:19:46 +0000 (UTC) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9B8CD85695; Tue, 24 Jan 2023 22:19:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1674595184; bh=3zLG2SAoZbp0/KJeFi85r/F4UncIB7fHEaEWRMcT5K8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Xi2tUnTe8KcsRDoq1xC3q1XG9PCwVJN4Xl/ym6GjUasvdr96RLXTUh7wMSJmUDbmg /kHLc1IHnheJLpki3RHvQpRNhl5Btnmbn1Q8/wnAu7vvgmmLU2REwnI85quPOYk6KS RAuByN4SOcbRIynR0Z1/VBDW+2ZF+C7FnPUvAA/ZHovkFBLxm+dxjNr07ZsoWaOH6x ognzcnmd2QUTS8wLINVlixryxri2vRuWDHcbaxJvlGFVusb5FN9HqtmLQyxYkUa7iu wh6glmAJB9y9ZcpsCjEuik9XAjGx2mHVaQ/p+N2xXqMrF+LGFycxEw/64RYB1YQRGF rsIrAAOTDDk/Q== Message-ID: Date: Tue, 24 Jan 2023 22:19:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RESEND PATCH v11 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts Content-Language: en-US To: Jagan Teki References: <20230123151212.269082-1-jagan@amarulasolutions.com> <20230123151212.269082-12-jagan@amarulasolutions.com> <75b01e4c-5994-5931-7030-ab86705d67b3@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Laurent Pinchart , Joonyoung Shim , Tommaso Merciai , linux-amarula , Seung-Woo Kim , Neil Armstrong , Frieder Schrempf , Kyungmin Park , Matteo Lisi , Robert Foss , Andrzej Hajda , NXP Linux Team , Fancy Fang , Michael Nazzareno Trimarchi , Adam Ford , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 1/24/23 22:16, Jagan Teki wrote: > On Wed, Jan 25, 2023 at 2:15 AM Marek Vasut wrote: >> >> On 1/23/23 16:12, Jagan Teki wrote: >> >> [...] >> >>> +static bool exynos_dsi_pixel_output_fmt_supported(u32 fmt) >>> +{ >>> + int i; >> >> if (fmt == MEDIA_BUS_FMT_FIXED) >> return false; >> >>> + for (i = 0; i < ARRAY_SIZE(exynos_dsi_pixel_output_fmts); i++) { >>> + if (exynos_dsi_pixel_output_fmts[i] == fmt) >>> + return true; >>> + } >>> + >>> + return false; >>> +} >>> + >>> +static u32 * >>> +exynos_dsi_atomic_get_input_bus_fmts(struct drm_bridge *bridge, >>> + struct drm_bridge_state *bridge_state, >>> + struct drm_crtc_state *crtc_state, >>> + struct drm_connector_state *conn_state, >>> + u32 output_fmt, >>> + unsigned int *num_input_fmts) >>> +{ >>> + u32 *input_fmts; >>> + >>> + if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) >>> + /* >>> + * Some bridge/display drivers are still not able to pass the >>> + * correct format, so handle those pipelines by falling back >>> + * to the default format till the supported formats finalized. >>> + */ >>> + output_fmt = MEDIA_BUS_FMT_RGB888_1X24; >> >> You can move this ^ past the kmalloc() call, so in unlikely case the >> kmalloc() fails, it would fail first. > > I didn't get this point, what do we need to do if > exynos_dsi_pixel_output_fmt_supported returns false? { u32 *input_fmts; input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); if (!input_fmts) return NULL; if (!exynos_dsi_pixel_output_fmt_supported(output_fmt)) /* ... the comment ... */ output_fmt = MEDIA_BUS_FMT_RGB888_1X24; input_fmts[0] = output_fmt; *num_input_fmts = 1; return input_fmts; }