diff mbox

[1/2] Change the way slot is detected

Message ID 1444654952-7248-2-git-send-email-fziglio@redhat.com (mailing list archive)
State Rejected
Headers show

Commit Message

Frediano Ziglio Oct. 12, 2015, 1:02 p.m. UTC
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(-)

Comments

Dave Airlie Oct. 16, 2015, 1:32 a.m. UTC | #1
On 12 October 2015 at 23:02, Frediano Ziglio <fziglio@redhat.com> wrote:
> Instead of relaying on surface type use the actual placement.
> This allow to have different placement for a single type of
> surface.

These two look fine, just 2 things,

a) missing Signed-off-by
b) no prefix - please prefix qxl kernel patches with drm/qxl.

Dave.

> ---
>  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
diff mbox

Patch

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 */