From patchwork Tue Oct 11 23:15:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9371849 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 0D9886048F for ; Tue, 11 Oct 2016 23:15:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E752028DFE for ; Tue, 11 Oct 2016 23:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D90AB28EA4; Tue, 11 Oct 2016 23:15:38 +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=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 E3CDA28DFE for ; Tue, 11 Oct 2016 23:15:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62CEC6E77F; Tue, 11 Oct 2016 23:15:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kmu-office.ch (mail.kmu-office.ch [178.209.48.109]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFE4C6E77F for ; Tue, 11 Oct 2016 23:15:31 +0000 (UTC) Received: from trochilidae.agner.local (223.42.150.83.ftth.as8758.net [83.150.42.223]) by mail.kmu-office.ch (Postfix) with ESMTPSA id B00155C1DE2; Wed, 12 Oct 2016 01:09:21 +0200 (CEST) From: Stefan Agner To: dri-devel@lists.freedesktop.org, airlied@linux.ie Subject: [RFC] drm/fb-helper: reject any changes to the fbdev Date: Tue, 11 Oct 2016 16:15:04 -0700 Message-Id: <20161011231504.17688-1-stefan@agner.ch> X-Mailer: git-send-email 2.10.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1476227363; bh=SZ4dRl3OuWWlPPC3nOeY0oAfkDq2k8vXyr55Sw2pHU4=; h=From:To:Cc:Subject:Date:Message-Id; b=uLBBo0kApvCZIb32yB2b5Dh8jC9AGA2SyQatTMjIuwJx9xQ4IclFlhn/5N9udG828jQFLVu7bDLUp5grdEcMR0qcmT6Zaf/ERmWDn9cawdb9gEte53UYIry+uWlbg+ESY+Lpgk8oDR3SfeuJl3AdMM2Su3n2ILl1O0L2Izv0i8U= Cc: daniel.vetter@intel.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-Virus-Scanned: ClamAV using ClamSMTP The current fbdev emulation does not allow to push back changes in width, height or depth to KMS, hence reject any changes with an error. This makes sure that fbdev ioctl's fail properly and user space does not assume that changes succeeded. Signed-off-by: Stefan Agner Reviewed-by: Tomi Valkeinen --- This rejects reconfiguration of framebuffer like fbset -rgba 5,6,5 -depth 16 (when in 24 bit mode by default) fbset -xres 123 I think all users of drm_fb_helper_check_var use also the generic drm_fb_helper_set_par (or do otherwise not support changing size/ depth). Hence, afaict, the change should be the right thing to do for all driver... drivers/gpu/drm/drm_fb_helper.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 03414bd..596c056 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1211,11 +1211,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, if (var->pixclock != 0 || in_dbg_master()) return -EINVAL; - /* Need to resize the fb object !!! */ - if (var->bits_per_pixel > fb->bits_per_pixel || - var->xres > fb->width || var->yres > fb->height || - var->xres_virtual > fb->width || var->yres_virtual > fb->height) { - DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " + /* + * Changes struct fb_var_screeninfo are currently not pushed back + * to KMS, hence fail if different settings are requested. + */ + if (var->bits_per_pixel != fb->bits_per_pixel || + var->xres != fb->width || var->yres != fb->height || + var->xres_virtual != fb->width || var->yres_virtual != fb->height) { + DRM_DEBUG("fb userspace requested width/height/bpp different than current fb " "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, var->xres_virtual, var->yres_virtual,