From patchwork Wed Feb 28 15:06:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 130007 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1176361lja; Wed, 28 Feb 2018 07:52:19 -0800 (PST) X-Google-Smtp-Source: AG47ELvkjWNZlhg0590/DhlocwxMJOCNFbcdMIRsML8ROknSIFx2OoIkHSsYnZtub5411dn5O/iX X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr10316320pld.359.1519833138783; Wed, 28 Feb 2018 07:52:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833138; cv=none; d=google.com; s=arc-20160816; b=XPi1gBZVdvTnBn6pe2dIVJhUzCHrlQBlrb6Ac/RFJXBa3DmqzqihKKLLYgk3o2QaDQ sVT/Hblf7vdRtV1kVsmi3+pIMewjJUMDq3YqLL/BOa0QASJ2aP9dD2uoNdA3+3GLlGfV 8WdtKyPcUSoKoWg4SwXUV0DeYr4MesR7iNHGvRBUOACmfVuUJZGLWBoLCTOwNhUdAAk0 9SOY+UHjgUO2tT/Gn2VqTcSvXPHxkBrKaBNgot4kd7AUf6hDqw9Vj52SNG2QTnbF7THI DZIX0aQ8NNMjM5myxJqtjnZYgN2E+NSn9/+Qi/fKYmfoiRQ60TGHILAq5bMXkv4FtaE3 cvvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=85E1wTMTk3qzdWlFz7x9XFEwdZZL8bf1kuRiHRA2Vhs=; b=l3+VA6oT/IdWhiOYKx+gyqbTGq/9A352dj5IjHrb+IMEWmTc5iollT9D23bt1ym+tB fRyWZwjI3NSbQ/GzNKDrXyb1YpOKS1R85Vluqg6RY+Yn3xHIfNUEWPZ9pO6oVQO2Lyx8 lo6nH47muKBL+Czf/VKayHxCQ+K+1tyrXdpohEtmwplboC+vyvi/7VgunTms1CMY3NCz LljY+5g8Xc2xIwIvAVOcIegzxDZ+lkqd0dCxATazyPp7JrqTf9zZkIKV7390SL5NyW9K gLrFw9KEs4TJf1mo/B7wyIzvuW+ZGlbcAMNl+UNlwNL7e+re0y77g6j81MgC+PdOnO8K 2Amg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r20si1436986pfk.125.2018.02.28.07.52.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 07:52:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6810A6EAAF; Wed, 28 Feb 2018 15:51:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E7B36EAAF for ; Wed, 28 Feb 2018 15:51:45 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w1SF6R72032695; Wed, 28 Feb 2018 15:06:27 GMT From: Liviu Dudau To: DRI-devel Subject: [PATCH 01/23] drm/mali-dp: Rotated planes need a larger pitch size. Date: Wed, 28 Feb 2018 15:06:27 +0000 Message-Id: <20180228150627.20769-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , Liviu Dudau , Alexandru-Cosmin Gheorghe , Mali DP Maintainers MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rotated planes need a pitch size that is aligned to 8 bytes for older DP500 and DP550 and at least 64 bytes for DP650. Replace the malidp_hw_pitch_valid() function with one that calculates the correct pitch alignment to take into account rotation. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_hw.h | 12 +++++++++--- drivers/gpu/drm/arm/malidp_planes.c | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_hw.h b/drivers/gpu/drm/arm/malidp_hw.h index b0690ebb3565..42d3e7b9ba98 100644 --- a/drivers/gpu/drm/arm/malidp_hw.h +++ b/drivers/gpu/drm/arm/malidp_hw.h @@ -285,10 +285,16 @@ void malidp_se_irq_fini(struct drm_device *drm); u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map, u8 layer_id, u32 format); -static inline bool malidp_hw_pitch_valid(struct malidp_hw_device *hwdev, - unsigned int pitch) +static inline u8 malidp_hw_get_pitch_align(struct malidp_hw_device *hwdev, bool rotated) { - return !(pitch & (hwdev->hw->map.bus_align_bytes - 1)); + /* + * only hardware that cannot do 8 bytes bus alignments have further + * constraints on rotated planes + */ + if (hwdev->hw->map.bus_align_bytes == 8) + return 8; + else + return hwdev->hw->map.bus_align_bytes << (rotated ? 2 : 0); } /* U16.16 */ diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 2885d69af456..6f05c6421ba8 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -180,6 +180,7 @@ static int malidp_de_plane_check(struct drm_plane *plane, { struct malidp_plane *mp = to_malidp_plane(plane); struct malidp_plane_state *ms = to_malidp_plane_state(state); + bool rotated = state->rotation & MALIDP_ROTATED_MASK; struct drm_framebuffer *fb; int i, ret; @@ -196,7 +197,8 @@ static int malidp_de_plane_check(struct drm_plane *plane, ms->n_planes = fb->format->num_planes; for (i = 0; i < ms->n_planes; i++) { - if (!malidp_hw_pitch_valid(mp->hwdev, fb->pitches[i])) { + u8 alignment = malidp_hw_get_pitch_align(mp->hwdev, rotated); + if (fb->pitches[i] & (alignment - 1)) { DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n", fb->pitches[i], i); return -EINVAL; From patchwork Wed Feb 28 15:07:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 130008 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1176394lja; Wed, 28 Feb 2018 07:52:20 -0800 (PST) X-Google-Smtp-Source: AH8x224Qk+/5TndJBSN47Yu9q2wNitY/ohGQXvGdl2QJfEKAPLhCiG4gfY0MzuHorrk0jejvMipc X-Received: by 10.101.101.138 with SMTP id u10mr14196476pgv.299.1519833140766; Wed, 28 Feb 2018 07:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833140; cv=none; d=google.com; s=arc-20160816; b=lQwufUgMXZKkZEHB5TOfKc9y755684G6dw/0enixwQwjdp4cvS+p8P8KljYG+vhRnq QSjTUP6vJSkR31hz5rUI1YKtKC9OnHfeeSyHxvbsU9KQb9NYfwlw3ZZbR0iSWnYN1O6x M7Nzf7CunJCAe0MCrKRQGe86ItRqeo3wQ9nmwn3e9k93wa8OxiXi2JxPGgBDM7tgwdt5 e7Mg8S/8nghp3KG9rPZADlKJAvY6fXc0ZtbYErWS6MH1/6j3BquqqwTL1N/heTKMqwx1 tb+3aSXcUFRXDSMhkB53H+VmSKROH+CG72F8YqYKhh4vpsX3MiR9rajw8Y4FVdNhqzqf YgqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=JSba3BhGKSKU//vw4t4Vref9ENaKZwfgsbIk1a7vUaQ=; b=hxzwgsKMzLzbouk8LCUfCQhVEwcgYq0gmRig4HQ+mIMU2fag4KjvlXBd5jgZ6tZfnD KGGYSC24ImcTx4ZOM75LHgSvCFazB4/bJpYJZp603dfAKdhT8jgjeYOK9fZ+GQwJduzK 9PUSn5es+Ww75CE9L126HLfw59l8dIMQTZf5c7lgZrtAH6IANJ1vrFOJZ4fTID4/VLG2 5Twc4dD3JR9n9ukWWEOWTOEROGFWIyC0VSGOSdjGsU3K0apL2y8qNLZvv/Pvkr2j8oyE wU4fyTCTYUXX2Js5I6ZsD3Yjk181NcNqOoWSvt5UyKPXolQV0k5J7hSeYBVrbZP9Zah+ szXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g16-v6si1448641plo.369.2018.02.28.07.52.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 07:52:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1346B6EAB4; Wed, 28 Feb 2018 15:51:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B3C86EAA7 for ; Wed, 28 Feb 2018 15:51:44 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w1SF7YJf001272; Wed, 28 Feb 2018 15:07:34 GMT From: Liviu Dudau To: DRI-devel Subject: [PATCH 02/23] drm/mali-dp: Align pitch size to be multiple of bus burst read size. Date: Wed, 28 Feb 2018 15:07:33 +0000 Message-Id: <20180228150733.20874-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , Liviu Dudau , Alexandru-Cosmin Gheorghe , Mali DP Maintainers MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Mali DP hardware needs pitch line sizes aligned to the bus burst size for reads, so take that into consideration when allocating dumb buffers. If the layer is rotated then the stride size requirement is even larger for some hardware versions, so allocate for the worst case scenario. Update the ->dumb_create() hook to a driver specific function that sets the correct pitch size. Reported-by: Ayan Halder Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 3d82712d8002..d88a3b9d59cc 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -312,13 +312,26 @@ static int malidp_irq_init(struct platform_device *pdev) DEFINE_DRM_GEM_CMA_FOPS(fops); +static int malidp_dumb_create(struct drm_file *file_priv, + struct drm_device *drm, + struct drm_mode_create_dumb *args) +{ + struct malidp_drm *malidp = drm->dev_private; + /* allocate for the worst case scenario, i.e. rotated buffers */ + u8 alignment = malidp_hw_get_pitch_align(malidp->dev, 1); + + args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8), alignment); + + return drm_gem_cma_dumb_create_internal(file_priv, drm, args); +} + static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME, .lastclose = drm_fb_helper_lastclose, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, - .dumb_create = drm_gem_cma_dumb_create, + .dumb_create = malidp_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = drm_gem_prime_export, From patchwork Wed Feb 28 15:08:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 130006 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1175809lja; Wed, 28 Feb 2018 07:51:46 -0800 (PST) X-Google-Smtp-Source: AH8x226jkI/pWJOBgCDug50sNR+KgJmX5ILDkB/gEy06ydnBvt+7wK9Ni8zIboFaVfEl6fcVPthl X-Received: by 10.101.85.67 with SMTP id t3mr14746771pgr.310.1519833106366; Wed, 28 Feb 2018 07:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833106; cv=none; d=google.com; s=arc-20160816; b=BZSPcrO5RpQH2jqv+EUY8nslGwIujGsKLXcfyY1vWPtiPwVMdRJVop3h59ZfDVyfBk eCbLCvGtpReVong5xvdBumNVunapRYPoy6SuEh7SeNXuSpX2aJffo/ukKu7QVJ2GzV/h YhqAnV9C0G05HLNaa6fpWtMEpij0269NmT/UZI4FDiiDAzrMtHBwwJfQo1jPiWnlEE35 QnPjMEpMNaixbIGVg074dCFwkeiOgDcKUhP4VcdhTWwPGmX8Pa16OWq9dvY6LtvpajwW 9yeao6ayZk4bWQQHPJcKvio3SmwZ28R48lnxbIrsEa5yVc7vbJbTOGQS//s/tPOaGHyp j8AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=5xZ69bbRNUGpah+Obca0f3U6YZeID2iH6Gv2a1iK6l4=; b=uJ0XJ8/3HFOVIOGkMqzSjACmhbDWj4uvPvDr2JHovAtTYnAPy/+5N/tLzbk/SeSAiJ 7YAqE8aX3/3P1S8pCbr9kEe/VZ5vgf+97u/v2CsPwA1bEBH8FBViGgBlesrmRxC+ZgN7 SvO9z2sHSCQl1e3MQdqEcylGuRjBeUs6jHXF4HPEtTGQMWL9vux0WgKT3MHs+vkB0yJq KonvMBDeTzGSEJdIU7D8yf0kI/4pdHJdipk894JSGp00wh4usau0vl2Xckn2NxYqoi7V bRKr0mBOWAQbVPjs6IdVTq1QHdcI8LKPBehLzCzFf8XuvedrSIm+5L7ooMj6HVbptzcn hfzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 65-v6si1468629plb.635.2018.02.28.07.51.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 07:51:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BB066EAA4; Wed, 28 Feb 2018 15:51:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74E336EAA4 for ; Wed, 28 Feb 2018 15:51:43 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w1SF8MBC001943; Wed, 28 Feb 2018 15:08:22 GMT From: Liviu Dudau To: DRI-devel Subject: [PATCH 04/23] drm/mali-dp: Don't enable scaling engine for planes that only rotate. Date: Wed, 28 Feb 2018 15:08:22 +0000 Message-Id: <20180228150822.20958-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , Liviu Dudau , Alexandru-Cosmin Gheorghe , Mali DP Maintainers MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently the scaling engine gets enabled for a plane where the input size differs from the composition size. As rotation is done natively by the plane's hardware layer, we don't need the scaling engine to be enabled. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 9d5039f0f84e..651bd10557e0 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -159,8 +159,14 @@ static int malidp_se_check_scaling(struct malidp_plane *mp, if (ret) return ret; - src_w = state->src_w >> 16; - src_h = state->src_h >> 16; + if (state->rotation & MALIDP_ROTATED_MASK) { + src_w = state->src_h >> 16; + src_h = state->src_w >> 16; + } else { + src_w = state->src_w >> 16; + src_h = state->src_h >> 16; + } + if ((state->crtc_w == src_w) && (state->crtc_h == src_h)) { /* Scaling not necessary for this plane. */ mc->scaled_planes_mask &= ~(mp->layer->id);