From patchwork Wed Mar 26 16:15:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3894201 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1696BF540 for ; Wed, 26 Mar 2014 16:16:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88EE620120 for ; Wed, 26 Mar 2014 16:16:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7DCCE2012F for ; Wed, 26 Mar 2014 16:16:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5FE56E37B; Wed, 26 Mar 2014 09:16:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id C068A6E37B for ; Wed, 26 Mar 2014 09:16:05 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id e53so1850945eek.30 for ; Wed, 26 Mar 2014 09:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bVt18y0klmgnPxZSx+X3cYwjnbpIb0FUDfP8v5+C6/c=; b=Dt2vgf8VhI5dG1V2q2DUIOvm4WKv3c2GmuzFkm7y469ckOarkohF6o0tEzhJxSf2j9 DxkVVCMt2ebyQBAo9crda6vsfsIGN70SB/7i2lmW8V4JAqbc3MiSWyr0q8ZN5xMcLRFm w6RZ0xe+h8rFUl81ekCQsucrxA6lZcmfYlAKc= 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:in-reply-to :references; bh=bVt18y0klmgnPxZSx+X3cYwjnbpIb0FUDfP8v5+C6/c=; b=G38Wk39qbtdH7T7DCJTDIeHX/YDws/0Dg8DMvS31Z9QbyQzzyD07r998YaG9QhfkXq zTTqqOSM/opngdk+GiHYEHEXXuLh5LkSZotIvpJEDCnogv7fL+XByS9svYzwZg16Qexc 6mY9HnwawqopY79faT4vJjJrSPaY80J8nxquTc2UVS759C3UeXzPMEFloxGQ0562LXAa 6NqzthzAQc68hHmCyoeq45svuu19x62EVxTbaLMU6SSu3rlbDXqZnc+YILiI3J51EjUC Sb4ov8zFzrfgSSy6TkOpDTIbEzOpZ3VoMV+d644I2nz+M99YoCXwx2mppEBaplVI3SLm 90Cw== X-Gm-Message-State: ALoCoQkiOYuHn/sqFzmCgBw7B9sCVIeTa2W/D18/pvhQcgw1grQWM1kSN+ZJ90qFyogY3sZ+TJYc X-Received: by 10.15.43.77 with SMTP id w53mr75562389eev.10.1395850564840; Wed, 26 Mar 2014 09:16:04 -0700 (PDT) Received: from phenom.ffwll.local (84-73-67-144.dclient.hispeed.ch. [84.73.67.144]) by mx.google.com with ESMTPSA id l42sm48041287eew.19.2014.03.26.09.16.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Mar 2014 09:16:03 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 26 Mar 2014 17:15:45 +0100 Message-Id: <1395850555-17948-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1395850555-17948-1-git-send-email-daniel.vetter@ffwll.ch> References: <1395850555-17948-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 02/12] lib: remove kmstest_create_fb 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Use the new-style function using drm fourcc codes instead everywhere. To easily use thew fourcc based interface also expose bpp_depth_to_drm_format from the library. Finally include drm_fourcc.h from the igt_kms.h header since pretty much everyone needs this now. Signed-off-by: Daniel Vetter --- demos/intel_sprite_on.c | 2 -- lib/igt_kms.c | 28 +--------------------------- lib/igt_kms.h | 5 ++--- tests/kms_cursor_crc.c | 1 - tests/kms_fbc_crc.c | 2 -- tests/kms_flip.c | 15 +++++++++------ tests/kms_pipe_crc_basic.c | 1 - tests/kms_plane.c | 5 ++--- tests/kms_render.c | 2 -- tests/kms_setmode.c | 6 +++--- tests/pm_lpsp.c | 5 +++-- tests/pm_pc8.c | 6 ++++-- tests/testdisplay.c | 8 +++++--- 13 files changed, 29 insertions(+), 57 deletions(-) diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c index fb375f4f2b62..a1c6a34e8abd 100644 --- a/demos/intel_sprite_on.c +++ b/demos/intel_sprite_on.c @@ -47,8 +47,6 @@ #include "drmtest.h" #include "igt_kms.h" -#include - #include "ioctl_wrappers.h" /* diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 5b7aca713505..c752490cf9b7 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -34,8 +34,6 @@ #include #include -#include - #include "drmtest.h" #include "igt_kms.h" #include "igt_aux.h" @@ -278,7 +276,7 @@ static struct format_desc_struct { #define for_each_format(f) \ for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++) -static uint32_t bpp_depth_to_drm_format(int bpp, int depth) +uint32_t bpp_depth_to_drm_format(int bpp, int depth) { struct format_desc_struct *f; @@ -290,30 +288,6 @@ static uint32_t bpp_depth_to_drm_format(int bpp, int depth) } /* Return fb_id on success, 0 on error */ -unsigned int kmstest_create_fb(int fd, int width, int height, int bpp, - int depth, bool tiled, struct kmstest_fb *fb) -{ - memset(fb, 0, sizeof(*fb)); - - if (create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle, - &fb->size, &fb->stride) < 0) - return 0; - - if (drmModeAddFB(fd, width, height, depth, bpp, fb->stride, - fb->gem_handle, &fb->fb_id) < 0) { - gem_close(fd, fb->gem_handle); - - return 0; - } - - fb->width = width; - fb->height = height; - fb->tiling = tiled; - fb->drm_format = bpp_depth_to_drm_format(bpp, depth); - - return fb->fb_id; -} - uint32_t drm_format_to_bpp(uint32_t drm_format) { struct format_desc_struct *f; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 19c2649c91d2..1f613580dc29 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -30,6 +30,7 @@ #include #include +#include #include "igt_display.h" @@ -76,9 +77,6 @@ int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align, double yspacing, const char *fmt, ...) __attribute__((format (printf, 4, 5))); -unsigned int kmstest_create_fb(int fd, int width, int height, int bpp, - int depth, bool tiled, - struct kmstest_fb *fb_info); unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format, bool tiled, struct kmstest_fb *fb); unsigned int kmstest_create_color_fb(int fd, int width, int height, @@ -107,6 +105,7 @@ const char *kmstest_encoder_type_str(int type); const char *kmstest_connector_status_str(int type); const char *kmstest_connector_type_str(int type); +uint32_t bpp_depth_to_drm_format(int bpp, int depth); uint32_t drm_format_to_bpp(uint32_t drm_format); /* diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index f87fe0ba9054..f95448f47356 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -27,7 +27,6 @@ #include #include #include -#include #include "drmtest.h" #include "igt_debugfs.h" diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index db595c72036c..f1d918b44b4d 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -27,8 +27,6 @@ #include #include -#include - #include "drmtest.h" #include "igt_debugfs.h" #include "igt_kms.h" diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 7ba165687c21..d147bf45c582 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1290,12 +1290,15 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, if (o->flags & TEST_FENCE_STRESS) tiled = true; - o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, - o->bpp, o->depth, tiled, &o->fb_info[0]); - o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, - o->bpp, o->depth, tiled, &o->fb_info[1]); - o->fb_ids[2] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, - o->bpp, o->depth, true, &o->fb_info[2]); + o->fb_ids[0] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height, + bpp_depth_to_drm_format(o->bpp, o->depth), + tiled, &o->fb_info[0]); + o->fb_ids[1] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height, + bpp_depth_to_drm_format(o->bpp, o->depth), + tiled, &o->fb_info[1]); + o->fb_ids[2] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height, + bpp_depth_to_drm_format(o->bpp, o->depth), + true, &o->fb_info[2]); igt_assert(o->fb_ids[0]); igt_assert(o->fb_ids[1]); igt_assert(o->fb_ids[2]); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index ef3ab4083eb6..75217df4f5e1 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "drmtest.h" #include "igt_debugfs.h" diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 83d45c546322..ca73f4f50cbe 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "drmtest.h" #include "igt_debugfs.h" @@ -69,9 +68,9 @@ create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode, unsigned int fb_id; cairo_t *cr; - fb_id = kmstest_create_fb(data->drm_fd, + fb_id = kmstest_create_fb2(data->drm_fd, mode->hdisplay, mode->vdisplay, - 32 /* bpp */, 24 /* depth */, + DRM_FORMAT_XRGB8888, false /* tiling */, fb); igt_assert(fb_id); diff --git a/tests/kms_render.c b/tests/kms_render.c index 2179e65d66ee..dda844219974 100644 --- a/tests/kms_render.c +++ b/tests/kms_render.c @@ -30,8 +30,6 @@ #include #include -#include - #include "drmtest.h" #include "testdisplay.h" #include "intel_bufmgr.h" diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index 703e93264e88..3a764c389c19 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -32,7 +32,6 @@ #include #include -#include "drm_fourcc.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" @@ -189,8 +188,9 @@ static void create_fb_for_crtc(struct crtc_config *crtc, bpp = 32; depth = 24; enable_tiling = false; - fb_id = kmstest_create_fb(drm_fd, crtc->mode.hdisplay, - crtc->mode.vdisplay, bpp, depth, + fb_id = kmstest_create_fb2(drm_fd, crtc->mode.hdisplay, + crtc->mode.vdisplay, + bpp_depth_to_drm_format(bpp, depth), enable_tiling, fb_info); igt_assert(fb_id > 0); } diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c index 87397055558b..aba6f7beb213 100644 --- a/tests/pm_lpsp.c +++ b/tests/pm_lpsp.c @@ -95,8 +95,9 @@ static uint32_t create_fb(int drm_fd, int width, int height) cairo_t *cr; uint32_t buffer_id; - buffer_id = kmstest_create_fb(drm_fd, width, height, 32, 24, false, - &fb); + buffer_id = kmstest_create_fb2(drm_fd, width, height, + DRM_FORMAT_XRGB8888, + false, &fb); cr = kmstest_get_cairo_ctx(drm_fd, &fb); kmstest_paint_test_pattern(cr, width, height); cairo_destroy(cr); diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c index 3004c32eb94a..5e4a1f9953ad 100644 --- a/tests/pm_pc8.c +++ b/tests/pm_pc8.c @@ -40,7 +40,8 @@ #include #include -#include "drm.h" +#include + #include "drmtest.h" #include "intel_batchbuffer.h" #include "intel_io.h" @@ -274,7 +275,8 @@ static struct scanout_fb *create_fb(struct mode_set_data *data, int width, fb_info = malloc(sizeof(struct scanout_fb)); igt_assert(fb_info); - fb_info->handle = kmstest_create_fb(drm_fd, width, height, 32, 24, + fb_info->handle = kmstest_create_fb2(drm_fd, width, height, + DRM_FORMAT_XRGB8888, false, &fb); fb_info->width = width; fb_info->height = height; diff --git a/tests/testdisplay.c b/tests/testdisplay.c index b70287ec958a..36412201a10b 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -405,7 +405,8 @@ set_mode(struct connector *c) width = c->mode.hdisplay; height = c->mode.vdisplay; - fb_id = kmstest_create_fb(drm_fd, width, height, bpp, depth, + fb_id = kmstest_create_fb2(drm_fd, width, height, + bpp_depth_to_drm_format(bpp, depth), enable_tiling, &fb_info[current_fb]); paint_output_info(c, &fb_info[current_fb]); paint_color_key(&fb_info[current_fb]); @@ -531,8 +532,9 @@ static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct kmstest_fb *fb) uint32_t fb_id; stereo_fb_layout_from_mode(&layout, mode); - fb_id = kmstest_create_fb(drm_fd, layout.fb_width, layout.fb_height, - bpp, depth, enable_tiling, fb); + fb_id = kmstest_create_fb2(drm_fd, layout.fb_width, layout.fb_height, + bpp_depth_to_drm_format(bpp, depth), + enable_tiling, fb); cr = kmstest_get_cairo_ctx(drm_fd, fb); kmstest_paint_image(cr, IGT_DATADIR"/1080p-left.png",