From patchwork Sat May 20 02:57:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 9738451 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 066B2602DC for ; Sat, 20 May 2017 02:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC80B2837E for ; Sat, 20 May 2017 02:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFC1C28565; Sat, 20 May 2017 02:58:05 +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 8D5262837E for ; Sat, 20 May 2017 02:58:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBFCB6E0A5; Sat, 20 May 2017 02:58:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 98A706E086; Sat, 20 May 2017 02:57:56 +0000 (UTC) Received: by mail-qk0-x241.google.com with SMTP id k74so12521066qke.2; Fri, 19 May 2017 19:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G1eBgBYG3lTfdGRGdB5yfuMCh8qIWp23cbJ4PTzNVFI=; b=L8CNyU3R3XsZVV99L1ozGiUA0DXT9EKNm0FzE0zXhW8Qpq+Ep0sliLz64MQZsjG0Dt zaUagVdxCJYTPe6lD5ZvyNEXUSrfzizsk+6S/f/Akv4I3LxuHsgIvVoC7+dVngeKpnBk 5E8q5DX3POXunFG7PXEgBjj6C9FAT0Ljr5f2zFUAW+mMu1ICQVCL9+LXHXWXE12NJR05 yA5b9gcIG1xJY2LvpoZ3xpUxeKdcgVTCSkZo5OxH0Y7prhrI9TOat2BQTZsv/v3MbqRM Ag1y34KbTDu3bx4Z4CdSynQ7INkx9g0A9zMfbcvlNm2Qqwlz+j20VWanqeuJtTJfIDew 4oMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=G1eBgBYG3lTfdGRGdB5yfuMCh8qIWp23cbJ4PTzNVFI=; b=IpSX1idyoRYwfpzv/nwR0Ij9mltZD32q5glOwQyYqbYKIl5z1KZso5kb6t7Kc2dRN2 IVXpANSmUTNnqmqRHzhGG7akTRyaroZVy4v3H065I8e1PDHQlXEjrpj9dAKEfMKwXume Pc6dFHW65Rx6aCOzjuqnG/DUbcBm0X9DcOOuT2QR1lqwVHvW4ZwVxk0PGJ2CFiQeAleb cxkRHYJs3dHQII8Kn1OluO5Gmnz36k/fucS4VmwE+cWC9Ym0lZIxEkwMl1SwizBLD/vx ze5UjIBpRtCHagzk/Zy8Hlszc1nWGA38vrxnyQSBkkMGiGadNZO3Zp7ZI36JKUiX1ZiB Xsiw== X-Gm-Message-State: AODbwcCEp4CCVIH88Wn4KK2FO4PmY+3kpRCXIzQ25Cdjc+7jy05aunzs iJMYYIngME1dAQ== X-Received: by 10.55.122.133 with SMTP id v127mr11044377qkc.106.1495249075715; Fri, 19 May 2017 19:57:55 -0700 (PDT) Received: from athos.fios-router.home (pool-72-80-62-166.nycmny.fios.verizon.net. [72.80.62.166]) by smtp.gmail.com with ESMTPSA id t5sm421095qkd.4.2017.05.19.19.57.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 May 2017 19:57:55 -0700 (PDT) From: Ilia Mirkin To: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [RFC PATCH 3/3] drm/nouveau/dispnv04: fix exposed format list Date: Fri, 19 May 2017 22:57:49 -0400 Message-Id: <20170520025749.9291-4-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170520025749.9291-1-imirkin@alum.mit.edu> References: <20170520025749.9291-1-imirkin@alum.mit.edu> 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 drm_crtc_init exposes the XRGB8888 and ARGB8888 formats. In actuality, ARGB8888's 32-bit depth messes up some formulas that weren't meant for it, and the alpha is failry meaningless for the primary plane. The modesetting logic appears to be fully prepared for RGB565 as well as XRGB1555 however, as tested with modetest. Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 4b4b0b496262..c078811b4e11 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -1099,6 +1099,38 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { .disable = nv_crtc_disable, }; +static const uint32_t modeset_formats[] = { + DRM_FORMAT_XRGB8888, + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB1555, +}; + +static struct drm_plane * +create_primary_plane(struct drm_device *dev) +{ + struct drm_plane *primary; + int ret; + + primary = kzalloc(sizeof(*primary), GFP_KERNEL); + if (primary == NULL) { + DRM_DEBUG_KMS("Failed to allocate primary plane\n"); + return NULL; + } + + /* possible_crtc's will be filled in later by crtc_init */ + ret = drm_universal_plane_init(dev, primary, 0, + &drm_primary_helper_funcs, + modeset_formats, + ARRAY_SIZE(modeset_formats), + DRM_PLANE_TYPE_PRIMARY, NULL); + if (ret) { + kfree(primary); + primary = NULL; + } + + return primary; +} + int nv04_crtc_create(struct drm_device *dev, int crtc_num) { @@ -1122,7 +1154,9 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num) nv_crtc->save = nv_crtc_save; nv_crtc->restore = nv_crtc_restore; - drm_crtc_init(dev, &nv_crtc->base, &nv04_crtc_funcs); + drm_crtc_init_with_planes(dev, &nv_crtc->base, + create_primary_plane(dev), NULL, + &nv04_crtc_funcs, NULL); drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs); drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);