From patchwork Mon Jul 6 12:35:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6723291 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 E86519F38C for ; Mon, 6 Jul 2015 12:35:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEDBE20613 for ; Mon, 6 Jul 2015 12:35:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E3F64202F0 for ; Mon, 6 Jul 2015 12:35:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5ABD06E874; Mon, 6 Jul 2015 05:35:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E57B96E86C for ; Mon, 6 Jul 2015 05:35:50 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 06 Jul 2015 05:35:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,414,1432623600"; d="scan'208";a="741420998" Received: from magarwal-mobl.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.77.111]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2015 05:35:49 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 6 Jul 2015 13:35:32 +0100 Message-Id: <1436186144-19665-5-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436186144-19665-1-git-send-email-damien.lespiau@intel.com> References: <1436186144-19665-1-git-send-email-damien.lespiau@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 04/16] lib: Add some basic types 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.9 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 Might as well start to define some igt wide types. I'll need them for igt_plot, but other things belong here, like a color type. Signed-off-by: Damien Lespiau --- .../intel-gpu-tools/intel-gpu-tools-docs.xml | 1 + lib/Makefile.sources | 1 + lib/igt_types.h | 99 ++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 lib/igt_types.h diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml index 618dc5f..0992308 100644 --- a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +++ b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml @@ -17,6 +17,7 @@ API Reference + diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 7f88b65..205a9aa 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -14,6 +14,7 @@ libintel_tools_la_SOURCES = \ igt_gt.h \ igt_stats.c \ igt_stats.h \ + igt_types.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \ diff --git a/lib/igt_types.h b/lib/igt_types.h new file mode 100644 index 0000000..3d7f1d6 --- /dev/null +++ b/lib/igt_types.h @@ -0,0 +1,99 @@ +/* + * Copyright © 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef __IGT_TYPES_H__ +#define __IGT_TYPES_H__ + +/** + * SECTION:igt_types + * @short_description: Some handy types + * @title: Basic Types + * @include: igt_types.h + */ + +/** + * igt_orientation_t: + * @IGT_ORIENTATION_HORIZONTAL: Horizontal + * @IGT_ORIENTATION_VERTICAL: Vertical + */ +typedef enum { + IGT_ORIENTATION_HORIZONTAL, + IGT_ORIENTATION_VERTICAL, +} igt_orientation_t; + +/** + * igt_point_t: + * @x: X coordinate + * @y: Y coordinate + * + * A point on a plane. + */ +typedef struct { + double x, y; +} igt_point_t; + +/** + * igt_box_t: + * @x1: X-coordinate of the top left corner + * @y1: Y-coordinate of the top left corner + * @x2: X-coordinate of the bottom right corner + * @y2: Y-coordinate of the bottom right corner + * + * A rectangle defined by two points. + */ +typedef struct { + double x1, y1, x2, y2; +} igt_box_t; + +/** + * igt_trbl_t: + * @top: Top value + * @right: Right value + * @bottom: Bottom value + * @left: Left value + * + * Useful to store margin, padding, ... with a CSS-like feeling. + */ +typedef struct { + double top, right, bottom, left; +} igt_trbl_t; + +/** + * igt_align_t: + * @IGT_ALIGN_LEFT: Align left + * @IGT_ALIGN_RIGHT: Align right + * @IGT_ALIGN_TOP: Align top + * @IGT_ALIGN_BOTTOM: Align bottom + * @IGT_ALIGN_CENTER: Align center + * + * An alignment type, to give to text drawing functions for instance. + */ +typedef enum { + IGT_ALIGN_LEFT, + IGT_ALIGN_RIGHT, + IGT_ALIGN_TOP, + IGT_ALIGN_BOTTOM, + IGT_ALIGN_CENTER, +} igt_align_t; + +#endif /* __IGT_TYPES_H__ */