2009-01-29 18:25:35 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Nouveau Project
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NOUVEAU_PRIVATE_H__
|
|
|
|
#define __NOUVEAU_PRIVATE_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <xf86drm.h>
|
|
|
|
#include <nouveau_drm.h>
|
|
|
|
|
|
|
|
#include "nouveau_drmif.h"
|
|
|
|
#include "nouveau_device.h"
|
|
|
|
#include "nouveau_channel.h"
|
|
|
|
#include "nouveau_grobj.h"
|
|
|
|
#include "nouveau_notifier.h"
|
|
|
|
#include "nouveau_bo.h"
|
|
|
|
#include "nouveau_resource.h"
|
|
|
|
#include "nouveau_pushbuf.h"
|
2010-01-29 01:53:24 -07:00
|
|
|
#include "nouveau_reloc.h"
|
2009-01-29 18:25:35 -07:00
|
|
|
|
2010-09-28 14:45:27 -06:00
|
|
|
#define CALPB_BUFFERS 3
|
|
|
|
|
2009-01-29 18:25:35 -07:00
|
|
|
struct nouveau_pushbuf_priv {
|
2009-08-11 22:21:00 -06:00
|
|
|
uint32_t cal_suffix0;
|
|
|
|
uint32_t cal_suffix1;
|
|
|
|
struct nouveau_bo *buffer[CALPB_BUFFERS];
|
|
|
|
int current;
|
|
|
|
int current_offset;
|
2009-01-29 18:25:35 -07:00
|
|
|
|
|
|
|
unsigned *pushbuf;
|
2010-01-29 01:53:24 -07:00
|
|
|
unsigned size;
|
2009-01-29 18:25:35 -07:00
|
|
|
|
2010-01-29 01:53:24 -07:00
|
|
|
uint32_t *marker;
|
|
|
|
unsigned marker_offset;
|
2009-11-03 22:23:53 -07:00
|
|
|
unsigned marker_relocs;
|
2010-01-29 01:53:24 -07:00
|
|
|
unsigned marker_push;
|
2009-11-03 22:23:53 -07:00
|
|
|
|
2009-01-29 18:25:35 -07:00
|
|
|
struct drm_nouveau_gem_pushbuf_bo *buffers;
|
|
|
|
unsigned nr_buffers;
|
|
|
|
struct drm_nouveau_gem_pushbuf_reloc *relocs;
|
|
|
|
unsigned nr_relocs;
|
2010-01-29 01:53:24 -07:00
|
|
|
struct drm_nouveau_gem_pushbuf_push push[NOUVEAU_GEM_MAX_PUSH];
|
|
|
|
unsigned nr_push;
|
2009-01-29 18:25:35 -07:00
|
|
|
};
|
|
|
|
#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
|
|
|
|
|
|
|
|
int
|
2010-09-28 14:45:27 -06:00
|
|
|
nouveau_pushbuf_init(struct nouveau_channel *, int buf_size);
|
2009-12-28 16:00:09 -07:00
|
|
|
void
|
|
|
|
nouveau_pushbuf_fini(struct nouveau_channel *);
|
2009-01-29 18:25:35 -07:00
|
|
|
|
|
|
|
struct nouveau_channel_priv {
|
|
|
|
struct nouveau_channel base;
|
|
|
|
|
|
|
|
struct drm_nouveau_channel_alloc drm;
|
|
|
|
|
2009-07-26 15:23:09 -06:00
|
|
|
struct nouveau_bo *notifier_bo;
|
2009-01-29 18:25:35 -07:00
|
|
|
|
|
|
|
struct nouveau_pushbuf_priv pb;
|
|
|
|
};
|
|
|
|
#define nouveau_channel(n) ((struct nouveau_channel_priv *)(n))
|
|
|
|
|
|
|
|
struct nouveau_grobj_priv {
|
|
|
|
struct nouveau_grobj base;
|
|
|
|
};
|
|
|
|
#define nouveau_grobj(n) ((struct nouveau_grobj_priv *)(n))
|
|
|
|
|
|
|
|
struct nouveau_notifier_priv {
|
|
|
|
struct nouveau_notifier base;
|
|
|
|
|
|
|
|
struct drm_nouveau_notifierobj_alloc drm;
|
|
|
|
volatile void *map;
|
|
|
|
};
|
|
|
|
#define nouveau_notifier(n) ((struct nouveau_notifier_priv *)(n))
|
|
|
|
|
|
|
|
struct nouveau_bo_priv {
|
|
|
|
struct nouveau_bo base;
|
|
|
|
int refcount;
|
|
|
|
|
|
|
|
/* Buffer configuration + usage hints */
|
|
|
|
unsigned flags;
|
|
|
|
unsigned size;
|
|
|
|
unsigned align;
|
|
|
|
int user;
|
|
|
|
|
|
|
|
/* Tracking */
|
|
|
|
struct drm_nouveau_gem_pushbuf_bo *pending;
|
|
|
|
struct nouveau_channel *pending_channel;
|
2009-10-26 22:32:40 -06:00
|
|
|
int pending_refcnt;
|
2009-01-29 18:25:35 -07:00
|
|
|
int write_marker;
|
|
|
|
|
|
|
|
/* Userspace object */
|
|
|
|
void *sysmem;
|
|
|
|
|
|
|
|
/* Kernel object */
|
|
|
|
uint32_t global_handle;
|
2009-03-15 12:52:58 -06:00
|
|
|
drm_handle_t handle;
|
2009-05-25 22:14:04 -06:00
|
|
|
uint64_t map_handle;
|
2010-10-30 18:22:29 -06:00
|
|
|
int map_refcnt;
|
2009-01-29 18:25:35 -07:00
|
|
|
void *map;
|
|
|
|
|
|
|
|
/* Last known information from kernel on buffer status */
|
|
|
|
uint64_t offset;
|
|
|
|
uint32_t domain;
|
|
|
|
};
|
|
|
|
#define nouveau_bo(n) ((struct nouveau_bo_priv *)(n))
|
|
|
|
|
|
|
|
int
|
|
|
|
nouveau_bo_init(struct nouveau_device *);
|
|
|
|
|
|
|
|
void
|
|
|
|
nouveau_bo_takedown(struct nouveau_device *);
|
|
|
|
|
|
|
|
struct drm_nouveau_gem_pushbuf_bo *
|
|
|
|
nouveau_bo_emit_buffer(struct nouveau_channel *, struct nouveau_bo *);
|
|
|
|
|
|
|
|
#endif
|