From patchwork Tue Sep 6 04:02:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9315477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F34B060760 for ; Tue, 6 Sep 2016 04:02:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5EDC28B34 for ; Tue, 6 Sep 2016 04:02:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DABDC28B3D; Tue, 6 Sep 2016 04:02:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A590428B34 for ; Tue, 6 Sep 2016 04:02:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9119F6E524; Tue, 6 Sep 2016 04:02:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5F0D6E524 for ; Tue, 6 Sep 2016 04:02:50 +0000 (UTC) Received: from trochilidae.lan (unknown [IPv6:2601:602:8802:504f:3e97:eff:fe92:db3b]) by mail.kmu-office.ch (Postfix) with ESMTPSA id D7AF25C0BFB; Tue, 6 Sep 2016 05:57:37 +0200 (CEST) From: Stefan Agner To: dri-devel@lists.freedesktop.org, meng.yi@nxp.com Subject: [PATCH 2/4] drm/fsl-dcu: respect pos/size register sizes Date: Mon, 5 Sep 2016 21:02:31 -0700 Message-Id: <20160906040233.32471-3-stefan@agner.ch> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160906040233.32471-1-stefan@agner.ch> References: <20160906040233.32471-1-stefan@agner.ch> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1473134259; bh=/+aQZvutwBUB8EOCADoRWN71gKwkf2rGeH+UCNdqXk4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=nI3ApZCKYDEI5o+J0my1Uul94UcxeR49mrfARKfo8QpsSduphcqYGQjcqmdhzQB9DpiOk5u+vriDpHvYlj5HswHp/MUtpPBiqTbRuTD7qGhCRun3wtMRchq3FobdPAlvvepSyVmHOEzrPPqVn4GiKWTEFdlRasUS4wFV028WesI= Cc: jianwei.wang.chn@gmail.com, linux-kernel@vger.kernel.org, alison.wang@freescale.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Mask the size and position values to avoid mutual overwriting. Especially, a negative X position caused the Y position to be overwritten with 0xfff too. This has been observed when using a layer as cursor layer. Signed-off-by: Stefan Agner --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h index 3b371fe7..060f881 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h @@ -118,11 +118,11 @@ #define DCU_CTRLDESCLN(layer, reg) (0x200 + (reg - 1) * 4 + (layer) * 0x40) -#define DCU_LAYER_HEIGHT(x) ((x) << 16) -#define DCU_LAYER_WIDTH(x) (x) +#define DCU_LAYER_HEIGHT(x) (((x) & 0x7ff) << 16) +#define DCU_LAYER_WIDTH(x) ((x) & 0x7ff) -#define DCU_LAYER_POSY(x) ((x) << 16) -#define DCU_LAYER_POSX(x) (x) +#define DCU_LAYER_POSY(x) (((x) & 0xfff) << 16) +#define DCU_LAYER_POSX(x) ((x) & 0xfff) #define DCU_LAYER_EN BIT(31) #define DCU_LAYER_TILE_EN BIT(30)