From patchwork Mon Oct 19 13:21:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 7436571 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 6F8579F302 for ; Mon, 19 Oct 2015 13:22:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6DC520619 for ; Mon, 19 Oct 2015 13:22:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8833220739 for ; Mon, 19 Oct 2015 13:22:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9129720F7; Mon, 19 Oct 2015 06:22:03 -0700 (PDT) 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 E72D9720F7; Mon, 19 Oct 2015 06:22:02 -0700 (PDT) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 95D96A85; Mon, 19 Oct 2015 13:22:02 +0000 (UTC) Received: from rhwork.redhat.com (vpn1-7-155.ams2.redhat.com [10.36.7.155]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9JDLtp4027391; Mon, 19 Oct 2015 09:22:00 -0400 From: Frediano Ziglio To: David Airlie Subject: [PATCH 1/2] drm/qxl: change the way slot is detected Date: Mon, 19 Oct 2015 14:21:48 +0100 Message-Id: <1445260909-22541-2-git-send-email-fziglio@redhat.com> In-Reply-To: <1445260909-22541-1-git-send-email-fziglio@redhat.com> References: <1445260909-22541-1-git-send-email-fziglio@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Cc: spice-devel@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Frediano Ziglio 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, 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 Instead of relaying on surface type use the actual placement. This allow to have different placement for a single type of surface. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index fdc1833..3a1b055 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -511,7 +511,7 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, cmd->u.surface_create.height = surf->surf.height; cmd->u.surface_create.stride = surf->surf.stride; if (new_mem) { - int slot_id = surf->type == QXL_GEM_DOMAIN_VRAM ? qdev->main_mem_slot : qdev->surfaces_mem_slot; + int slot_id = qxl_bo_get_slot_id(qdev, surf); struct qxl_memslot *slot = &(qdev->mem_slots[slot_id]); /* TODO - need to hold one of the locks to read tbo.offset */ diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 01a8694..60f0062 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -365,11 +365,18 @@ qxl_fb_virtual_address(struct qxl_device *qdev, unsigned long physical) return 0; } +static inline int +qxl_bo_get_slot_id(struct qxl_device *qdev, struct qxl_bo *bo) +{ + return ((bo->tbo.cur_placement & TTM_PL_MASK_MEM) == TTM_PL_FLAG_VRAM) ? + qdev->main_mem_slot : qdev->surfaces_mem_slot; +} + static inline uint64_t qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo, unsigned long offset) { - int slot_id = bo->type == QXL_GEM_DOMAIN_VRAM ? qdev->main_mem_slot : qdev->surfaces_mem_slot; + int slot_id = qxl_bo_get_slot_id(qdev, bo); struct qxl_memslot *slot = &(qdev->mem_slots[slot_id]); /* TODO - need to hold one of the locks to read tbo.offset */