From patchwork Thu Nov 5 02:29:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kasireddy, Vivek" X-Patchwork-Id: 7556801 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 25993BEEA4 for ; Thu, 5 Nov 2015 02:33:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A51920823 for ; Thu, 5 Nov 2015 02:33:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DD7FB2056D for ; Thu, 5 Nov 2015 02:33:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 488F26E2EE; Wed, 4 Nov 2015 18:33:29 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 213316E2EE for ; Wed, 4 Nov 2015 18:33:28 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 04 Nov 2015 18:33:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,245,1444719600"; d="scan'208";a="812097103" Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga001.jf.intel.com with ESMTP; 04 Nov 2015 18:33:27 -0800 Received: from vkasired-desk2.fm.intel.com (10.22.254.138) by ORSMSX104.amr.corp.intel.com (10.22.225.131) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Nov 2015 18:33:27 -0800 From: Vivek Kasireddy To: Date: Wed, 4 Nov 2015 18:29:31 -0800 Message-ID: <1446690571-6182-1-git-send-email-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <56307BA3.10701@daenzer.net> References: <56307BA3.10701@daenzer.net> MIME-Version: 1.0 X-Originating-IP: [10.22.254.138] Cc: Michel Danzer , Vivek Kasireddy Subject: [Intel-gfx] [PATCH] gbm: Add a flag to enable creation of rotated scanout buffers (v2) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For certain platforms that support rotated scanout buffers, currently, there is no way to create them with the GBM DRI interface. This flag will instruct the DRI driver to create the buffer by setting additional requirements such as tiling mode. v2: Reserve a bit per angle. (Ville and Michel) Cc: Michel Danzer Cc: Ville Syrjala Signed-off-by: Vivek Kasireddy --- include/GL/internal/dri_interface.h | 3 +++ src/gbm/backends/dri/gbm_dri.c | 19 +++++++++++++++++-- src/gbm/main/gbm.h | 7 +++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 6bbd3fa..cd1bf62 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1100,6 +1100,9 @@ struct __DRIdri2ExtensionRec { #define __DRI_IMAGE_USE_SCANOUT 0x0002 #define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */ #define __DRI_IMAGE_USE_LINEAR 0x0008 +#define __DRI_IMAGE_USE_ROTATION_90 0x0010 +#define __DRI_IMAGE_USE_ROTATION_180 0x0020 +#define __DRI_IMAGE_USE_ROTATION_270 0x0040 /** diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 57cdeac..a997946 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -539,7 +539,8 @@ gbm_dri_is_format_supported(struct gbm_device *gbm, break; case GBM_BO_FORMAT_ARGB8888: case GBM_FORMAT_ARGB8888: - if (usage & GBM_BO_USE_SCANOUT) + if (usage & (GBM_BO_USE_SCANOUT | GBM_BO_USE_ROTATION_90 | + GBM_BO_USE_ROTATION_180 | GBM_BO_USE_ROTATION_270)) return 0; break; default: @@ -748,6 +749,12 @@ gbm_dri_bo_import(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_ROTATION_90) + dri_use |= __DRI_IMAGE_USE_ROTATION_90; + if (usage & GBM_BO_USE_ROTATION_180) + dri_use |= __DRI_IMAGE_USE_ROTATION_180; + if (usage & GBM_BO_USE_ROTATION_270) + dri_use |= __DRI_IMAGE_USE_ROTATION_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (dri->image->base.version >= 2 && @@ -786,7 +793,9 @@ create_dumb(struct gbm_device *gbm, is_cursor = (usage & GBM_BO_USE_CURSOR) != 0 && format == GBM_FORMAT_ARGB8888; - is_scanout = (usage & GBM_BO_USE_SCANOUT) != 0 && + is_scanout = (usage & (GBM_BO_USE_SCANOUT | + GBM_BO_USE_ROTATION_90 | GBM_BO_USE_ROTATION_180 | + GBM_BO_USE_ROTATION_270)) != 0 && format == GBM_FORMAT_XRGB8888; if (!is_cursor && !is_scanout) { errno = EINVAL; @@ -880,6 +889,12 @@ gbm_dri_bo_create(struct gbm_device *gbm, if (usage & GBM_BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; + if (usage & GBM_BO_USE_ROTATION_90) + dri_use |= __DRI_IMAGE_USE_ROTATION_90; + if (usage & GBM_BO_USE_ROTATION_180) + dri_use |= __DRI_IMAGE_USE_ROTATION_180; + if (usage & GBM_BO_USE_ROTATION_270) + dri_use |= __DRI_IMAGE_USE_ROTATION_270; if (usage & GBM_BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; if (usage & GBM_BO_USE_LINEAR) diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 8db2153..b200ca6 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -214,6 +214,13 @@ enum gbm_bo_flags { * Buffer is linear, i.e. not tiled. */ GBM_BO_USE_LINEAR = (1 << 4), + /** + * Buffer would be rotated and some platforms have additional tiling + * requirements for rotated scanout buffers. + */ + GBM_BO_USE_ROTATION_90 = (1 << 5), + GBM_BO_USE_ROTATION_180 = (1 << 6), + GBM_BO_USE_ROTATION_270 = (1 << 7), }; int