From patchwork Thu Oct 20 20:17:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 9387519 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 E3FEC607F0 for ; Thu, 20 Oct 2016 20:17:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3BC229A79 for ; Thu, 20 Oct 2016 20:17:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C820C29BE0; Thu, 20 Oct 2016 20:17:29 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 596FD29A79 for ; Thu, 20 Oct 2016 20:17:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF92F6EC26; Thu, 20 Oct 2016 20:17:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x242.google.com (mail-qk0-x242.google.com [IPv6:2607:f8b0:400d:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26EDC6EC26 for ; Thu, 20 Oct 2016 20:17:19 +0000 (UTC) Received: by mail-qk0-x242.google.com with SMTP id f128so5379656qkb.0 for ; Thu, 20 Oct 2016 13:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=pItGw/mL+Qer8NNV74D6l2TKbMVEewkx3bcqs669VNw=; b=BRDv9Ra8v1tsiC9gOBe+ZxlKWEsJ418aK5XUec9vwsovnc4GEEkEnm5yMPkMoMRrqh l0hPqkHg/5zAmhBdlhSiWwLM1B2uHUPctxSA4Qf/L8EebB0Jpql5mXguYyKDgPIH2zgh ItPi6sY+px9aeT4XCGPXbBF9CHMAdzBdcb4svntx561YWxtQbL3Db4Y5z5EPfgZntw+L p+WMjvhWUdp/omRXm/IwPtJU4HVFnyAJckW4uM/HtzT4V4UStvxwFf8XXGw8iFFC0zWj uVsl//F3kv2qP9Y4VyDwotciyf/ptPegYXyVLfNoedtCI7q9TBXvMFAsNH4GQmUoCMBP gdpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pItGw/mL+Qer8NNV74D6l2TKbMVEewkx3bcqs669VNw=; b=gmNZ8/nJA7y3pR9T4HOvIBOms9fArX6E9cG5LZiUyWpARS+bWXXsioUzOwXG/PoF+J Avz+6JlA5D2zvOmng1Xo+VJ81e+Unc6Cn83i6+WhlxtP+T38Zv92ah9aOulCrCPfVl3U YqWwrbqaMbbuByCkkJIsLEM20iYOBq2gT3CYOrPbRsu/f42XjdHrTmDazZCnZjOLO9Zy wKwcgizEAQwmAluusxqvavaxlDQO+nDSZj5604UvSqjMXLWSgWVRsehf5oikHG9CRIqH LT4DIk1+GicXj3BUsW70nG6ODqqh0zIamSfCtO2CM3xYq9ec0F88LqkjaITzD8dbKgEB LLGg== X-Gm-Message-State: ABUngvcE3k5VaU5gBtFpfSII4sh+0yNeGNGJUeEyczUANKcNHkUbFp+ngMkT/fu9MPZlFw== X-Received: by 10.55.167.149 with SMTP id q143mr2026208qke.97.1476994638373; Thu, 20 Oct 2016 13:17:18 -0700 (PDT) Received: from localhost (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id o44sm21598983qtc.10.2016.10.20.13.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 13:17:17 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFC] drm: add hint to userspace about whether a plane can scale Date: Thu, 20 Oct 2016 16:17:14 -0400 Message-Id: <1476994634-24625-1-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.7.4 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 When you have a mix of planes that can scale and those that cannot scale, userspace really wants to have some hint to know which planes can definitely not scale so it knows to assign them to unscaled layers. I don't think it is fully possible to describe scaling constraints in a generic way, so I don't think it is even worth trying, so this is not a substitute for atomic TESTONLY step, but it does reduce the search-space for userspace. In the common case, most layers will not be scaled so knowing the best planes to pick for those layers is useful. --- drivers/gpu/drm/drm_crtc.c | 1 + drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 1 + include/drm/drm_crtc.h | 2 ++ include/uapi/drm/drm_mode.h | 3 +++ 4 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index b4b973f..d7e0e0d 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2389,6 +2389,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data, plane_resp->plane_id = plane->base.id; plane_resp->possible_crtcs = plane->possible_crtcs; plane_resp->gamma_size = 0; + plane_resp->can_scale = plane->can_scale; /* * This ioctl is called twice, once to determine how much space is diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 692c888..2061c83 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -908,6 +908,7 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev, mdp5_plane->pipe = pipe; mdp5_plane->name = pipe2name(pipe); mdp5_plane->caps = caps; + plane->can_scale = !!(caps & MDP_PIPE_CAP_SCALE); mdp5_plane->nformats = mdp_get_formats(mdp5_plane->formats, ARRAY_SIZE(mdp5_plane->formats), diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d74d47a..6e290b6 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1679,6 +1679,7 @@ enum drm_plane_type { * @format_types: array of formats supported by this plane * @format_count: number of formats supported * @format_default: driver hasn't supplied supported formats for the plane + * @can_scale: a hint to userspace that this plane can (or cannot) scale * @crtc: currently bound CRTC * @fb: currently bound fb * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by @@ -1710,6 +1711,7 @@ struct drm_plane { uint32_t *format_types; unsigned int format_count; bool format_default; + bool can_scale; struct drm_crtc *crtc; struct drm_framebuffer *fb; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index ce71ad5..5bf9361 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -191,6 +191,9 @@ struct drm_mode_get_plane { __u32 count_format_types; __u64 format_type_ptr; + + __u32 can_scale; + __u32 pad; }; struct drm_mode_get_plane_res {