nouveau: extend notifier interface to allow multiple notifiers in a memory block.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "nouveau_sync.h"
|
||||
|
||||
nouveau_notifier *
|
||||
nouveau_notifier_new(GLcontext *ctx, GLuint handle)
|
||||
nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count)
|
||||
{
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
nouveau_notifier *notifier;
|
||||
@@ -24,7 +24,7 @@ nouveau_notifier_new(GLcontext *ctx, GLuint handle)
|
||||
|
||||
notifier->mem = nouveau_mem_alloc(ctx,
|
||||
NOUVEAU_MEM_FB | NOUVEAU_MEM_MAPPED,
|
||||
32,
|
||||
count * NV_NOTIFIER_SIZE,
|
||||
0);
|
||||
if (!notifier->mem) {
|
||||
FREE(notifier);
|
||||
@@ -53,9 +53,9 @@ nouveau_notifier_destroy(GLcontext *ctx, nouveau_notifier *notifier)
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_notifier_reset(nouveau_notifier *notifier)
|
||||
nouveau_notifier_reset(nouveau_notifier *notifier, GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map;
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
return;
|
||||
@@ -68,11 +68,27 @@ nouveau_notifier_reset(nouveau_notifier *notifier)
|
||||
NV_NOTIFY_STATE_STATUS_SHIFT);
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint status,
|
||||
GLuint timeout)
|
||||
GLuint
|
||||
nouveau_notifier_status(nouveau_notifier *notifier, GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map;
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
|
||||
return n[NV_NOTIFY_STATE/4] >> NV_NOTIFY_STATE_STATUS_SHIFT;
|
||||
}
|
||||
|
||||
GLuint
|
||||
nouveau_notifier_return_val(nouveau_notifier *notifier, GLuint id)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
|
||||
return n[NV_NOTIFY_RETURN_VALUE/4];
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint id,
|
||||
GLuint status, GLuint timeout)
|
||||
{
|
||||
volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
|
||||
unsigned int time = 0;
|
||||
|
||||
#ifdef NOUVEAU_RING_DEBUG
|
||||
@@ -108,7 +124,7 @@ nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
|
||||
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
|
||||
GLboolean ret;
|
||||
|
||||
nouveau_notifier_reset(notifier);
|
||||
nouveau_notifier_reset(notifier, 0);
|
||||
|
||||
BEGIN_RING_SIZE(subc, NV_NOTIFY, 1);
|
||||
OUT_RING (NV_NOTIFY_STYLE_WRITE_ONLY);
|
||||
@@ -116,7 +132,7 @@ nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
|
||||
OUT_RING (0);
|
||||
FIRE_RING();
|
||||
|
||||
ret = nouveau_notifier_wait_status(notifier,
|
||||
ret = nouveau_notifier_wait_status(notifier, 0,
|
||||
NV_NOTIFY_STATE_STATUS_COMPLETED,
|
||||
0 /* no timeout */);
|
||||
if (ret == GL_FALSE) MESSAGE("wait on notifier failed\n");
|
||||
@@ -130,7 +146,7 @@ GLboolean nouveauSyncInitFuncs(GLcontext *ctx)
|
||||
return GL_TRUE;
|
||||
#endif
|
||||
|
||||
nmesa->syncNotifier = nouveau_notifier_new(ctx, NvSyncNotify);
|
||||
nmesa->syncNotifier = nouveau_notifier_new(ctx, NvSyncNotify, 1);
|
||||
if (!nmesa->syncNotifier) {
|
||||
MESSAGE("Failed to create channel sync notifier\n");
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "nouveau_buffers.h"
|
||||
|
||||
#define NV_NOTIFIER_SIZE 32
|
||||
#define NV_NOTIFY_TIME_0 0x00000000
|
||||
#define NV_NOTIFY_TIME_1 0x00000004
|
||||
#define NV_NOTIFY_RETURN_VALUE 0x00000008
|
||||
@@ -24,10 +25,13 @@ typedef struct nouveau_notifier_t {
|
||||
nouveau_mem *mem;
|
||||
} nouveau_notifier;
|
||||
|
||||
extern nouveau_notifier *nouveau_notifier_new(GLcontext *, GLuint handle);
|
||||
extern nouveau_notifier *nouveau_notifier_new(GLcontext *, GLuint handle,
|
||||
GLuint count);
|
||||
extern void nouveau_notifier_destroy(GLcontext *, nouveau_notifier *);
|
||||
extern void nouveau_notifier_reset(nouveau_notifier *);
|
||||
extern GLboolean nouveau_notifier_wait_status(nouveau_notifier *r,
|
||||
extern void nouveau_notifier_reset(nouveau_notifier *, GLuint id);
|
||||
extern GLuint nouveau_notifier_status(nouveau_notifier *, GLuint id);
|
||||
extern GLuint nouveau_notifier_return_val(nouveau_notifier *, GLuint id);
|
||||
extern GLboolean nouveau_notifier_wait_status(nouveau_notifier *r, GLuint id,
|
||||
GLuint status, GLuint timeout);
|
||||
extern void nouveau_notifier_wait_nop(GLcontext *ctx,
|
||||
nouveau_notifier *, GLuint subc);
|
||||
|
||||
Reference in New Issue
Block a user