From patchwork Thu Jun 27 12:23:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 11019603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 344F11575 for ; Thu, 27 Jun 2019 12:24:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26C8D28B1E for ; Thu, 27 Jun 2019 12:24:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AF5228B1B; Thu, 27 Jun 2019 12:24:14 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 B404628B20 for ; Thu, 27 Jun 2019 12:24:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B15346E1A4; Thu, 27 Jun 2019 12:24:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBAAF6E186 for ; Thu, 27 Jun 2019 12:23:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89FB3308793B; Thu, 27 Jun 2019 12:23:59 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAC531001B0E; Thu, 27 Jun 2019 12:23:54 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 05CF116E1A; Thu, 27 Jun 2019 14:23:49 +0200 (CEST) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/5] drm/bochs: pass framebuffer to bochs_hw_setbase Date: Thu, 27 Jun 2019 14:23:45 +0200 Message-Id: <20190627122348.5833-3-kraxel@redhat.com> In-Reply-To: <20190627122348.5833-1-kraxel@redhat.com> References: <20190627122348.5833-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 27 Jun 2019 12:23:59 +0000 (UTC) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tzimmermann@suse.de, David Airlie , open list , "open list:DRM DRIVER FOR BOCHS VIRTUAL GPU" , Gerd Hoffmann MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Also rename to bochs_hw_setfb, we have to set more than just the base address. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/bochs/bochs.h | 5 +++-- drivers/gpu/drm/bochs/bochs_hw.c | 10 +++++----- drivers/gpu/drm/bochs/bochs_kms.c | 10 +++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h index cc35d492142c..246f05f4a711 100644 --- a/drivers/gpu/drm/bochs/bochs.h +++ b/drivers/gpu/drm/bochs/bochs.h @@ -85,8 +85,9 @@ void bochs_hw_setmode(struct bochs_device *bochs, struct drm_display_mode *mode); void bochs_hw_setformat(struct bochs_device *bochs, const struct drm_format_info *format); -void bochs_hw_setbase(struct bochs_device *bochs, - int x, int y, u64 addr); +void bochs_hw_setfb(struct bochs_device *bochs, + struct drm_framebuffer *fb, + int x, int y); int bochs_hw_load_edid(struct bochs_device *bochs); /* bochs_mm.c */ diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c index 791ab2f79947..67101c85029c 100644 --- a/drivers/gpu/drm/bochs/bochs_hw.c +++ b/drivers/gpu/drm/bochs/bochs_hw.c @@ -254,17 +254,17 @@ void bochs_hw_setformat(struct bochs_device *bochs, }; } -void bochs_hw_setbase(struct bochs_device *bochs, - int x, int y, u64 addr) +void bochs_hw_setfb(struct bochs_device *bochs, + struct drm_framebuffer *fb, + int x, int y) { - unsigned long offset = (unsigned long)addr + + struct drm_gem_vram_object *bo = drm_gem_vram_of_gem(fb->obj[0]); + unsigned long offset = bo->bo.offset + y * bochs->stride + x * (bochs->bpp / 8); int vy = offset / bochs->stride; int vx = (offset % bochs->stride) * 8 / bochs->bpp; - DRM_DEBUG_DRIVER("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n", - x, y, addr, offset, vx, vy); bochs_dispi_write(bochs, VBE_DISPI_INDEX_X_OFFSET, vx); bochs_dispi_write(bochs, VBE_DISPI_INDEX_Y_OFFSET, vy); } diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 5904eddc83a5..ddbf0802138d 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c @@ -27,16 +27,12 @@ static const uint32_t bochs_formats[] = { static void bochs_plane_update(struct bochs_device *bochs, struct drm_plane_state *state) { - struct drm_gem_vram_object *gbo; - if (!state->fb || !bochs->stride) return; - gbo = drm_gem_vram_of_gem(state->fb->obj[0]); - bochs_hw_setbase(bochs, - state->crtc_x, - state->crtc_y, - gbo->bo.offset); + bochs_hw_setfb(bochs, state->fb, + state->crtc_x, + state->crtc_y); bochs_hw_setformat(bochs, state->fb->format); }