Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2 Clarify ttm state transitions tt_unpop...
details: https://anonhg.NetBSD.org/src/rev/1075aed63081
branches: trunk
changeset: 351993:1075aed63081
user: maya <maya%NetBSD.org@localhost>
date: Thu Mar 09 08:27:18 2017 +0000
description:
Clarify ttm state transitions tt_unpopulated<->tt_unbound<->tt_bound.
Assert it, too, and don't handle other cases.
We can add the assertion to ttm_agp_tt_unpopulate because it is called by
{nouveau,radeon}_ttm_tt_unpopulate, which is generically called
ttm_tt_unpopulate.
And the sole caller to ttm_tt_unpopulate (ttm_tt_destroy) only does so if the
state is unbound. the other caller is in a !NetBSD block.
We can add the assertion to ttm_agp_tt_populate and avoid handling the
!unpopulated case because the sole callers are {nouveau,radeon}_ttm_tt_populate
both of which return early in the !unpopulated case.
We can change the assertion on ttm_tt_wire because it is solely called by
ttm_bus_dma_populate, which already asserts that it is the unpopulated case.
from riastradh
diffstat:
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c | 11 +++++------
sys/external/bsd/drm2/ttm/ttm_agp_backend.c | 13 ++++++++-----
sys/external/bsd/drm2/ttm/ttm_bus_dma.c | 8 ++++----
3 files changed, 17 insertions(+), 15 deletions(-)
diffs (98 lines):
diff -r f6813de5c41f -r 1075aed63081 sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c Thu Mar 09 08:05:21 2017 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c Thu Mar 09 08:27:18 2017 +0000
@@ -360,9 +360,9 @@
* ttm_tt_wire(ttm)
*
* Wire the uvm pages of ttm and fill the ttm page array. ttm
- * must be unpopulated or unbound, and must be marked swapped.
- * This does not change either state -- the caller is expected to
- * include it among other operations for such a state transition.
+ * must be unpopulated, and must be marked swapped. This does not
+ * change either state -- the caller is expected to include it
+ * among other operations for such a state transition.
*/
int
ttm_tt_wire(struct ttm_tt *ttm)
@@ -372,9 +372,8 @@
unsigned i;
int error;
- KASSERTMSG((ttm->state == tt_unpopulated || ttm->state == tt_unbound),
- "ttm_tt %p must be unpopulated or unbound for wiring,"
- " but state=%d",
+ KASSERTMSG((ttm->state == tt_unpopulated),
+ "ttm_tt %p must be unpopulated for wiring, but state=%d",
ttm, (int)ttm->state);
KASSERT(ISSET(ttm->page_flags, TTM_PAGE_FLAG_SWAPPED));
KASSERT(uobj != NULL);
diff -r f6813de5c41f -r 1075aed63081 sys/external/bsd/drm2/ttm/ttm_agp_backend.c
--- a/sys/external/bsd/drm2/ttm/ttm_agp_backend.c Thu Mar 09 08:05:21 2017 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_agp_backend.c Thu Mar 09 08:27:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_agp_backend.c,v 1.5 2015/10/17 21:05:57 jmcneill Exp $ */
+/* $NetBSD: ttm_agp_backend.c,v 1.6 2017/03/09 08:27:18 maya Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.5 2015/10/17 21:05:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.6 2017/03/09 08:27:18 maya Exp $");
#include <sys/types.h>
#include <sys/kmem.h>
@@ -78,9 +78,9 @@
ttm_agp_tt_populate(struct ttm_tt *ttm)
{
- if (ttm->state != tt_unpopulated)
- return 0;
-
+ KASSERTMSG((ttm->state == tt_unpopulated),
+ "ttm_agp_tt_populate: ttm %p state is not tt_unpopulated: %d",
+ ttm, (int)ttm->state);
return ttm_bus_dma_populate(container_of(ttm, struct ttm_dma_tt, ttm));
}
@@ -88,6 +88,9 @@
ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
{
+ KASSERTMSG((ttm->state == tt_unbound),
+ "ttm_agp_tt_unpopulate: ttm %p state is not tt_unbound: %d",
+ ttm, (int)ttm->state);
ttm_bus_dma_unpopulate(container_of(ttm, struct ttm_dma_tt, ttm));
}
diff -r f6813de5c41f -r 1075aed63081 sys/external/bsd/drm2/ttm/ttm_bus_dma.c
--- a/sys/external/bsd/drm2/ttm/ttm_bus_dma.c Thu Mar 09 08:05:21 2017 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_bus_dma.c Thu Mar 09 08:27:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $ */
+/* $NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $");
#include <sys/bus.h>
@@ -47,8 +47,8 @@
* its DMA map. The wiring and loading are stable as long as the
* associated bo is reserved.
*
- * Transitions from tt_unpopulated or tt_unbound to tt_unbound.
- * Marks as wired, a.k.a. !swapped.
+ * Transitions from tt_unpopulated to tt_unbound. Marks as wired,
+ * a.k.a. !swapped.
*/
int
ttm_bus_dma_populate(struct ttm_dma_tt *ttm_dma)
Home |
Main Index |
Thread Index |
Old Index