From patchwork Fri May 16 13:07:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 4191411 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6CC209F1C0 for ; Fri, 16 May 2014 13:13:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88F9B202EA for ; Fri, 16 May 2014 13:13:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9B42220253 for ; Fri, 16 May 2014 13:13:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E3FD6E2D9; Fri, 16 May 2014 06:13:03 -0700 (PDT) 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 AA3476E2D9 for ; Fri, 16 May 2014 06:13:02 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 16 May 2014 06:12:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="4.97,1067,1389772800"; d="scan'208"; a="533033774" Received: from omateolo-linux2.iwi.intel.com ([172.28.253.145]) by fmsmga001.fm.intel.com with ESMTP; 16 May 2014 06:12:39 -0700 From: oscar.mateo@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 16 May 2014 14:07:12 +0100 Message-Id: <1400245632-12928-2-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400245632-12928-1-git-send-email-oscar.mateo@intel.com> References: <1400238531-10414-1-git-send-email-oscar.mateo@intel.com> <1400245632-12928-1-git-send-email-oscar.mateo@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2 2/2] tests/kms_flip: test a fb backed by a bo too big/small for its own good X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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: Oscar Mateo This is a "review by igt test" for a bug located in i915_gem_object_pin_to_display_plane and fixed by: commit 392013bdd4b6128795e33c84bd6d6d3fd66ff0a3 Author: Oscar Mateo Date: Fri May 16 11:23:12 2014 +0100 drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display Otherwise, we do a NULL pointer dereference. I've seen this happen while handling an error in i915_gem_object_pin_to_display_plane(): If i915_gem_object_set_cache_level() fails, we call is_pin_display() to handle the error. At this point, the object is still not pinned to GGTT and maybe not even bound, so we have to check before we dereference its GGTT vma. v2: Chris Wilson says restoring the old value is easier, but that is_pin_display is useful as a theory of operation. Take the solomonic decision: at least this way is_pin_display is a little more robust (until Chris can kill it off). v2: Avoid code duplication by using igt_create_fb_with_bo_size() as requested by Ville Syrjälä (original author of the "too big" test idea). Signed-off-by: Oscar Mateo --- tests/kms_flip.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index bb4f71d..f2ec9ef 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -74,6 +74,7 @@ #define TEST_RPM (1 << 25) #define TEST_SUSPEND (1 << 26) #define TEST_TS_CONT (1 << 27) +#define TEST_BO_TOOBIG (1 << 28) #define EVENT_FLIP (1 << 0) #define EVENT_VBLANK (1 << 1) @@ -1213,6 +1214,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, { char test_name[128]; unsigned elapsed; + unsigned bo_size = 0; bool tiled; int i; @@ -1249,12 +1251,17 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, if (o->flags & TEST_FENCE_STRESS) tiled = true; + /* 256 MB is usually the maximum mappable aperture, + * (make it 4x times that to ensure failure) */ + if (o->flags & TEST_BO_TOOBIG) + bo_size = 4*256*1024*1024; + o->fb_ids[0] = igt_create_fb(drm_fd, o->fb_width, o->fb_height, igt_bpp_depth_to_drm_format(o->bpp, o->depth), tiled, &o->fb_info[0]); - o->fb_ids[1] = igt_create_fb(drm_fd, o->fb_width, o->fb_height, + o->fb_ids[1] = igt_create_fb_with_bo_size(drm_fd, o->fb_width, o->fb_height, igt_bpp_depth_to_drm_format(o->bpp, o->depth), - tiled, &o->fb_info[1]); + tiled, &o->fb_info[1], bo_size); o->fb_ids[2] = igt_create_fb(drm_fd, o->fb_width, o->fb_height, igt_bpp_depth_to_drm_format(o->bpp, o->depth), true, &o->fb_info[2]); @@ -1264,7 +1271,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, igt_require(o->fb_ids[2]); paint_flip_mode(&o->fb_info[0], false); - paint_flip_mode(&o->fb_info[1], true); + if (!(o->flags & TEST_BO_TOOBIG)) + paint_flip_mode(&o->fb_info[1], true); if (o->fb_ids[2]) paint_flip_mode(&o->fb_info[2], true); @@ -1288,10 +1296,15 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, if (o->flags & TEST_CHECK_TS) sleep(1); - igt_assert(do_page_flip(o, o->fb_ids[1], true) == 0); + if (o->flags & TEST_BO_TOOBIG) { + igt_assert(do_page_flip(o, o->fb_ids[1], true) == -E2BIG); + goto out; + } else + igt_assert(do_page_flip(o, o->fb_ids[1], true) == 0); wait_for_events(o); o->current_fb_id = 1; + if (o->flags & TEST_FLIP) o->flip_state.seq_step = 1; else @@ -1543,6 +1556,7 @@ int main(int argc, char **argv) { 10, TEST_VBLANK | TEST_DPMS | TEST_SUSPEND | TEST_TS_CONT, "dpms-vs-suspend" }, { 0, TEST_VBLANK | TEST_MODESET | TEST_RPM | TEST_TS_CONT, "modeset-vs-rpm" }, { 0, TEST_VBLANK | TEST_MODESET | TEST_SUSPEND | TEST_TS_CONT, "modeset-vs-suspend" }, + { 0, TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" }, }; int i;