From patchwork Mon Nov 14 09:59:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9426961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 68DB560471 for ; Mon, 14 Nov 2016 10:00:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E80D2870A for ; Mon, 14 Nov 2016 10:00:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D7B286D4; Mon, 14 Nov 2016 10:00:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5ABAD286D4 for ; Mon, 14 Nov 2016 10:00:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 361476E3AA; Mon, 14 Nov 2016 09:59:54 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59CAF6E3A2; Mon, 14 Nov 2016 09:59:51 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id y68so5966718pfb.1; Mon, 14 Nov 2016 01:59:51 -0800 (PST) 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=EpOmM6cyI/rJQZX3KFF5wZcaMB5lAInmqeDq7fECPDo=; b=mUqNp8hkcF3fwRVFPZLlxuHmeydFA5gIvqya/zCO919z2zD19ZYhOW+eP3LzwBjqN8 7B6CXketGMaCRirkeJ4mnnzGT9gPunUrJBm3I89+3CUIO5f4rc/+blE9DKXmP4Qk3rr6 UFrBkqw3Hce787CEkFMVSZzdbywlPq2DCPkXTLNoCGDkqBQL6EdKebeANDaQfRxhs3cv iCBCcOU3XYrSOV6ePHCgeXGbvL/vxCUKiFhiVkZArQUsWkOVnVeXpTcSv0iPaSBxrnr8 YFwbCa6Y8RU7NVJ5hTqFXRhCFECPD6En+Glhzsfoe038zQDcSoWCIjQoNpNeV5Y/67u5 4fjA== X-Gm-Message-State: ABUngveakZIfaBr513agrE+MyVYdQ+9OSIxJXecb1wbmaA7gSNQ71RgEp00ZAbm3k9l3LQ== X-Received: by 10.98.65.156 with SMTP id g28mr34420714pfd.110.1479117590775; Mon, 14 Nov 2016 01:59:50 -0800 (PST) Received: from jade.nodan1.kt.home.ne.jp (202-72-64-164.koalanet.ne.jp. [202.72.64.164]) by smtp.gmail.com with ESMTPSA id p125sm14320235pfg.33.2016.11.14.01.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 01:59:50 -0800 (PST) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Nov 2016 18:59:19 +0900 Message-Id: <1479117566-17709-8-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479117566-17709-1-git-send-email-gustavo@padovan.org> References: <1479117566-17709-1-git-send-email-gustavo@padovan.org> Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 05/12] tests/kms_atomic: use global atomic properties definitions 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-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Signed-off-by: Gustavo Padovan --- tests/kms_atomic.c | 123 ++++++++++++++++------------------------------------- 1 file changed, 37 insertions(+), 86 deletions(-) diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index 1441fdf..8b648eb 100644 --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -105,55 +105,6 @@ static const char *plane_type_prop_names[NUM_PLANE_TYPE_PROPS] = { "Cursor" }; -enum plane_properties { - PLANE_SRC_X = 0, - PLANE_SRC_Y, - PLANE_SRC_W, - PLANE_SRC_H, - PLANE_CRTC_X, - PLANE_CRTC_Y, - PLANE_CRTC_W, - PLANE_CRTC_H, - PLANE_FB_ID, - PLANE_CRTC_ID, - PLANE_TYPE, - NUM_PLANE_PROPS -}; - -static const char *plane_prop_names[NUM_PLANE_PROPS] = { - "SRC_X", - "SRC_Y", - "SRC_W", - "SRC_H", - "CRTC_X", - "CRTC_Y", - "CRTC_W", - "CRTC_H", - "FB_ID", - "CRTC_ID", - "type" -}; - -enum crtc_properties { - CRTC_MODE_ID = 0, - CRTC_ACTIVE, - NUM_CRTC_PROPS -}; - -static const char *crtc_prop_names[NUM_CRTC_PROPS] = { - "MODE_ID", - "ACTIVE" -}; - -enum connector_properties { - CONNECTOR_CRTC_ID = 0, - NUM_CONNECTOR_PROPS -}; - -static const char *connector_prop_names[NUM_CONNECTOR_PROPS] = { - "CRTC_ID" -}; - struct kms_atomic_blob { uint32_t id; /* 0 if not already allocated */ size_t len; @@ -197,9 +148,9 @@ struct kms_atomic_state { struct kms_atomic_desc { int fd; - uint32_t props_connector[NUM_CONNECTOR_PROPS]; - uint32_t props_crtc[NUM_CRTC_PROPS]; - uint32_t props_plane[NUM_PLANE_PROPS]; + uint32_t props_connector[IGT_NUM_CONNECTOR_PROPS]; + uint32_t props_crtc[IGT_NUM_CRTC_PROPS]; + uint32_t props_plane[IGT_NUM_PLANE_PROPS]; uint64_t props_plane_type[NUM_PLANE_TYPE_PROPS]; }; @@ -280,7 +231,7 @@ connector_get_current_state(struct kms_atomic_connector_state *connector) for (i = 0; i < props->count_props; i++) { uint32_t *prop_ids = connector->state->desc->props_connector; - if (props->props[i] == prop_ids[CONNECTOR_CRTC_ID]) + if (props->props[i] == prop_ids[IGT_CONNECTOR_CRTC_ID]) connector->crtc_id = props->prop_values[i]; } drmModeFreeObjectProperties(props); @@ -348,16 +299,16 @@ find_connector(struct kms_atomic_state *state, static void plane_populate_req(struct kms_atomic_plane_state *plane, drmModeAtomicReq *req) { - plane_set_prop(req, plane, PLANE_CRTC_ID, plane->crtc_id); - plane_set_prop(req, plane, PLANE_FB_ID, plane->fb_id); - plane_set_prop(req, plane, PLANE_SRC_X, plane->src_x); - plane_set_prop(req, plane, PLANE_SRC_Y, plane->src_y); - plane_set_prop(req, plane, PLANE_SRC_W, plane->src_w); - plane_set_prop(req, plane, PLANE_SRC_H, plane->src_h); - plane_set_prop(req, plane, PLANE_CRTC_X, plane->crtc_x); - plane_set_prop(req, plane, PLANE_CRTC_Y, plane->crtc_y); - plane_set_prop(req, plane, PLANE_CRTC_W, plane->crtc_w); - plane_set_prop(req, plane, PLANE_CRTC_H, plane->crtc_h); + plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id); + plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id); + plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x); + plane_set_prop(req, plane, IGT_PLANE_SRC_Y, plane->src_y); + plane_set_prop(req, plane, IGT_PLANE_SRC_W, plane->src_w); + plane_set_prop(req, plane, IGT_PLANE_SRC_H, plane->src_h); + plane_set_prop(req, plane, IGT_PLANE_CRTC_X, plane->crtc_x); + plane_set_prop(req, plane, IGT_PLANE_CRTC_Y, plane->crtc_y); + plane_set_prop(req, plane, IGT_PLANE_CRTC_W, plane->crtc_w); + plane_set_prop(req, plane, IGT_PLANE_CRTC_H, plane->crtc_h); } static void plane_get_current_state(struct kms_atomic_plane_state *plane) @@ -373,27 +324,27 @@ static void plane_get_current_state(struct kms_atomic_plane_state *plane) for (i = 0; i < props->count_props; i++) { uint32_t *prop_ids = desc->props_plane; - if (props->props[i] == prop_ids[PLANE_CRTC_ID]) + if (props->props[i] == prop_ids[IGT_PLANE_CRTC_ID]) plane->crtc_id = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_FB_ID]) + else if (props->props[i] == prop_ids[IGT_PLANE_FB_ID]) plane->fb_id = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_CRTC_X]) + else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_X]) plane->crtc_x = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_CRTC_Y]) + else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_Y]) plane->crtc_y = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_CRTC_W]) + else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_W]) plane->crtc_w = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_CRTC_H]) + else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_H]) plane->crtc_h = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_SRC_X]) + else if (props->props[i] == prop_ids[IGT_PLANE_SRC_X]) plane->src_x = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_SRC_Y]) + else if (props->props[i] == prop_ids[IGT_PLANE_SRC_Y]) plane->src_y = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_SRC_W]) + else if (props->props[i] == prop_ids[IGT_PLANE_SRC_W]) plane->src_w = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_SRC_H]) + else if (props->props[i] == prop_ids[IGT_PLANE_SRC_H]) plane->src_h = props->prop_values[i]; - else if (props->props[i] == prop_ids[PLANE_TYPE]) { + else if (props->props[i] == prop_ids[IGT_PLANE_TYPE]) { int j; for (j = 0; j < ARRAY_SIZE(desc->props_plane_type); j++) { @@ -473,8 +424,8 @@ find_plane(struct kms_atomic_state *state, enum plane_type type, static void crtc_populate_req(struct kms_atomic_crtc_state *crtc, drmModeAtomicReq *req) { - crtc_set_prop(req, crtc, CRTC_MODE_ID, crtc->mode.id); - crtc_set_prop(req, crtc, CRTC_ACTIVE, crtc->active); + crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id); + crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active); } static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc) @@ -489,7 +440,7 @@ static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc) for (i = 0; i < props->count_props; i++) { uint32_t *prop_ids = crtc->state->desc->props_crtc; - if (props->props[i] == prop_ids[CRTC_MODE_ID]) { + if (props->props[i] == prop_ids[IGT_CRTC_MODE_ID]) { drmModePropertyBlobPtr blob; crtc->mode.id = props->prop_values[i]; @@ -509,7 +460,7 @@ static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc) crtc->mode.data = blob->data; crtc->mode.len = blob->length; } - else if (props->props[i] == prop_ids[CRTC_ACTIVE]) { + else if (props->props[i] == prop_ids[IGT_CRTC_ACTIVE]) { crtc->active = props->prop_values[i]; } } @@ -618,7 +569,7 @@ static void crtc_commit_legacy(struct kms_atomic_crtc_state *crtc, for (i = 0; i < props->count_props; i++) { if (props->props[i] != - crtc->state->desc->props_crtc[CRTC_MODE_ID]) + crtc->state->desc->props_crtc[IGT_CRTC_MODE_ID]) continue; crtc->mode.id = props->prop_values[i]; break; @@ -747,20 +698,20 @@ static void atomic_setup(struct kms_atomic_state *state) igt_assert(state->connectors); fill_obj_props(desc->fd, res->crtcs[0], - DRM_MODE_OBJECT_CRTC, NUM_CRTC_PROPS, - crtc_prop_names, desc->props_crtc); + DRM_MODE_OBJECT_CRTC, IGT_NUM_CRTC_PROPS, + igt_crtc_prop_names, desc->props_crtc); fill_obj_props(desc->fd, res_plane->planes[0], - DRM_MODE_OBJECT_PLANE, NUM_PLANE_PROPS, - plane_prop_names, desc->props_plane); + DRM_MODE_OBJECT_PLANE, IGT_NUM_PLANE_PROPS, + igt_plane_prop_names, desc->props_plane); fill_obj_prop_map(desc->fd, res_plane->planes[0], DRM_MODE_OBJECT_PLANE, "type", NUM_PLANE_TYPE_PROPS, plane_type_prop_names, desc->props_plane_type); fill_obj_props(desc->fd, res->connectors[0], - DRM_MODE_OBJECT_CONNECTOR, NUM_CONNECTOR_PROPS, - connector_prop_names, desc->props_connector); + DRM_MODE_OBJECT_CONNECTOR, IGT_NUM_CONNECTOR_PROPS, + igt_connector_prop_names, desc->props_connector); for (i = 0; i < state->num_crtcs; i++) { struct kms_atomic_crtc_state *crtc = &state->crtcs[i]; @@ -1236,7 +1187,7 @@ static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc, /* Valid property, valid value. */ for (i = 0; i < ARRAY_SIZE(props_raw); i++) { - props_raw[i] = desc->props_crtc[CRTC_MODE_ID]; + props_raw[i] = desc->props_crtc[IGT_CRTC_MODE_ID]; values_raw[i] = crtc->mode.id; } do_ioctl(desc->fd, DRM_IOCTL_MODE_ATOMIC, &ioc);