From patchwork Fri Jun 14 21:21:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2724451 Return-Path: X-Original-To: patchwork-dri-devel@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 41B3AC0AB1 for ; Fri, 14 Jun 2013 21:22:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 366C920298 for ; Fri, 14 Jun 2013 21:22:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 153192027A for ; Fri, 14 Jun 2013 21:22:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11657E611C for ; Fri, 14 Jun 2013 14:22:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id 51BE6E5CE3 for ; Fri, 14 Jun 2013 14:21:29 -0700 (PDT) Received: from avalon.ideasonboard.com (unknown [91.177.128.27]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0129635A4D; Fri, 14 Jun 2013 23:21:21 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 01/23] modetest: Fix warnings Date: Fri, 14 Jun 2013 23:21:12 +0200 Message-Id: <1371244894-27878-2-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1371244894-27878-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1371244894-27878-1-git-send-email-laurent.pinchart@ideasonboard.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 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 Enable all standard automake warnings except for -Wpointer-arith (as the test pattern generation code uses void pointer arithmetics) and fix them. Signed-off-by: Laurent Pinchart --- tests/modetest/Makefile.am | 4 +++- tests/modetest/buffers.c | 13 +++++++------ tests/modetest/buffers.h | 5 +++-- tests/modetest/modetest.c | 44 ++++++++++++++++++++++---------------------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am index 410c632..6e7ff14 100644 --- a/tests/modetest/Makefile.am +++ b/tests/modetest/Makefile.am @@ -1,4 +1,6 @@ -AM_CFLAGS = \ +AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) + +AM_CFLAGS += \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/libkms/ \ -I$(top_srcdir) diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index b75cca7..1ca3be5 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -999,8 +999,8 @@ fill_pattern(unsigned int format, enum fill_pattern pattern, void *planes[3], */ static struct kms_bo * -allocate_buffer(struct kms_driver *kms, - int width, int height, int *stride) +allocate_buffer(struct kms_driver *kms, unsigned int width, unsigned int height, + unsigned int *stride) { struct kms_bo *bo; unsigned bo_attribs[] = { @@ -1034,13 +1034,14 @@ allocate_buffer(struct kms_driver *kms, struct kms_bo * create_test_buffer(struct kms_driver *kms, unsigned int format, - int width, int height, int handles[4], - int pitches[4], int offsets[4], enum fill_pattern pattern) + unsigned int width, unsigned int height, + unsigned int handles[4], unsigned int pitches[4], + unsigned int offsets[4], enum fill_pattern pattern) { struct kms_bo *bo; - int ret, stride; - void *planes[3]; + void *planes[3] = { 0, }; void *virtual; + int ret; bo = allocate_buffer(kms, width, height, &pitches[0]); if (!bo) diff --git a/tests/modetest/buffers.h b/tests/modetest/buffers.h index 2b15ce5..e320389 100644 --- a/tests/modetest/buffers.h +++ b/tests/modetest/buffers.h @@ -37,8 +37,9 @@ enum fill_pattern { }; struct kms_bo *create_test_buffer(struct kms_driver *kms, unsigned int format, - int width, int height, int handles[4], int pitches[4], - int offsets[4], enum fill_pattern pattern); + unsigned int width, unsigned int height, + unsigned int handles[4], unsigned int pitches[4], + unsigned int offsets[4], enum fill_pattern pattern); unsigned int format_fourcc(const char *name); diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 8afd2b1..47704db 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -64,11 +64,11 @@ int fd, modes; struct type_name { int type; - char *name; + const char *name; }; #define type_name_fn(res) \ -char * res##_str(int type) { \ +const char * res##_str(int type) { \ unsigned int i; \ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ if (res##_names[i].type == type) \ @@ -85,7 +85,7 @@ struct type_name encoder_type_names[] = { { DRM_MODE_ENCODER_TVDAC, "TVDAC" }, }; -type_name_fn(encoder_type) +static type_name_fn(encoder_type) struct type_name connector_status_names[] = { { DRM_MODE_CONNECTED, "connected" }, @@ -93,7 +93,7 @@ struct type_name connector_status_names[] = { { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, }; -type_name_fn(connector_status) +static type_name_fn(connector_status) struct type_name connector_type_names[] = { { DRM_MODE_CONNECTOR_Unknown, "unknown" }, @@ -113,11 +113,11 @@ struct type_name connector_type_names[] = { { DRM_MODE_CONNECTOR_eDP, "eDP" }, }; -type_name_fn(connector_type) +static type_name_fn(connector_type) #define bit_name_fn(res) \ -char * res##_str(int type) { \ - int i; \ +const char * res##_str(int type) { \ + unsigned int i; \ const char *sep = ""; \ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ if (type & (1 << i)) { \ @@ -138,7 +138,7 @@ static const char *mode_type_names[] = { "driver", }; -bit_name_fn(mode_type) +static bit_name_fn(mode_type) static const char *mode_flag_names[] = { "phsync", @@ -157,9 +157,9 @@ static const char *mode_flag_names[] = { "clkdiv2" }; -bit_name_fn(mode_flag) +static bit_name_fn(mode_flag) -void dump_encoders(void) +static void dump_encoders(void) { drmModeEncoder *encoder; int i; @@ -185,7 +185,7 @@ void dump_encoders(void) printf("\n"); } -void dump_mode(drmModeModeInfo *mode) +static void dump_mode(drmModeModeInfo *mode) { printf(" %s %d %d %d %d %d %d %d %d %d", mode->name, @@ -301,7 +301,7 @@ dump_prop(uint32_t prop_id, uint64_t value) drmModeFreeProperty(prop); } -void dump_connectors(void) +static void dump_connectors(void) { drmModeConnector *connector; int i, j; @@ -347,7 +347,7 @@ void dump_connectors(void) printf("\n"); } -void dump_crtcs(void) +static void dump_crtcs(void) { drmModeCrtc *crtc; drmModeObjectPropertiesPtr props; @@ -389,7 +389,7 @@ void dump_crtcs(void) printf("\n"); } -void dump_framebuffers(void) +static void dump_framebuffers(void) { drmModeFB *fb; int i; @@ -574,7 +574,7 @@ connector_find_mode(struct connector *c) /* and figure out which crtc index it is: */ for (i = 0; i < resources->count_crtcs; i++) { - if (c->crtc == resources->crtcs[i]) { + if (c->crtc == (int)resources->crtcs[i]) { c->pipe = i; break; } @@ -584,7 +584,7 @@ connector_find_mode(struct connector *c) /* -------------------------------------------------------------------------- */ -void +static void page_flip_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) { @@ -622,7 +622,7 @@ set_plane(struct kms_driver *kms, struct connector *c, struct plane *p) uint32_t plane_id = 0; struct kms_bo *plane_bo; uint32_t plane_flags = 0; - int ret, crtc_x, crtc_y, crtc_w, crtc_h; + int crtc_x, crtc_y, crtc_w, crtc_h; unsigned int i; /* find an unused plane which can be connected to our crtc */ @@ -861,7 +861,7 @@ static int parse_connector(struct connector *c, const char *arg) arg = endp + 1; p = strchrnul(arg, '@'); - len = min(sizeof c->mode_str - 1, p - arg); + len = min(sizeof c->mode_str - 1, (unsigned int)(p - arg)); strncpy(c->mode_str, arg, len); c->mode_str[len] = '\0'; @@ -883,7 +883,7 @@ static int parse_plane(struct plane *p, const char *arg) { strcpy(p->format_str, "XR24"); - if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, &p->format_str) != 4 && + if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, p->format_str) != 4 && sscanf(arg, "%d:%dx%d", &p->con_id, &p->w, &p->h) != 3) return -1; @@ -896,7 +896,7 @@ static int parse_plane(struct plane *p, const char *arg) return 0; } -void usage(char *name) +static void usage(char *name) { fprintf(stderr, "usage: %s [-ecpmf]\n", name); fprintf(stderr, "\t-e\tlist encoders\n"); @@ -939,11 +939,11 @@ int main(int argc, char **argv) int c; int encoders = 0, connectors = 0, crtcs = 0, planes = 0, framebuffers = 0; int test_vsync = 0; - char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos" }; + const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos" }; unsigned int i; int count = 0, plane_count = 0; struct connector con_args[2]; - struct plane plane_args[2] = {0}; + struct plane plane_args[2] = { { 0, }, }; opterr = 0; while ((c = getopt(argc, argv, optstr)) != -1) {