From patchwork Thu Apr 2 15:29:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 6149451 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F1B9F9F1BE for ; Thu, 2 Apr 2015 15:31:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BF89203AF for ; Thu, 2 Apr 2015 15:31:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B7253203AB for ; Thu, 2 Apr 2015 15:31:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3AB06EABB; Thu, 2 Apr 2015 08:31:04 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 751306EA49 for ; Thu, 2 Apr 2015 08:30:56 -0700 (PDT) Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Ydh55-0005OD-N5; Thu, 02 Apr 2015 17:30:55 +0200 From: Lucas Stach To: dri-devel@lists.freedesktop.org Subject: [PATCH RFC 012/111] staging: etnaviv: fix buffer dumping code Date: Thu, 2 Apr 2015 17:29:14 +0200 Message-Id: <1427988653-754-13-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> References: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org Cc: Russell King , kernel@pengutronix.de 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King The buffer dumping code tries to dereference obj->gpu. However, for submitted command buffers, obj->gpu is only set after the buffer has been submitted to the GPU. Explicitly pass in the etnaviv_gpu struct. Signed-off-by: Russell King --- drivers/staging/etnaviv/etnaviv_buffer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_buffer.c b/drivers/staging/etnaviv/etnaviv_buffer.c index 32764e15c5f7..6afb9c702628 100644 --- a/drivers/staging/etnaviv/etnaviv_buffer.c +++ b/drivers/staging/etnaviv/etnaviv_buffer.c @@ -115,12 +115,13 @@ static void etnaviv_cmd_select_pipe(struct etnaviv_gem_object *buffer, u8 pipe) CMD_LOAD_STATE(buffer, VIVS_GL_PIPE_SELECT, VIVS_GL_PIPE_SELECT_PIPE(pipe)); } -static void etnaviv_buffer_dump(struct etnaviv_gem_object *obj, u32 len) +static void etnaviv_buffer_dump(struct etnaviv_gpu *gpu, + struct etnaviv_gem_object *obj, u32 len) { u32 size = obj->base.size; u32 *ptr = obj->vaddr; - dev_dbg(obj->gpu->dev->dev, "virt %p phys 0x%08x free 0x%08x\n", + dev_info(gpu->dev->dev, "virt %p phys 0x%08x free 0x%08x\n", obj->vaddr, obj->paddr, size - len * 4); print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4, @@ -150,7 +151,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et u32 back; u32 i; - etnaviv_buffer_dump(buffer, 0x50); + etnaviv_buffer_dump(gpu, buffer, 0x50); /* save offset back into main buffer */ back = buffer->offset; @@ -180,7 +181,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et /* TODO: remove later */ if (unlikely(drm_debug & DRM_UT_CORE)) - etnaviv_buffer_dump(obj, obj->offset); + etnaviv_buffer_dump(gpu, obj, submit->cmd[i].size); } /* change ll to NOP */ @@ -197,5 +198,5 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et *(lw)= i; mb(); - etnaviv_buffer_dump(buffer, 0x50); + etnaviv_buffer_dump(gpu, buffer, 0x50); }