dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frediano Ziglio <fziglio@redhat.com>
To: David Airlie <airlied@linux.ie>
Cc: spice-devel@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	Frediano Ziglio <fziglio@redhat.com>
Subject: [PATCH 1/2] Change the way slot is detected
Date: Mon, 12 Oct 2015 14:02:31 +0100	[thread overview]
Message-ID: <1444654952-7248-2-git-send-email-fziglio@redhat.com> (raw)
In-Reply-To: <1444654952-7248-1-git-send-email-fziglio@redhat.com>

Instead of relaying on surface type use the actual placement.
This allow to have different placement for a single type of
surface.
---
 qxl/qxl_cmd.c | 2 +-
 qxl/qxl_drv.h | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/qxl/qxl_cmd.c b/qxl/qxl_cmd.c
index fdc1833..3a1b055 100644
--- a/qxl/qxl_cmd.c
+++ b/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/qxl/qxl_drv.h b/qxl/qxl_drv.h
index 01a8694..60f0062 100644
--- a/qxl/qxl_drv.h
+++ b/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 */
-- 
2.4.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-10-12 13:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 13:02 [RFC PATCH 0/2] Try to smartly allocate memory on the two BARs Frediano Ziglio
2015-10-12 13:02 ` Frediano Ziglio [this message]
2015-10-16  1:32   ` [PATCH 1/2] Change the way slot is detected Dave Airlie
2015-10-12 13:02 ` [PATCH 2/2] Allocate objects in both video rams Frediano Ziglio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444654952-7248-2-git-send-email-fziglio@redhat.com \
    --to=fziglio@redhat.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=spice-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox