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 X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB397C43387 for ; Wed, 9 Jan 2019 10:12:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A88B220883 for ; Wed, 9 Jan 2019 10:12:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ix+zAUg1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="JlOkbYHq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A88B220883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cwl+8VtLORIUM++/LKwJg3utDz/HmfFTii1J8eTmIEc=; b=ix+zAUg1ZkX2cQ /5o29uSPAm6CtAUKgHH0VLQZftM1ylJDjPb+uKyuw0TFKEFZT9KzX+Bx2rV8j9EPIkC+SFOY0yIuY j2kRFk2rbxzoacPEz3Td/X1CTZ5yNWPtcsgjeJkg6SLUPKoFCvbzp+U1NaJhqaFgq/b4Ol6HGz2vu sKoq4S3RJE3LEgvpGOyJlnHjltDsS/TZukChA0AgOgFMSjwt0BjTQt+7JxpNcYRk0ldw1Nlwkza8g HDEBquoiHnHOBFZhl84i9i5I8QX6/iARLIVUaqwBNI1bsSAqDL6x49fwSvO79WDSi6+EIV+QlcA+o Fdo99vB4qiEXUZ3pDWww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghAqf-0007bU-Bm; Wed, 09 Jan 2019 10:12:33 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghAqb-0007ab-O3 for linux-arm-kernel@lists.infradead.org; Wed, 09 Jan 2019 10:12:31 +0000 Received: by mail-ed1-x544.google.com with SMTP id f9so6791501eds.10 for ; Wed, 09 Jan 2019 02:12:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=oj+JtWeU8zvsVuS3Om8StAQI7g0mMGfBcOrF313LwcI=; b=JlOkbYHqRaibeoV/Q2SHzwQpAyFqKFNAjlptIr9ZSuRBcKb3IovdrhDIdbLXT+Bzur YgIj+eKnqstpYFBqW+UAvzviFpjiYtWBq4o55fbsxP1jvS6hSEUfT6uRA52+eZ6PYx9w xooQYPD53sNOYI1AVPZQtCfegl99opDfLZHpc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=oj+JtWeU8zvsVuS3Om8StAQI7g0mMGfBcOrF313LwcI=; b=F1mmf0nlnWifSlE/9nBNLvjwJCCa8Ex/+QK3vqzGukB1sB1T3ewi3qnUqx6LJsmEo9 ig69AmIm1wFXEqRBz76YOf6VFbMR9L2S9OGskOeNB2qcr7xpCEkzz3Eyqc8vCEU7i0Z6 ABzt+wh5NDaOFKTvmKFVu33SCHyobGQfSPIdSUPicVL0jaAT8EPw14G0JwkidlDPe5u2 xwrfYhYsfa9IZ4bZnIvIAbg59EaB6Z3Gvkk3Mmp2CJ3CliSXHXGfeL7OAWLrbU5FTeuZ Tp2eJIMdmVE7s5ZseaCul57nYLM90H1sFkB7Mny48OFkWkHeA4Uwi6GQ4rdJsm4TyLlO hU2Q== X-Gm-Message-State: AJcUukcQQ8CwLDvE8ydIc4EGb+nB1lJHSnbKEMS5ljjRtQDtfGAqaqrR HxsqAceKpzbT7tfQVtglIClPGw== X-Google-Smtp-Source: ALg8bN4XvgTTDiBxSG8f9miuV/7n4uRxfO/5fLLJnOztcGvuLSNuNMWYdpnIcxVbVbqxKMP+qUnOZw== X-Received: by 2002:a50:a55c:: with SMTP id z28mr5414490edb.124.1547028747626; Wed, 09 Jan 2019 02:12:27 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id v11sm839438edy.49.2019.01.09.02.12.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Jan 2019 02:12:26 -0800 (PST) Date: Wed, 9 Jan 2019 11:12:24 +0100 From: Daniel Vetter To: Peter Rosin Subject: Re: [PATCH] drm/atmel-hlcdc: prevent divide by zero Message-ID: <20190109101224.GT21184@phenom.ffwll.local> Mail-Followup-To: Peter Rosin , "linux-kernel@vger.kernel.org" , Alexandre Belloni , David Airlie , Nicolas Ferre , "dri-devel@lists.freedesktop.org" , Boris Brezillon , "linux-arm-kernel@lists.infradead.org" References: <20190108123129.20031-1-peda@axentia.se> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190108123129.20031-1-peda@axentia.se> X-Operating-System: Linux phenom 4.18.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190109_021229_780807_A7E1973B X-CRM114-Status: GOOD ( 20.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , David Airlie , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Boris Brezillon , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 08, 2019 at 12:31:36PM +0000, Peter Rosin wrote: > While trying to temporarily hide a plane, one thing that was attempted > was to call (from libdrm) > > drmModeSetPlane(fd, plane_id, crtc_id, fb_id, 0, > 0, 0, 0, 0, 0, 0, 0, 0); > > This call causes a pair of "Division by zero in kernel." messages. Kill > those messages, but preserve the current behaviour that also happen to > make the plane disappear with the above call. > > Signed-off-by: Peter Rosin > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > Side note, when comparing with drm_atomic_helper_check_plane_state(), I get > the feeling that the src rect should be clipped together with the crtc rect > if/when clipping is needed. That function calls drm_rect_clip_scaled(), and > the equivalent does not seem to happen here. Should clipping be performed > on the src rect? Any reasons atmel can't switch over to that helper? Would compute a nice ->visible state variable for you ... -Daniel > > Cheers, > Peter > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > index 3cc489b870fe..1bdb30dc218c 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > @@ -675,10 +675,16 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, > state->crtc_y = 0; > } > > - patched_src_w = DIV_ROUND_CLOSEST(patched_crtc_w * state->src_w, > - state->crtc_w); > - patched_src_h = DIV_ROUND_CLOSEST(patched_crtc_h * state->src_h, > - state->crtc_h); > + if (state->crtc_w) > + patched_src_w = DIV_ROUND_CLOSEST(patched_crtc_w * state->src_w, > + state->crtc_w); > + else > + patched_src_w = 0; > + if (state->crtc_h) > + patched_src_h = DIV_ROUND_CLOSEST(patched_crtc_h * state->src_h, > + state->crtc_h); > + else > + patched_src_h = 0; > > hsub = drm_format_horz_chroma_subsampling(fb->format->format); > vsub = drm_format_vert_chroma_subsampling(fb->format->format); > -- > 2.11.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel