From patchwork Tue Jan 21 02:37:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 3515111 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 58A729F1C3 for ; Tue, 21 Jan 2014 02:38:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 776382013D for ; Tue, 21 Jan 2014 02:38:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9888320125 for ; Tue, 21 Jan 2014 02:38:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FE41FA9B6; Mon, 20 Jan 2014 18:38:12 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 13BDFFA8AC for ; Mon, 20 Jan 2014 18:37:40 -0800 (PST) Received: by mail-lb0-f169.google.com with SMTP id q8so5579833lbi.28 for ; Mon, 20 Jan 2014 18:37:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=jg21BV5m6sFzlDFPR2CtPyTF4ZuAWF6V3B+g3gp362A=; b=j4ygyviy0pjBRtcc8XP1jPdqaKd/JjUIRcgi6DBUp+wITUQ/mlZr8FJ51Tvkpftw8X mJT07DIbQZb7jj4eY+XxRAcs0vFNg3GaugJE78SigMmIsd2ZpBQIvXK6wakFMpB3XocC HUypD93XABu/gbyfYP9Ow+LBXql4sm0ILBFbou3E0FFzBTnOuSod8uVkYqLdwQCq6MWj EslYutGkN06ylrqZF5VRC6tBwuwTcQ2qKdYfKxx/iGVhOyUme58RY715/stiYllxLA6P bNT2SYWmOHESCFObE/hFXCkj9Cf0oFxCUmKP/S95O8ScgMF46g2zD0nXUumtJd4V9PGE drRg== X-Received: by 10.152.2.5 with SMTP id 5mr14154406laq.21.1390271859982; Mon, 20 Jan 2014 18:37:39 -0800 (PST) Received: from patrik-minnow.lan (h138n8-oer-a32.ias.bredband.telia.com. [2.248.103.138]) by mx.google.com with ESMTPSA id h7sm2563481lbj.1.2014.01.20.18.37.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 18:37:39 -0800 (PST) From: Patrik Jakobsson To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/gma500: Add first piece of blitter code Date: Tue, 21 Jan 2014 03:37:16 +0100 Message-Id: <1390271840-16013-5-git-send-email-patrik.r.jakobsson@gmail.com> X-Mailer: git-send-email 1.8.3.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Right now, all we need to know about the blitter is that it's not doing anything that can be messed up when fiddling with MMU mappings. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/Makefile | 1 + drivers/gpu/drm/gma500/blitter.c | 47 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/gma500/blitter.h | 22 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 drivers/gpu/drm/gma500/blitter.c create mode 100644 drivers/gpu/drm/gma500/blitter.h diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile index e9064dd..69c0d7f 100644 --- a/drivers/gpu/drm/gma500/Makefile +++ b/drivers/gpu/drm/gma500/Makefile @@ -13,6 +13,7 @@ gma500_gfx-y += \ intel_i2c.o \ intel_gmbus.o \ mmu.o \ + blitter.o \ power.o \ psb_drv.o \ gma_display.o \ diff --git a/drivers/gpu/drm/gma500/blitter.c b/drivers/gpu/drm/gma500/blitter.c new file mode 100644 index 0000000..7d72587 --- /dev/null +++ b/drivers/gpu/drm/gma500/blitter.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014, Patrik Jakobsson + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * Authors: Patrik Jakobsson + */ + +#include "psb_drv.h" + +#include "blitter.h" +#include "psb_reg.h" + +/* Wait for the blitter to be completely idle */ +int gma_blt_wait_idle(struct drm_psb_private *dev_priv) +{ + unsigned long stop = jiffies + HZ; + int busy = 1; + + /* First do a quick check */ + if ((PSB_RSGX32(PSB_CR_2D_SOCIF) == _PSB_C2_SOCIF_EMPTY) && + ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & _PSB_C2B_STATUS_BUSY) == 0)) + return 0; + + do { + busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); + } while (busy && !time_after_eq(jiffies, stop)); + + if (busy) + return -EBUSY; + + do { + busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & + _PSB_C2B_STATUS_BUSY) != 0); + } while (busy && !time_after_eq(jiffies, stop)); + + /* If still busy, we probably have a hang */ + return (busy) ? -EBUSY : 0; +} diff --git a/drivers/gpu/drm/gma500/blitter.h b/drivers/gpu/drm/gma500/blitter.h new file mode 100644 index 0000000..b83648d --- /dev/null +++ b/drivers/gpu/drm/gma500/blitter.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2014, Patrik Jakobsson + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * Authors: Patrik Jakobsson + */ + +#ifndef __BLITTER_H +#define __BLITTER_H + +extern int gma_blt_wait_idle(struct drm_psb_private *dev_priv); + +#endif