From patchwork Thu Mar 19 04:33:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6045871 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7F16FBF90F for ; Thu, 19 Mar 2015 04:34:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BECEE204AF for ; Thu, 19 Mar 2015 04:34:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B2F8320465 for ; Thu, 19 Mar 2015 04:34:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08AC96E960; Wed, 18 Mar 2015 21:34:03 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D7056E0E4 for ; Wed, 18 Mar 2015 21:33:58 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 320A5600621 From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH 23/37] drm: mode: Cache userspace mode representation Date: Thu, 19 Mar 2015 04:33:22 +0000 Message-Id: <1426739616-10635-23-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1426739616-10635-1-git-send-email-daniels@collabora.com> References: <1426739556-10429-1-git-send-email-daniels@collabora.com> <1426739616-10635-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 For every mode which may be visible to userspace - either current on a CRTC as a result of setcrtc, or advertised through the connector's mode list - cache the drm_mode_modeinfo representation to send back to userspace. Signed-off-by: Daniel Stone --- drivers/gpu/drm/drm_modes.c | 2 ++ include/drm/drm_modes.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index bb46335..803e00a 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -969,6 +969,7 @@ struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev, out->type = in->type; strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); out->name[DRM_DISPLAY_MODE_LEN-1] = 0; + out->umode = *in; out->status = drm_mode_validate_basic(out); if (out->status != MODE_OK) @@ -1282,6 +1283,7 @@ void drm_mode_connector_list_update(struct drm_connector *connector, } if (!found_it) { + drm_mode_convert_to_umode(&pmode->umode, pmode); list_move_tail(&pmode->head, &connector->modes); } } diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index ea2f0c2..e7eb727 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -100,6 +100,7 @@ struct drm_display_mode { /* Header */ struct list_head head; struct drm_mode_object base; + struct drm_mode_modeinfo umode; char name[DRM_DISPLAY_MODE_LEN];