nv04: remove u_simple_screen usage

This commit is contained in:
Ben Skeggs 2009-06-04 21:57:53 +10:00
parent 251c47117b
commit d4d584b16e
3 changed files with 28 additions and 47 deletions

View File

@ -1,27 +1,9 @@
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_simple_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"
static const char *
nv04_screen_get_name(struct pipe_screen *screen)
{
struct nv04_screen *nv04screen = nv04_screen(screen);
struct nouveau_device *dev = nv04screen->nvws->channel->device;
static char buffer[128];
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
return buffer;
}
static const char *
nv04_screen_get_vendor(struct pipe_screen *screen)
{
return "nouveau";
}
static int
nv04_screen_get_param(struct pipe_screen *screen, int param)
{
@ -144,18 +126,31 @@ struct pipe_screen *
nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
{
struct nv04_screen *screen = CALLOC_STRUCT(nv04_screen);
struct nouveau_device *dev = nvws->channel->device;
struct pipe_screen *pscreen;
unsigned fahrenheit_class = 0, sub3d_class = 0;
unsigned chipset = nvws->channel->device->chipset;
int ret;
if (!screen)
return NULL;
pscreen = &screen->base.base;
screen->nvws = nvws;
if (chipset>=0x20) {
pscreen->winsys = ws;
pscreen->destroy = nv04_screen_destroy;
pscreen->get_param = nv04_screen_get_param;
pscreen->get_paramf = nv04_screen_get_paramf;
pscreen->is_format_supported = nv04_screen_is_format_supported;
nv04_screen_init_miptree_functions(pscreen);
nv04_screen_init_transfer_functions(pscreen);
nouveau_screen_init(&screen->base, dev);
if (dev->chipset >= 0x20) {
fahrenheit_class = 0;
sub3d_class = 0;
} else if (chipset>=0x10) {
} else if (dev->chipset >= 0x10) {
fahrenheit_class = NV10_DX5_TEXTURED_TRIANGLE;
sub3d_class = NV10_CONTEXT_SURFACES_3D;
} else {
@ -164,7 +159,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
}
if (!fahrenheit_class) {
NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", chipset);
NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", dev->chipset);
return NULL;
}
@ -190,24 +185,10 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
if (ret) {
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
nv04_screen_destroy(&screen->pipe);
nv04_screen_destroy(pscreen);
return NULL;
}
screen->pipe.winsys = ws;
screen->pipe.destroy = nv04_screen_destroy;
screen->pipe.get_name = nv04_screen_get_name;
screen->pipe.get_vendor = nv04_screen_get_vendor;
screen->pipe.get_param = nv04_screen_get_param;
screen->pipe.get_paramf = nv04_screen_get_paramf;
screen->pipe.is_format_supported = nv04_screen_is_format_supported;
nv04_screen_init_miptree_functions(&screen->pipe);
nv04_screen_init_transfer_functions(&screen->pipe);
u_simple_screen_init(&screen->pipe);
return &screen->pipe;
return pscreen;
}

View File

@ -1,11 +1,11 @@
#ifndef __NV04_SCREEN_H__
#define __NV04_SCREEN_H__
#include "pipe/p_screen.h"
#include "nouveau/nouveau_screen.h"
#include "nv04_surface_2d.h"
struct nv04_screen {
struct pipe_screen pipe;
struct nouveau_screen base;
struct nouveau_winsys *nvws;
unsigned chipset;

View File

@ -99,8 +99,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
struct nouveau_channel *chan = ctx->nvws->channel;
struct nouveau_grobj *swzsurf = ctx->swzsurf;
struct nouveau_grobj *sifm = ctx->sifm;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
const unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
const unsigned max_w = 1024;
const unsigned max_h = 1024;
@ -169,8 +169,8 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
{
struct nouveau_channel *chan = ctx->nvws->channel;
struct nouveau_grobj *m2mf = ctx->m2mf;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
unsigned dst_offset = dst->offset + dy * dst_pitch +
@ -216,8 +216,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
struct nouveau_channel *chan = ctx->nvws->channel;
struct nouveau_grobj *surf2d = ctx->surf2d;
struct nouveau_grobj *blit = ctx->blit;
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
int format;
@ -282,7 +282,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
struct nouveau_channel *chan = ctx->nvws->channel;
struct nouveau_grobj *surf2d = ctx->surf2d;
struct nouveau_grobj *rect = ctx->rect;
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
int cs2d_format, gdirect_format;