From patchwork Tue Apr 26 16:41:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 12827473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8698C433EF for ; Tue, 26 Apr 2022 16:42:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3C5710E878; Tue, 26 Apr 2022 16:42:21 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 290F810E878 for ; Tue, 26 Apr 2022 16:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650991338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/is8L+BY/GI0YdSreLst/xa/jyOypJy9RQk8s12xcwo=; b=VC1R2QJhKDlu+qvt5oOJTarsDluRsVnBppi2SJc1T10DKbMh0BPQgQ3wpo2UAFRPC+tyox 2uKyDBCuiYzS+vvUC/awjDadHsZaeggN6xuhOMkMdiCaPGHjMvy6genyea8LQU8M+GnJwe 5aJbyiRcd5JulW+uM3c97umrB9IXBNk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-532-kfEIgAlINGWfjquTDapg3g-1; Tue, 26 Apr 2022 12:42:15 -0400 X-MC-Unique: kfEIgAlINGWfjquTDapg3g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D80A98038E3; Tue, 26 Apr 2022 16:42:14 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3D6F2024CB8; Tue, 26 Apr 2022 16:42:13 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/4] mgag200: Add FB_DAMAGE_CLIPS support Date: Tue, 26 Apr 2022 18:41:05 +0200 Message-Id: <20220426164108.1051295-2-jfalempe@redhat.com> In-Reply-To: <20220426164108.1051295-1-jfalempe@redhat.com> References: <20220426164108.1051295-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jfalempe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , michel@daenzer.net, tzimmermann@suse.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver does support damage clips, but doesn't advertise it. So when running gnome/wayland on Matrox hardware, the full frame is copied to the slow Matrox memory, which leads to very poor performances. Add drm_plane_enable_fb_damage_clips() to advertise this capability to userspace. With this patch, gnome/wayland becomes usable on Matrox GPU. Suggested-by: Jonas Ã…dahl Signed-off-by: Jocelyn Falempe Reviewed-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 6e18d3bbd720..cff2e76f3fa0 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1107,6 +1107,8 @@ int mgag200_modeset_init(struct mga_device *mdev) return ret; } + drm_plane_enable_fb_damage_clips(&pipe->plane); + /* FIXME: legacy gamma tables; convert to CRTC state */ drm_mode_crtc_set_gamma_size(&pipe->crtc, MGAG200_LUT_SIZE); From patchwork Tue Apr 26 16:41:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 12827474 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3ACC0C433EF for ; Tue, 26 Apr 2022 16:42:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0115510E852; Tue, 26 Apr 2022 16:42:28 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1472310E886 for ; Tue, 26 Apr 2022 16:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650991343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v9BqO4POWstSXykyf4gys0Z7Am3Pl+SO8bjE0/l1pYQ=; b=NXzZ61pFdLI5apK9a/rzj6qt8HtHAUSCPoA8tuw+M8zu2NIzYwW4ZibwOMxREVQ5cY2Ych 63DPVeA8yezwcLXYyMET16QHTBVA01IerJUw5EqA+zj49VUYdG4oPMbtIRg2DqypyqQ8v0 uHQA5bqaSPu+CYrttpnd5hw/MmDg6Rs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-15iwRL8WPFSQpEesmOw6wg-1; Tue, 26 Apr 2022 12:42:19 -0400 X-MC-Unique: 15iwRL8WPFSQpEesmOw6wg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90901811E78; Tue, 26 Apr 2022 16:42:18 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FCB22024CB8; Tue, 26 Apr 2022 16:42:15 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] mgag200: Optimize damage clips Date: Tue, 26 Apr 2022 18:41:06 +0200 Message-Id: <20220426164108.1051295-3-jfalempe@redhat.com> In-Reply-To: <20220426164108.1051295-1-jfalempe@redhat.com> References: <20220426164108.1051295-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jfalempe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , michel@daenzer.net, tzimmermann@suse.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" when there are multiple damage clips, previous code merged them into one big rectangle. As the Matrox memory is very slow, it's faster to copy each damage clip. Signed-off-by: Jocelyn Falempe Reviewed-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_mode.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index cff2e76f3fa0..2bc380a85996 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -855,10 +855,6 @@ mgag200_handle_damage(struct mga_device *mdev, struct drm_framebuffer *fb, dst += drm_fb_clip_offset(fb->pitches[0], fb->format, clip); drm_fb_memcpy_toio(dst, fb->pitches[0], vmap, fb, clip); - - /* Always scanout image at VRAM offset 0 */ - mgag200_set_startadd(mdev, (u32)0); - mgag200_set_offset(mdev, fb); } static void @@ -904,6 +900,9 @@ mgag200_simple_display_pipe_enable(struct drm_simple_display_pipe *pipe, mgag200_enable_display(mdev); mgag200_handle_damage(mdev, fb, &fullscreen, &shadow_plane_state->data[0]); + /* Always scanout image at VRAM offset 0 */ + mgag200_set_startadd(mdev, (u32)0); + mgag200_set_offset(mdev, fb); } static void @@ -959,12 +958,18 @@ mgag200_simple_display_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state); struct drm_framebuffer *fb = state->fb; struct drm_rect damage; + struct drm_atomic_helper_damage_iter iter; if (!fb) return; - if (drm_atomic_helper_damage_merged(old_state, state, &damage)) + drm_atomic_helper_damage_iter_init(&iter, old_state, state); + drm_atomic_for_each_plane_damage(&iter, &damage) { mgag200_handle_damage(mdev, fb, &damage, &shadow_plane_state->data[0]); + } + /* Always scanout image at VRAM offset 0 */ + mgag200_set_startadd(mdev, (u32)0); + mgag200_set_offset(mdev, fb); } static struct drm_crtc_state * From patchwork Tue Apr 26 16:41:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 12827475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17D82C4332F for ; Tue, 26 Apr 2022 16:42:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FC5110E886; Tue, 26 Apr 2022 16:42:28 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 56DFF10E88C for ; Tue, 26 Apr 2022 16:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650991343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9oGD1aVOxPfwlxyUj/4d02qUR9rbo+0pTblnupMLJM0=; b=aMqWnuNrosx3FnIX/QCMDhOpZxXwF5/FgyLPVFNyJpZS5So7cRBHAvC9e1ZOizDbE8xwre U7cyY6okWjOxND9R89Acp7dFRp/u6VKgBUCuspuBOxceXaCuv0XxACEEmVHq3WMF1v70IN MGu5rRbGVEDKsU0Qkf3Dm98BBQ1V+7o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-228-a1BwDHxAOomZEpu0CiXdBg-1; Tue, 26 Apr 2022 12:42:20 -0400 X-MC-Unique: a1BwDHxAOomZEpu0CiXdBg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF8AF800B28; Tue, 26 Apr 2022 16:42:19 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB5502024CB8; Tue, 26 Apr 2022 16:42:18 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] mgag200: remove unused flag Date: Tue, 26 Apr 2022 18:41:07 +0200 Message-Id: <20220426164108.1051295-4-jfalempe@redhat.com> In-Reply-To: <20220426164108.1051295-1-jfalempe@redhat.com> References: <20220426164108.1051295-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jfalempe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , michel@daenzer.net, tzimmermann@suse.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The flag MGAG200_FLAG_HW_BUG_NO_STARTADD is no more used, because the framebuffer is now always at offset 0. Signed-off-by: Jocelyn Falempe --- drivers/gpu/drm/mgag200/mgag200_drv.c | 3 +-- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 217844d71ab5..8659e1ca8009 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -306,8 +306,7 @@ mgag200_device_create(struct pci_dev *pdev, enum mga_type type, unsigned long fl static const struct pci_device_id mgag200_pciidlist[] = { { PCI_VENDOR_ID_MATROX, 0x520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_PCI }, { PCI_VENDOR_ID_MATROX, 0x521, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_AGP }, - { PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - G200_SE_A | MGAG200_FLAG_HW_BUG_NO_STARTADD}, + { PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A }, { PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B }, { PCI_VENDOR_ID_MATROX, 0x530, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EV }, { PCI_VENDOR_ID_MATROX, 0x532, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_WB }, diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index 4368112023f7..c7b6dc771ab3 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -201,9 +201,6 @@ enum mga_type { G200_EW3, }; -/* HW does not handle 'startadd' field correct. */ -#define MGAG200_FLAG_HW_BUG_NO_STARTADD (1ul << 8) - #define MGAG200_TYPE_MASK (0x000000ff) #define MGAG200_FLAG_MASK (0x00ffff00) From patchwork Tue Apr 26 16:41:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 12827476 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 244DCC433EF for ; Tue, 26 Apr 2022 16:42:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62F6510E89C; Tue, 26 Apr 2022 16:42:36 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id B7B8410E88C for ; Tue, 26 Apr 2022 16:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650991347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W/+N+QQ461ib+TvPRqG8FBgRVnzHvofaeIKEDBoj86U=; b=Zz/AmE8oZeDORv4oxVwOPCzQqB/RoF+xvFzI3Bc9gYeBNjra3DH3lWR391rIbWp+8opMG2 ceeaW9ImyWUls0fCSQsesz5p6UyL49C/CFJ0hyXdTM7JnmM1NtmIv/q61cTv40fYHWCeao vBmxyr1e6xJZv2lZQhpUA1gRs/w0VOY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-0fFTS3_ZOYuURlS0evKuvg-1; Tue, 26 Apr 2022 12:42:24 -0400 X-MC-Unique: 0fFTS3_ZOYuURlS0evKuvg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2CDA83C01D9B; Tue, 26 Apr 2022 16:42:24 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 169982024CB8; Tue, 26 Apr 2022 16:42:19 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] mgag200: remove mgag200_probe_vram() Date: Tue, 26 Apr 2022 18:41:08 +0200 Message-Id: <20220426164108.1051295-5-jfalempe@redhat.com> In-Reply-To: <20220426164108.1051295-1-jfalempe@redhat.com> References: <20220426164108.1051295-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jfalempe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , michel@daenzer.net, tzimmermann@suse.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function writes some pattern to video memory, to check for conflict. In case of conflicts, it returns a random memory capacity (offset of the conflict). Using devm_arch_io_reserve_memtype_wc() should garantee that no other driver is using this memory region. In case of real memory conflicts, as it is video memory, the user will notice it easily. So there is no need for this function. Signed-off-by: Jocelyn Falempe --- drivers/gpu/drm/mgag200/mgag200_mm.c | 50 ++++------------------------ 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index fa996d46feed..68299b560a98 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -32,48 +32,6 @@ #include "mgag200_drv.h" -static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, - size_t size) -{ - int offset; - int orig; - int test1, test2; - int orig1, orig2; - size_t vram_size; - - /* Probe */ - orig = ioread16(mem); - iowrite16(0, mem); - - vram_size = size; - - if ((mdev->type == G200_EW3) && (vram_size >= 0x1000000)) - vram_size = vram_size - 0x400000; - - for (offset = 0x100000; offset < vram_size; offset += 0x4000) { - orig1 = ioread8(mem + offset); - orig2 = ioread8(mem + offset + 0x100); - - iowrite16(0xaa55, mem + offset); - iowrite16(0xaa55, mem + offset + 0x100); - - test1 = ioread16(mem + offset); - test2 = ioread16(mem); - - iowrite16(orig1, mem + offset); - iowrite16(orig2, mem + offset + 0x100); - - if (test1 != 0xaa55) - break; - - if (test2) - break; - } - - iowrite16(orig, mem); - - return offset - 65536; -} int mgag200_mm_init(struct mga_device *mdev) { @@ -81,6 +39,7 @@ int mgag200_mm_init(struct mga_device *mdev) struct pci_dev *pdev = to_pci_dev(dev->dev); u8 misc; resource_size_t start, len; + size_t vram_size; WREG_ECRT(0x04, 0x00); @@ -106,7 +65,12 @@ int mgag200_mm_init(struct mga_device *mdev) if (!mdev->vram) return -ENOMEM; - mdev->mc.vram_size = mgag200_probe_vram(mdev, mdev->vram, len); + vram_size = len; + /* G200_EW3 has only 12MB of memory */ + if ((mdev->type == G200_EW3) && (vram_size >= 0x1000000)) + vram_size -= 0x400000; + + mdev->mc.vram_size = vram_size; mdev->mc.vram_base = start; mdev->mc.vram_window = len;