From patchwork Wed Sep 3 00:43:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 4829511 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 04187C0338 for ; Wed, 3 Sep 2014 00:43:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05E4E201D3 for ; Wed, 3 Sep 2014 00:43:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 15D8C201CD for ; Wed, 3 Sep 2014 00:43:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 276976E1CF; Tue, 2 Sep 2014 17:43:25 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id D8AB36E1BC for ; Tue, 2 Sep 2014 17:43:23 -0700 (PDT) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s830hNX1029874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 2 Sep 2014 20:43:23 -0400 Received: from dreadlord-bne-redhat-com.bne.redhat.com (dhcp-40-7.bne.redhat.com [10.64.40.7]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s830hLqh030338 for ; Tue, 2 Sep 2014 20:43:22 -0400 From: Dave Airlie To: intel-gfx@lists.freedesktop.org Date: Wed, 3 Sep 2014 10:43:20 +1000 Message-Id: <1409705001-972-1-git-send-email-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Subject: [Intel-gfx] [PATCH 1/2] intel/uxa/display: drop mode_res caching. 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=-5.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 From: Dave Airlie This will cause problems with MST displays. Signed-off-by: Dave Airlie --- src/uxa/intel_display.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c index 0b83140..7cdb85f 100644 --- a/src/uxa/intel_display.c +++ b/src/uxa/intel_display.c @@ -80,7 +80,6 @@ static struct list intel_drm_queue; struct intel_mode { int fd; uint32_t fb_id; - drmModeResPtr mode_res; int cpp; drmEventContext event_context; @@ -706,7 +705,7 @@ static const xf86CrtcFuncsRec intel_crtc_funcs = { }; static void -intel_crtc_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) +intel_crtc_init(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_res, int num) { intel_screen_private *intel = intel_get_screen_private(scrn); xf86CrtcPtr crtc; @@ -723,7 +722,7 @@ intel_crtc_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) } intel_crtc->mode_crtc = drmModeGetCrtc(mode->fd, - mode->mode_res->crtcs[num]); + mode_res->crtcs[num]); if (intel_crtc->mode_crtc == NULL) { free(intel_crtc); return; @@ -1340,7 +1339,7 @@ static const char *output_names[] = { }; static void -intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) +intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_res, int num) { xf86OutputPtr output; drmModeConnectorPtr koutput; @@ -1350,7 +1349,7 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) char name[32]; koutput = drmModeGetConnector(mode->fd, - mode->mode_res->connectors[num]); + mode_res->connectors[num]); if (!koutput) return; @@ -1381,7 +1380,7 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) return; } - intel_output->output_id = mode->mode_res->connectors[num]; + intel_output->output_id = mode_res->connectors[num]; intel_output->mode_output = koutput; intel_output->mode_encoder = kencoder; intel_output->mode = mode; @@ -1964,10 +1963,10 @@ intel_mode_read_drm_events(struct intel_screen_private *intel) } static drmModeEncoderPtr -intel_get_kencoder(struct intel_mode *mode, int num) +intel_get_kencoder(struct intel_mode *mode, drmModeResPtr mode_res, int num) { struct intel_output *iterator; - int id = mode->mode_res->encoders[num]; + int id = mode_res->encoders[num]; list_for_each_entry(iterator, &mode->outputs, link) if (iterator->mode_encoder->encoder_id == id) @@ -1982,7 +1981,7 @@ intel_get_kencoder(struct intel_mode *mode, int num) * values read from libdrm. */ static void -intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode) +intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_res) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); struct intel_output *intel_output, *clone; @@ -2001,7 +2000,7 @@ intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode) if ((mask & 1) == 0) continue; - cloned_encoder = intel_get_kencoder(mode, j); + cloned_encoder = intel_get_kencoder(mode, mode_res, j); if (!cloned_encoder) continue; @@ -2024,6 +2023,7 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp) struct intel_mode *mode; unsigned int i; int has_flipping; + drmModeResPtr mode_res; mode = calloc(1, sizeof *mode); if (!mode) @@ -2037,23 +2037,23 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp) xf86CrtcConfigInit(scrn, &intel_xf86crtc_config_funcs); mode->cpp = cpp; - mode->mode_res = drmModeGetResources(mode->fd); - if (!mode->mode_res) { + mode_res = drmModeGetResources(mode->fd); + if (!mode_res) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "failed to get resources: %s\n", strerror(errno)); free(mode); return FALSE; } - xf86CrtcSetSizeRange(scrn, 320, 200, mode->mode_res->max_width, - mode->mode_res->max_height); - for (i = 0; i < mode->mode_res->count_crtcs; i++) - intel_crtc_init(scrn, mode, i); + xf86CrtcSetSizeRange(scrn, 320, 200, mode_res->max_width, + mode_res->max_height); + for (i = 0; i < mode_res->count_crtcs; i++) + intel_crtc_init(scrn, mode, mode_res, i); - for (i = 0; i < mode->mode_res->count_connectors; i++) - intel_output_init(scrn, mode, i); + for (i = 0; i < mode_res->count_connectors; i++) + intel_output_init(scrn, mode, mode_res, i); - intel_compute_possible_clones(scrn, mode); + intel_compute_possible_clones(scrn, mode, mode_res); #ifdef INTEL_PIXMAP_SHARING xf86ProviderSetup(scrn, NULL, "Intel"); @@ -2081,6 +2081,7 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp) } intel->modes = mode; + drmModeFreeResources(mode_res); return TRUE; }