Received: by 10.213.65.68 with SMTP id h4csp435256imn; Tue, 13 Mar 2018 08:59:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELuNxv08dpQCALdXOuHIh4jiLhPrUlOB0I0XuzB+k9OGS1eP1tP/ea4QqShNPq9m9PHkVj9L X-Received: by 2002:a17:902:7088:: with SMTP id z8-v6mr1028767plk.174.1520956768348; Tue, 13 Mar 2018 08:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956768; cv=none; d=google.com; s=arc-20160816; b=j7VG+DcJoBhzGgCkk4DAh6jAOV7HShMpRZZdu1NQ8f2DoVTURAn8Yrr3jhQBN2hUNm 4V9rzbUQiDig78M5d8bk8bfRUQjYDS9IXYeB5ftbWbsrzAI/jK4Q+jXqufm5Bh0PGWUK vpdyCIb4u1f/9AEsvUG23/hRHT7eL9PmZgUU7M24l0mPq6b9y7UAbHXlmPp4UlEHHw9T JY77Gg+z+js3t8dnHnTeAzJJvKX3f6LK8snG7/WnkxsE09ntBdK9U6yHlOHO6kYkqo1t 8iN1Z8Yf1BuceKXbftHkIz68HnHagejkeBqoZRRRLUYn26NYKAYQC5AuNN/gzaRu4HSt a9OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fCIfpkg/cVmH7goAZ/mB+fnoDHFZuoP16hwXPghZ1ME=; b=ftdHW5XtDo0i1iNjn4g82ynqS6EgSgTf0cGKZ8mvIbZAh1YpCalRyKBelcjfqSGHac R3PAXAXxdEnUfXDtXmJfPXX+2Vg39s592kQ6QiEweBg4OEagixP32tk9ll+2ffSmm5QA yQtSoZM2CBXM99PIaC/GTzainBQeV5Xu2lRE4M/zoBRoC8iDOjTEMHqZo6EVgzvW2+3I THEc28/JzoTRDvcvbRBVdMWpIllKJE5nYhdjSdNBiTSV7jHUlqy4K1BYcEq6a0nlGCZx ixJodl2nbalrHHrgWAeEYBVbGAHwFC+h6yi276Xdbz18ofyVPD4rEq/8duVdwbK6+DJC cgFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si294453plo.567.2018.03.13.08.59.13; Tue, 13 Mar 2018 08:59:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934529AbeCMPiM (ORCPT + 99 others); Tue, 13 Mar 2018 11:38:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34216 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934516AbeCMPiG (ORCPT ); Tue, 13 Mar 2018 11:38:06 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B22BA1260; Tue, 13 Mar 2018 15:38:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilia Mirkin , Ben Skeggs , Daniel Vetter Subject: [PATCH 4.14 066/140] drm/nouveau: prefer XBGR2101010 for addfb ioctl Date: Tue, 13 Mar 2018 16:24:29 +0100 Message-Id: <20180313152502.645542034@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilia Mirkin commit c20bb155c2c5acb775f68be5d84fe679687c3c1e upstream. Nouveau only exposes support for XBGR2101010. Prior to the atomic conversion, drm would pass in the wrong format in the framebuffer, but it was always ignored -- both userspace (xf86-video-nouveau) and the kernel driver agreed on the layout, so the fact that the format was wrong didn't matter. With the atomic conversion, nouveau all of a sudden started caring about the exact format, and so the previously-working code in xf86-video-nouveau no longer functioned since the (internally-assigned) format from the addfb ioctl was wrong. This change adds infrastructure to allow a drm driver to specify that it prefers the XBGR format variant for the addfb ioctl, and makes nouveau's nv50 display driver set it. (Prior gens had no support for 30bpp at all.) Signed-off-by: Ilia Mirkin Cc: stable@vger.kernel.org # v4.10+ Acked-by: Ben Skeggs Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180203191123.31507-1-imirkin@alum.mit.edu Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_framebuffer.c | 4 ++++ drivers/gpu/drm/nouveau/nv50_display.c | 1 + include/drm/drm_drv.h | 1 + 3 files changed, 6 insertions(+) --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -118,6 +118,10 @@ int drm_mode_addfb(struct drm_device *de r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth); r.handles[0] = or->handle; + if (r.pixel_format == DRM_FORMAT_XRGB2101010 && + dev->driver->driver_features & DRIVER_PREFER_XBGR_30BPP) + r.pixel_format = DRM_FORMAT_XBGR2101010; + ret = drm_mode_addfb2(dev, &r, file_priv); if (ret) return ret; --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -4426,6 +4426,7 @@ nv50_display_create(struct drm_device *d nouveau_display(dev)->fini = nv50_display_fini; disp->disp = &nouveau_display(dev)->disp; dev->mode_config.funcs = &nv50_disp_func; + dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP; if (nouveau_atomic) dev->driver->driver_features |= DRIVER_ATOMIC; --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -55,6 +55,7 @@ struct drm_mode_create_dumb; #define DRIVER_ATOMIC 0x10000 #define DRIVER_KMS_LEGACY_CONTEXT 0x20000 #define DRIVER_SYNCOBJ 0x40000 +#define DRIVER_PREFER_XBGR_30BPP 0x80000 /** * struct drm_driver - DRM driver structure