From patchwork Tue Mar 19 14:55:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2301681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 471ECDFB79 for ; Tue, 19 Mar 2013 15:10:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FDE7E6173 for ; Tue, 19 Mar 2013 08:10:59 -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 BE9F1E5F65 for ; Tue, 19 Mar 2013 07:55:32 -0700 (PDT) Received: from avalon.ideasonboard.com (unknown [91.178.238.129]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 06117366FA for ; Tue, 19 Mar 2013 15:55:12 +0100 (CET) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 16/21] modetest: Store the mode in the crtc structure Date: Tue, 19 Mar 2013 15:55:57 +0100 Message-Id: <1363704962-14077-17-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1363704962-14077-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1363704962-14077-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 This prepares the code for the split in separate functions of CRTC and planes setup. Signed-off-by: Laurent Pinchart --- tests/modetest/modetest.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 74e82ef..0e3f396 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -61,6 +61,7 @@ struct crtc { drmModeCrtc *crtc; drmModeObjectProperties *props; drmModePropertyRes **props_info; + drmModeModeInfo *mode; }; struct encoder { @@ -523,6 +524,7 @@ static void free_resources(struct resources *res) static struct resources *get_resources(struct device *dev) { struct resources *res; + int i; res = malloc(sizeof *res); if (res == 0) @@ -597,6 +599,9 @@ static struct resources *get_resources(struct device *dev) get_properties(res, res, crtc, CRTC); get_properties(res, res, connector, CONNECTOR); + for (i = 0; i < res->res->count_crtcs; ++i) + res->crtcs[i].mode = &res->crtcs[i].crtc->mode; + res->plane_res = drmModeGetPlaneResources(dev->fd); if (!res->plane_res) { fprintf(stderr, "drmModeGetPlaneResources failed: %s\n", @@ -712,6 +717,7 @@ static void connector_find_mode(struct device *dev, struct connector_arg *c) struct crtc *crtc = &dev->resources->crtcs[i]; if (c->crtc_id == crtc->crtc->crtc_id) { + crtc->mode = c->mode; c->crtc = crtc; break; } @@ -882,8 +888,8 @@ set_plane(struct device *dev, struct connector_arg *c, struct plane_arg *p) if (p->x == (uint32_t)-1 || p->y == (uint32_t)-1) { /* Default to the middle of the screen */ - crtc_x = (c->mode->hdisplay - p->w) / 2; - crtc_y = (c->mode->vdisplay - p->h) / 2; + crtc_x = (c->crtc->mode->hdisplay - p->w) / 2; + crtc_y = (c->crtc->mode->vdisplay - p->h) / 2; } else { crtc_x = p->x; crtc_y = p->y;