From 2e66094a637f0e2460a68577da6761e84f4b1bcd Mon Sep 17 00:00:00 2001
From: Rudolf Cornelissen
Date: Sat, 20 Mar 2004 21:08:10 +0000
Subject: [PATCH] updated engine management code.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7045 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
.../accelerants/matrox/EngineManagment.c | 46 ++++++++++---------
.../accelerants/matrox/engine/mga_general.c | 4 +-
.../drivers/graphics/matrox/UPDATE.html | 8 ++++
3 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/src/add-ons/accelerants/matrox/EngineManagment.c b/src/add-ons/accelerants/matrox/EngineManagment.c
index e135159080..d3a4c7534b 100644
--- a/src/add-ons/accelerants/matrox/EngineManagment.c
+++ b/src/add-ons/accelerants/matrox/EngineManagment.c
@@ -2,7 +2,9 @@
Copyright 1999, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License.
- modification to call G400 functions and mess-ups - Mark Watson
+ other authors:
+ Mark Watson
+ Rudolf Cornelissen 3/2004
*/
#define MODULE_BIT 0x10000000
@@ -12,11 +14,14 @@
static engine_token gx00_engine_token = { 1, B_2D_ACCELERATION, NULL };
-uint32 ACCELERANT_ENGINE_COUNT(void) {
+uint32 ACCELERANT_ENGINE_COUNT(void)
+{
+ /* we have one acceleration engine */
return 1;
}
-status_t ACQUIRE_ENGINE(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et) {
+status_t ACQUIRE_ENGINE(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et)
+{
/* acquire the shared benaphore */
AQUIRE_BEN(si->engine.lock)
/* sync if required */
@@ -27,41 +32,38 @@ status_t ACQUIRE_ENGINE(uint32 capabilities, uint32 max_wait, sync_token *st, en
return B_OK;
}
-status_t RELEASE_ENGINE(engine_token *et, sync_token *st) {
+status_t RELEASE_ENGINE(engine_token *et, sync_token *st)
+{
/* update the sync token, if any */
- if (st) {
- GET_SYNC_TOKEN(et,st);
- }
+ if (st) GET_SYNC_TOKEN(et,st);
/* release the shared benaphore */
RELEASE_BEN(si->engine.lock)
return B_OK;
}
-void WAIT_ENGINE_IDLE(void) {
- uint32 count;
+void WAIT_ENGINE_IDLE(void)
+{
/*wait for the engine to be totally idle*/
- count = si->engine.count;
gx00_acc_wait_idle();
-
- si->engine.last_idle = count;
}
-status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st) {
- si->engine.count+=4;
+status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st)
+{
+ /* engine count will always be zero: we don't support syncing to token (yet) */
st->engine_id = et->engine_id;
st->counter = si->engine.count;
return B_OK;
}
-status_t SYNC_TO_TOKEN(sync_token *st) {
- /* a quick out */
- if (st->counter <= si->engine.last_idle) return B_OK;
-
- /* another quick out! */
- if ((st->counter >0xFFFFFFF) && (si->engine.last_idle <0xFFFF)) return B_OK; /*for when counter wraps*/
-
- /* If not we have to wait :-(*/
+status_t SYNC_TO_TOKEN(sync_token *st)
+{
+ /* wait until the engine is totally idle: we don't support syncing to token (yet) */
+ /* note:
+ * AFAIK in order to be able to setup sync_to_token, we'd need a circular fifo
+ * buffer in (main) memory instead of directly programming the GPU fifo so we
+ * can tell (via a hardware maintained pointer into this circular fifo) where
+ * the acc engine is with executing commands! */
WAIT_ENGINE_IDLE();
return B_OK;
diff --git a/src/add-ons/accelerants/matrox/engine/mga_general.c b/src/add-ons/accelerants/matrox/engine/mga_general.c
index 027807daf1..d3d78b3564 100644
--- a/src/add-ons/accelerants/matrox/engine/mga_general.c
+++ b/src/add-ons/accelerants/matrox/engine/mga_general.c
@@ -1,7 +1,7 @@
/* Authors:
Mark Watson 12/1999,
Apsed,
- Rudolf Cornelissen 10/2002-2/2004
+ Rudolf Cornelissen 10/2002-3/2004
*/
#define MODULE_BIT 0x00008000
@@ -54,7 +54,7 @@ status_t gx00_general_powerup()
status_t status;
uint32 card_class;
- LOG(1,("POWERUP: Matrox (open)BeOS Accelerant 0.16-final running.\n"));
+ LOG(1,("POWERUP: Matrox (open)BeOS Accelerant 0.17-1 running.\n"));
/* detect card type and power it up */
switch(CFGR(DEVID))
diff --git a/src/add-ons/kernel/drivers/graphics/matrox/UPDATE.html b/src/add-ons/kernel/drivers/graphics/matrox/UPDATE.html
index 36c4de0610..9baf543dce 100644
--- a/src/add-ons/kernel/drivers/graphics/matrox/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/matrox/UPDATE.html
@@ -4,6 +4,14 @@
Changes done for each driverversion:
+head (0.17-1, Rudolf)
+
+ - General:
+
+ - Fixed acceleration engine management regarding sync_to_token: no more updating glitches should occur now.
+
+
+
mga_driver 0.16 (Rudolf)