From patchwork Tue Jun 20 19:25:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9806201 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 8CB2A6086C for ; Fri, 23 Jun 2017 10:28:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C38B2866C for ; Fri, 23 Jun 2017 10:28:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70B9C2869B; Fri, 23 Jun 2017 10:28:31 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable 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 092E22866C for ; Fri, 23 Jun 2017 10:28:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AD0A89C3F; Fri, 23 Jun 2017 10:27:55 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 4817 seconds by postgrey-1.35 at gabe; Tue, 20 Jun 2017 20:59:46 UTC Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0103.outbound.protection.outlook.com [104.47.1.103]) by gabe.freedesktop.org (Postfix) with ESMTPS id A54846E3C4; Tue, 20 Jun 2017 20:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SMYTnHYjNypENCPqGCNS1XYvcNbJ7QdLxjJNucxxPxE=; b=nR5hnNjry+5a7zNoNQWT1ul/UW6070bNNZuuq9tjVpoV4zeSvi7P1xEgjxiy/Satb+FpP+yYdJhgkYXdLd2wF2j4sFsx3884eZOMHFMiBR2C2VB9cWNImtWoBR8Xgrzjc1chUOlLEYlVo2KgyoX5roEiFHYJt7AxpBzDpNlJPOU= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from orc.lan (81.224.171.159) by HE1PR0202MB2556.eurprd02.prod.outlook.com (2603:10a6:3:90::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14; Tue, 20 Jun 2017 19:24:57 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Date: Tue, 20 Jun 2017 21:25:25 +0200 Message-Id: <1497986735-14418-2-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1497986735-14418-1-git-send-email-peda@axentia.se> References: <1497986735-14418-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB6PR07CA0081.eurprd07.prod.outlook.com (2603:10a6:6:2b::19) To HE1PR0202MB2556.eurprd02.prod.outlook.com (2603:10a6:3:90::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff02ea53-9fdb-431c-9703-08d4b8120b3a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:HE1PR0202MB2556; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0202MB2556; 3:JiCRT/GygA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QSvKJnxwZe3ijeU75+yNFBsHQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(2016111802025)(201703131423075)(201703061421075)(20161123558100)(6043046)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0202MB2556; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0202MB2556; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0202MB2556; 4:JN/e8K0CmMgo76fuI0TVW4eCcvFkd76V3IZ36DhF?= =?us-ascii?Q?IImAK+kOIPgBAiGFpX9WYoBXFieVlgoRz0TrMpqdN/clDL8jTBvu/y2ZAC7g?= =?us-ascii?Q?6YW1NURQUMARlXLGguVfmA2dJ2+XBjkvedfhDXZDymnFqkgKJg5KgrNR6ILV?= =?us-ascii?Q?8IUYyUj29COzWXMLyumN3xGS13+Ms7PbF9x4GdkX+YL8zTYxQSJsYp9DhXzh?= =?us-ascii?Q?myGCnqt3scu4z9WgHeTuGuo+QCYzXMEA+wK16OIhVFvW221Y1z73W2H9tRNv?= =?us-ascii?Q?ZWJvRUzulgbicaV5/Xvr1iYTUIOnfTDnLEA16WnLNHxVW+1yUT30WWKpTSlN?= =?us-ascii?Q?rGFjQ8bRSbKqMs7q3QwytH3xGQbIW+4Df3kQCBmIdywY182EciuKPtkO/pc6?= =?us-ascii?Q?dIJZTMntbrJ+7Wr/dhQflTUAHy9XuqvU9wQPPct0I6o49zX4fiOadw9DhfGX?= =?us-ascii?Q?cvCpfuRDy+QrVTJCa7ayLU3uRVn04SDCe/o0Mp5PrBiI+/dkIVG//4+GLRBr?= =?us-ascii?Q?/b0b1NlxK0SIGPPvTPnXT8dHAY3yPFsEOKO21FsOWCFvsnA/0LjYAq8ZTA1b?= =?us-ascii?Q?WfO5JPGZtKDmi2VLd1zbz2Oftow+ZjQhTL07CR4mN9ja6hRcBD9AZUt3VkGy?= =?us-ascii?Q?NjZI8MrQm/VVhCCbV5p3coPTrlGPd/v8YJfJ/LKHsFIemC7y54KKr2sYWu1c?= =?us-ascii?Q?D0lNbdOPDjAWl8F847DTYLGZXo9zH9r50PwohqgBFAEUbetM1ruSyHi4XTaO?= =?us-ascii?Q?Ov1rsLti5faHUnsw9o34vXqhJYNJG9429HErvqtjI6V2UgNLsm3kN7YX1OMY?= =?us-ascii?Q?kAOMhsXO5JLi5ABW3268ctKgZVGVclvhSV72SjAkTWH+En8YAG5bk7DfGCxe?= =?us-ascii?Q?xHxRLCWk9253TLVVXA1ZlNqrbawwce/e/3rWeLv/E9FJvJBRC19SmiNrCZPt?= =?us-ascii?Q?VE+7Gn1C9r3FLwnzkB8zUSvJUywrKaWl3W8iK+1tPtAnPL9ucPjXoBDtkCXU?= =?us-ascii?Q?cOCZhOpLH1D1RFBrX5kW/OxKwX/g+uiGsZ4BSKSuhADuAmYk6yZCJTglMI+L?= =?us-ascii?Q?0Rzdkn0fw0FYox0UXoKKdwiUCsauCLzGyecEDWreUk3lu/KDx6AUiEL0kB9x?= =?us-ascii?Q?Hz4Tmi5HDys=3D?= X-Forefront-PRVS: 03449D5DD1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39400400002)(39450400003)(6506006)(8666007)(53936002)(2906002)(8676002)(7736002)(38730400002)(110136004)(6916009)(2950100002)(6666003)(5003940100001)(74482002)(305945005)(81166006)(50226002)(42186005)(76176999)(6116002)(50466002)(50986999)(4326008)(7416002)(25786009)(3846002)(2351001)(2361001)(48376002)(86362001)(54906002)(189998001)(6512007)(5660300001)(6486002)(33646002)(66066001)(36756003)(47776003)(142923001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0202MB2556; H:orc.lan; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0202MB2556; 23:zG6cnRyX3j5BnmrkumSeqOgbM3MXHp5t6uQagEt?= =?us-ascii?Q?RWYMCwMbnEy9YsNcsrpJYyT4ImhceqLd2aFJKVjMbJ5v92xu4B+Bgaz/oDxE?= =?us-ascii?Q?LXxJ02CfoxDVN1RYd5okQq66AcqeDxCiADytlrrPW22cbGHE9dq9lF7KIvye?= =?us-ascii?Q?gZ2ZINIM133lV1wso4570jDJnSAaLQDkGvjZWdW7n7Vt3vDbUbHaclII+RdL?= =?us-ascii?Q?ykKTxpEU3pZorwjNrofNXSjoebgkMuHxsfelo+Quh7Uf48v0PM98KJk0WsLh?= =?us-ascii?Q?ujiItg5YaGuxF5tAyf5bwcyq/BLQE3lkqTqyXhFGx1Y2zDq1x+aBS1C4D/AD?= =?us-ascii?Q?Uh8tS/+9JqCn5dgbSsFiT5pLuWGZKGPirxN5p0XszVsFYn7lVSN73h8hN8VL?= =?us-ascii?Q?qb+CqS9tGK0vAzfFaIrkNA/xeuZVzRDmeIt+qeVE5dCJmQNNwqsMW4+PzFxK?= =?us-ascii?Q?Pdoz33oTn5j44TVeS3nw8fM/xe2DQoCCaoIZrlKfyDg6QsyjXVJhmjL+q973?= =?us-ascii?Q?wPOxxg8iDB7szc8Exk9AGwL/Gb/ekY7gQ5+rj4bD5eU6Xjd3b1hjwFXabpok?= =?us-ascii?Q?p/2W4weN0xOS08d0Bxy8kYwOKPA3SR2dFhQ9CAi8MHk2h6EyeoXQa1UfhvaR?= =?us-ascii?Q?cbJvhkZ7jPQOGb2IU30EIV2KUZTFmJ1j9RMGGuhttYYjJ3UF/8por3GZ/uXc?= =?us-ascii?Q?JDt3WEQ9uvyJXOdGvSEv/SHBqSAwvgTiqM/ZQQ3Z4AKtfMJCoDQp2N/wJz8D?= =?us-ascii?Q?wpDVSoIHOWdQnUTiMd7DX+6RE0FCGVMO1rcJxzbohyuV1K2bxdDy5/4LMkP/?= =?us-ascii?Q?L4IPyHNUu5jHJ9Hke+NbyVTmNxHl8nDDdAGyswczdBsEqeTvhImq5hNdbNey?= =?us-ascii?Q?MdutSL0yJQRrlKeccdMVXHT5e3vNO+C8ONyXccp3V3U7xOBZXLDztwvxW3zi?= =?us-ascii?Q?euTHL1vaaCkFK+wODUnWbuoWbnqI+Spe86WD5E5tppLogFVxVD2kKZ7v+Tn0?= =?us-ascii?Q?BDJodIJ6NigUAItmnFGKFuaQF9LbLbLP2yvnHcu+C2cVcgY1BBQ+9cbz6bkm?= =?us-ascii?Q?ACTtoTQWnrxs3NPYCeg132sNcsPoY?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0202MB2556; 6:2XYHrk+My1+P9c5iHfEgQpBfLwOQfAkYQ7pV18Bb?= =?us-ascii?Q?ttkozDWFJqaet3BQ+dZi2CDrIbkPB9jIMV9by3vrEnDQUGca76L9qrciQK50?= =?us-ascii?Q?r25XgdIpPho/jMUVQn1JXoCDNMXrn3i4gRMPKwgyN46W7WUujrlv5MMV4o15?= =?us-ascii?Q?7uLcF0W+OyF8pjTYxWIbU6ipoB859sshJadwlLUutwSGLmayjyr2ZCvTeqpe?= =?us-ascii?Q?+YJp128mrzsta3IPTg20oN8dabis+uAn4mjSufI/baHMIbu8qafTul5g6TMj?= =?us-ascii?Q?GJIf0THNU73IEJzz+EzLEVI1JrJnFBrghjKXHerTwemqgU6ShrNW/+TtB6jE?= =?us-ascii?Q?8rJ8bqrmXfAWINNoM0WQdGWPr2tduOjP45jzikPkpNJpzrx3I6iaQ5ZGfs8z?= =?us-ascii?Q?vVnSMne+LlusloyyPQDb3lUrXRRlUZ5G8tMy+B67+kt4URueQ0pMW04nwKen?= =?us-ascii?Q?Gb0533cpg8QTo5ZJReN1bNORzxZkufTAcb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C0wGqCgZDSfcRYH0Bb+g4Dt3RpBrEKs9YqpoOZrMRKacevNOOMMf4= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2017 19:24:57.2143 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0202MB2556 X-Mailman-Approved-At: Fri, 23 Jun 2017 10:26:43 +0000 Cc: Boris Brezillon , amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, David Airlie , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Philippe Cornu , =?UTF-8?q?Christian=20K=C3=B6nig?= , Yannick Fertre , Gerd Hoffmann , Benjamin Gaignard , Daniel Vetter , Alex Deucher , Dave Airlie , virtualization@lists.linux-foundation.org, Vincent Abriou , Peter Rosin , Ben Skeggs Subject: [Intel-gfx] [PATCH 01/11] drm/fb-helper: do a generic fb_setcmap helper in terms of crtc .gamma_set 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This makes the redundant fb helpers .load_lut, .gamma_set and .gamma_get totally obsolete. I think the gamma_store can end up invalid on error. But the way I read it, that can happen in drm_mode_gamma_set_ioctl as well, so why should this pesky legacy fbdev stuff be any better? drm_fb_helper_save_lut_atomic justs saves the gamma lut for later. However, it saves it to the gamma_store which should already be up to date with what .gamma_get would return and is thus a nop. So, zap it. Signed-off-by: Peter Rosin --- drivers/gpu/drm/drm_fb_helper.c | 131 ++++++++++++---------------------------- 1 file changed, 40 insertions(+), 91 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 574af01..cc2d55d 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -229,22 +229,6 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, } EXPORT_SYMBOL(drm_fb_helper_remove_one_connector); -static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_helper *helper) -{ - uint16_t *r_base, *g_base, *b_base; - int i; - - if (helper->funcs->gamma_get == NULL) - return; - - r_base = crtc->gamma_store; - g_base = r_base + crtc->gamma_size; - b_base = g_base + crtc->gamma_size; - - for (i = 0; i < crtc->gamma_size; i++) - helper->funcs->gamma_get(crtc, &r_base[i], &g_base[i], &b_base[i], i); -} - static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) { uint16_t *r_base, *g_base, *b_base; @@ -285,7 +269,6 @@ int drm_fb_helper_debug_enter(struct fb_info *info) if (drm_drv_uses_atomic_modeset(mode_set->crtc->dev)) continue; - drm_fb_helper_save_lut_atomic(mode_set->crtc, helper); funcs->mode_set_base_atomic(mode_set->crtc, mode_set->fb, mode_set->x, @@ -1167,50 +1150,6 @@ void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, } EXPORT_SYMBOL(drm_fb_helper_set_suspend_unlocked); -static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green, - u16 blue, u16 regno, struct fb_info *info) -{ - struct drm_fb_helper *fb_helper = info->par; - struct drm_framebuffer *fb = fb_helper->fb; - - if (info->fix.visual == FB_VISUAL_TRUECOLOR) { - u32 *palette; - u32 value; - /* place color in psuedopalette */ - if (regno > 16) - return -EINVAL; - palette = (u32 *)info->pseudo_palette; - red >>= (16 - info->var.red.length); - green >>= (16 - info->var.green.length); - blue >>= (16 - info->var.blue.length); - value = (red << info->var.red.offset) | - (green << info->var.green.offset) | - (blue << info->var.blue.offset); - if (info->var.transp.length > 0) { - u32 mask = (1 << info->var.transp.length) - 1; - - mask <<= info->var.transp.offset; - value |= mask; - } - palette[regno] = value; - return 0; - } - - /* - * The driver really shouldn't advertise pseudo/directcolor - * visuals if it can't deal with the palette. - */ - if (WARN_ON(!fb_helper->funcs->gamma_set || - !fb_helper->funcs->gamma_get)) - return -EINVAL; - - WARN_ON(fb->format->cpp[0] != 1); - - fb_helper->funcs->gamma_set(crtc, red, green, blue, regno); - - return 0; -} - /** * drm_fb_helper_setcmap - implementation for &fb_ops.fb_setcmap * @cmap: cmap to set @@ -1220,51 +1159,61 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) { struct drm_fb_helper *fb_helper = info->par; struct drm_device *dev = fb_helper->dev; - const struct drm_crtc_helper_funcs *crtc_funcs; - u16 *red, *green, *blue, *transp; + struct drm_modeset_acquire_ctx ctx; struct drm_crtc *crtc; - int i, j, rc = 0; - int start; + u16 *r, *g, *b; + int i, ret; if (oops_in_progress) return -EBUSY; - drm_modeset_lock_all(dev); + if (cmap->start + cmap->len < cmap->start) + return -EINVAL; + + drm_modeset_acquire_init(&ctx, 0); +retry: + ret = drm_modeset_lock_all_ctx(dev, &ctx); + if (ret) + goto out; if (!drm_fb_helper_is_bound(fb_helper)) { - drm_modeset_unlock_all(dev); - return -EBUSY; + ret = -EBUSY; + goto out; } for (i = 0; i < fb_helper->crtc_count; i++) { crtc = fb_helper->crtc_info[i].mode_set.crtc; - crtc_funcs = crtc->helper_private; - - red = cmap->red; - green = cmap->green; - blue = cmap->blue; - transp = cmap->transp; - start = cmap->start; + if (!crtc->funcs->gamma_set || !crtc->gamma_size) { + ret = -EINVAL; + goto out; + } - for (j = 0; j < cmap->len; j++) { - u16 hred, hgreen, hblue, htransp = 0xffff; + if (cmap->start + cmap->len > crtc->gamma_size) { + ret = -EINVAL; + goto out; + } - hred = *red++; - hgreen = *green++; - hblue = *blue++; + r = crtc->gamma_store; + g = r + crtc->gamma_size; + b = g + crtc->gamma_size; - if (transp) - htransp = *transp++; + memcpy(r + cmap->start, cmap->red, cmap->len * sizeof(u16)); + memcpy(g + cmap->start, cmap->green, cmap->len * sizeof(u16)); + memcpy(b + cmap->start, cmap->blue, cmap->len * sizeof(u16)); - rc = setcolreg(crtc, hred, hgreen, hblue, start++, info); - if (rc) - goto out; - } - if (crtc_funcs->load_lut) - crtc_funcs->load_lut(crtc); + ret = crtc->funcs->gamma_set(crtc, r, g, b, + crtc->gamma_size, &ctx); + if (ret) + break; } - out: - drm_modeset_unlock_all(dev); - return rc; +out: + if (ret == -EDEADLK) { + drm_modeset_backoff(&ctx); + goto retry; + } + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); + + return ret; } EXPORT_SYMBOL(drm_fb_helper_setcmap);