From patchwork Thu May 17 15:41:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 915517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="o9aGuFUb"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40mwX94czXz9s4V for ; Fri, 18 May 2018 01:41:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284AbeEQPlo (ORCPT ); Thu, 17 May 2018 11:41:44 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34875 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530AbeEQPlk (ORCPT ); Thu, 17 May 2018 11:41:40 -0400 Received: by mail-wr0-f195.google.com with SMTP id i14-v6so6174413wre.2 for ; Thu, 17 May 2018 08:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3CLu6NTOwVKObMWaxqYBEUIqVttF8yV2jb5dM6HCDa0=; b=o9aGuFUbyc+k6z4KdxFrr/CHZyhFqCYMomjzbKON0Xt4QfTjhE+IaCW7ymNh4z/RfC /4DkcMrkVKkleDarBwE8FTZeD0XJpTitOHNqCgSvb9X8rTwOt00qU2aObOAC5emawrD2 Q5nmgKWH4NdaR7W2TtOZUshppdfj52wLDYhzz5ythLen1T/LIGSDPTKbzWbEMmXlsVWP fTRqxGZ3y3tG9poScBewt/r/v5jp9EkAN1iSb0WTARyxZjsl1KUNUmhJEuF5rfrcBVHm h3NmQUFzFkbarojFXjyyTbSzYyaFBLCDRy6jqMtiyXhcZz2IyO0++d83I82flvLbBCKN yY7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3CLu6NTOwVKObMWaxqYBEUIqVttF8yV2jb5dM6HCDa0=; b=r/qi0xfQq6c3/C3uCnLSIZlx5sK8BpLH9AecQAg5Ak1C99H9jzYWu5D0GHGJb0ztAq oylOH7A7A9tmmExYdOw5eld7L5ZvCcw7Fd9WhPD/Q0o130vCp2E15Q1iqjzeQZa8e9wv XdxxKBj6BloLkBUMRHLDbziIkNoRFSJiuoDdKU8ZLmKeHzfVXvCOqPJkOUKQhSjj3TrX ccvAjt8Jg1qwEhu2ItRD4S5OuhC3/VsrQrxmyBhtRiKmPmVDGJZnH475vxXTYaRNn/g6 q4GgWHmb9MmaiBmnFKz0VDQR7i5P6aN5zZJ+XtvkpiPVBr5Hzj+YUo+W81F7o6o6GVxz PgsQ== X-Gm-Message-State: ALKqPwfZdLL8D+5i1fnf3vw6Y5MnQnsbKM+qiOlQBSUf3YXCOzf/Jdn8 qt1XEkF/4qR7qdKS6eTG1Dk= X-Google-Smtp-Source: AB8JxZpXau9KsUmQb+1hDIK/dgdRMIHRqRCVJbeGWP7jATjS8ZzEE+q38BcoAcO5qF8VL+m5k5kbww== X-Received: by 2002:adf:8af0:: with SMTP id z45-v6mr4348680wrz.150.1526571699197; Thu, 17 May 2018 08:41:39 -0700 (PDT) Received: from localhost (p200300E41F19FC00D958180F3872A5C5.dip0.t-ipconnect.de. [2003:e4:1f19:fc00:d958:180f:3872:a5c5]) by smtp.gmail.com with ESMTPSA id m15-v6sm5555422wri.8.2018.05.17.08.41.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 08:41:38 -0700 (PDT) From: Thierry Reding To: Thierry Reding Cc: Dmitry Osipenko , Mikko Perttunen , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org Subject: [PATCH 3/7] drm/tegra: dc: Support rotation property Date: Thu, 17 May 2018 17:41:28 +0200 Message-Id: <20180517154132.10058-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517154132.10058-1-thierry.reding@gmail.com> References: <20180517154132.10058-1-thierry.reding@gmail.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Thierry Reding Currently only the DRM_MODE_REFLECT_Y rotation is supported. The driver already supports reflection on the Y axis via a custom flag which is not very useful because it requires custom userspace. Replace that flag by a standard rotation property that supports 0 degree rotation and Y axis reflection. Signed-off-by: Thierry Reding Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 18 +++++++++++++++++- drivers/gpu/drm/tegra/drm.h | 1 - drivers/gpu/drm/tegra/fb.c | 10 ---------- drivers/gpu/drm/tegra/plane.c | 1 + drivers/gpu/drm/tegra/plane.h | 2 ++ 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 9f83a65b5ea9..e2e574202ca3 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -451,6 +451,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); + unsigned int rotation = DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y; struct tegra_bo_tiling *tiling = &plane_state->tiling; struct tegra_plane *tegra = to_tegra_plane(plane); struct tegra_dc *dc = to_tegra_dc(state->crtc); @@ -498,6 +499,13 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, return -EINVAL; } + rotation = drm_rotation_simplify(state->rotation, rotation); + + if (rotation & DRM_MODE_REFLECT_Y) + plane_state->bottom_up = true; + else + plane_state->bottom_up = false; + /* * Tegra doesn't support different strides for U and V planes so we * error out if the user tries to display a framebuffer with such a @@ -558,7 +566,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.w = drm_rect_width(&plane->state->dst); window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; - window.bottom_up = tegra_fb_is_bottom_up(fb); + window.bottom_up = state->bottom_up; /* copy from state */ window.zpos = plane->state->normalized_zpos; @@ -643,6 +651,14 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, if (dc->soc->supports_blending) drm_plane_create_zpos_property(&plane->base, 0, 0, 255); + err = drm_plane_create_rotation_property(&plane->base, + DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_Y); + if (err < 0) + dev_err(dc->dev, "failed to create rotation property: %d\n", + err); + return &plane->base; } diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 4f41aaec8530..84930d13e28d 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -177,7 +177,6 @@ int drm_dp_aux_train(struct drm_dp_aux *aux, struct drm_dp_link *link, /* from fb.c */ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, unsigned int index); -bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer); int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_bo_tiling *tiling); struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index e69434909a42..35827c729462 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -38,16 +38,6 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, return fb->planes[index]; } -bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer) -{ - struct tegra_fb *fb = to_tegra_fb(framebuffer); - - if (fb->planes[0]->flags & TEGRA_BO_BOTTOM_UP) - return true; - - return false; -} - int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_bo_tiling *tiling) { diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index 176ef46c615c..271729b2c653 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -53,6 +53,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane) copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; + copy->bottom_up = state->bottom_up; copy->opaque = state->opaque; for (i = 0; i < 3; i++) diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h index 6938719e7e5d..867b9c32b1b6 100644 --- a/drivers/gpu/drm/tegra/plane.h +++ b/drivers/gpu/drm/tegra/plane.h @@ -41,6 +41,8 @@ struct tegra_plane_state { u32 format; u32 swap; + bool bottom_up; + /* used for legacy blending support only */ bool opaque; bool dependent[3];