From patchwork Tue Mar 3 14:11:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 5923091 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AE359F318 for ; Tue, 3 Mar 2015 14:11:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A542820303 for ; Tue, 3 Mar 2015 14:11:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8EECA202E9 for ; Tue, 3 Mar 2015 14:11:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE1336E5B7; Tue, 3 Mar 2015 06:11:45 -0800 (PST) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id D953D6E5B8 for ; Tue, 3 Mar 2015 06:11:44 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Mar 2015 06:11:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,681,1418112000"; d="scan'208";a="686165912" Received: from tursulin-linux.isw.intel.com ([10.102.226.48]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2015 06:11:25 -0800 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Tue, 3 Mar 2015 14:11:03 +0000 Message-Id: <1425391866-15377-11-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1425391866-15377-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1425391866-15377-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 10/13] lib/igt_fb: Use new ADDFB2 extension for new tiling modes 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, 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 From: Tvrtko Ursulin Signed-off-by: Tvrtko Ursulin --- lib/igt_fb.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 853b2f9..c54907e 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -404,16 +404,10 @@ igt_create_fb_with_bo_size(int fd, int width, int height, uint32_t format, uint64_t tiling, struct igt_fb *fb, unsigned bo_size) { - uint32_t handles[4]; - uint32_t pitches[4]; - uint32_t offsets[4]; uint32_t fb_id; int bpp; memset(fb, 0, sizeof(*fb)); - memset(handles, 0, sizeof(handles)); - memset(pitches, 0, sizeof(pitches)); - memset(offsets, 0, sizeof(offsets)); bpp = igt_drm_format_to_bpp(format); @@ -422,14 +416,30 @@ igt_create_fb_with_bo_size(int fd, int width, int height, do_or_die(create_bo_for_fb(fd, width, height, bpp, tiling, bo_size, &fb->gem_handle, &fb->size, &fb->stride)); - handles[0] = fb->gem_handle; - pitches[0] = fb->stride; - igt_debug("%s(handle=%d, pitch=%d)\n", - __func__, handles[0], pitches[0]); - do_or_die(drmModeAddFB2(fd, width, height, format, - handles, pitches, offsets, - &fb_id, 0)); + __func__, fb->gem_handle, fb->stride); + + if (tiling != LOCAL_DRM_FORMAT_MOD_NONE && + tiling != LOCAL_I915_FORMAT_MOD_X_TILED) { + do_or_die(__kms_addfb(fd, fb->gem_handle, width, height, + fb->stride, format, tiling, + LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id)); + } else { + uint32_t handles[4]; + uint32_t pitches[4]; + uint32_t offsets[4]; + + memset(handles, 0, sizeof(handles)); + memset(pitches, 0, sizeof(pitches)); + memset(offsets, 0, sizeof(offsets)); + + handles[0] = fb->gem_handle; + pitches[0] = fb->stride; + + do_or_die(drmModeAddFB2(fd, width, height, format, + handles, pitches, offsets, + &fb_id, 0)); + } fb->width = width; fb->height = height;