r600g: remove struct radeon (or what's left of it)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
518557d74a
commit
90ce3cdde9
|
@ -38,7 +38,6 @@ typedef uint32_t u32;
|
|||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
|
||||
struct radeon;
|
||||
struct winsys_handle;
|
||||
|
||||
enum radeon_family {
|
||||
|
@ -203,7 +202,6 @@ struct r600_query {
|
|||
#define R600_CONTEXT_CHECK_EVENT_FLUSH (1 << 2)
|
||||
|
||||
struct r600_context {
|
||||
struct radeon *radeon;
|
||||
struct r600_screen *screen;
|
||||
struct radeon_winsys_cs *cs;
|
||||
|
||||
|
@ -248,7 +246,7 @@ struct r600_draw {
|
|||
};
|
||||
|
||||
void r600_get_backend_mask(struct r600_context *ctx);
|
||||
int r600_context_init(struct r600_context *ctx, struct r600_screen *screen, struct radeon *radeon);
|
||||
int r600_context_init(struct r600_context *ctx, struct r600_screen *screen);
|
||||
void r600_context_fini(struct r600_context *ctx);
|
||||
void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state);
|
||||
void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
|
||||
|
@ -275,7 +273,7 @@ void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource *fen
|
|||
void r600_context_flush_all(struct r600_context *ctx, unsigned flush_flags);
|
||||
void r600_context_flush_dest_caches(struct r600_context *ctx);
|
||||
|
||||
int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen, struct radeon *radeon);
|
||||
int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen);
|
||||
void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
|
||||
void evergreen_context_flush_dest_caches(struct r600_context *ctx);
|
||||
void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
|
||||
|
@ -284,9 +282,6 @@ void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, stru
|
|||
void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
|
||||
void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
|
||||
|
||||
struct radeon *radeon_create(struct radeon_winsys *ws);
|
||||
void radeon_destroy(struct radeon *radeon);
|
||||
|
||||
void _r600_pipe_state_add_reg(struct r600_context *ctx,
|
||||
struct r600_pipe_state *state,
|
||||
u32 offset, u32 value, u32 mask,
|
||||
|
|
|
@ -213,7 +213,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
|
|||
/* Easy accessing of screen/winsys. */
|
||||
rctx->screen = rscreen;
|
||||
rctx->ws = rscreen->ws;
|
||||
rctx->radeon = rscreen->radeon;
|
||||
rctx->family = rscreen->family;
|
||||
rctx->chip_class = rscreen->chip_class;
|
||||
|
||||
|
@ -236,7 +235,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
|
|||
case R600:
|
||||
case R700:
|
||||
r600_init_state_functions(rctx);
|
||||
if (r600_context_init(&rctx->ctx, rctx->screen, rctx->radeon)) {
|
||||
if (r600_context_init(&rctx->ctx, rctx->screen)) {
|
||||
r600_destroy_context(&rctx->context);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -246,7 +245,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
|
|||
case EVERGREEN:
|
||||
case CAYMAN:
|
||||
evergreen_init_state_functions(rctx);
|
||||
if (evergreen_context_init(&rctx->ctx, rctx->screen, rctx->radeon)) {
|
||||
if (evergreen_context_init(&rctx->ctx, rctx->screen)) {
|
||||
r600_destroy_context(&rctx->context);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -524,7 +523,6 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
|
|||
if (rscreen == NULL)
|
||||
return;
|
||||
|
||||
radeon_destroy(rscreen->radeon);
|
||||
rscreen->ws->destroy(rscreen->ws);
|
||||
|
||||
util_slab_destroy(&rscreen->pool_buffers);
|
||||
|
@ -712,26 +710,17 @@ static unsigned radeon_family_from_device(unsigned device)
|
|||
|
||||
struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
|
||||
{
|
||||
struct r600_screen *rscreen;
|
||||
struct radeon *radeon = radeon_create(ws);
|
||||
if (!radeon) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rscreen = CALLOC_STRUCT(r600_screen);
|
||||
struct r600_screen *rscreen = CALLOC_STRUCT(r600_screen);
|
||||
if (rscreen == NULL) {
|
||||
radeon_destroy(radeon);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rscreen->ws = ws;
|
||||
rscreen->radeon = radeon;
|
||||
ws->query_info(ws, &rscreen->info);
|
||||
|
||||
rscreen->family = radeon_family_from_device(rscreen->info.pci_id);
|
||||
if (rscreen->family == CHIP_UNKNOWN) {
|
||||
fprintf(stderr, "r600: Unknown chipset 0x%04X\n", rscreen->info.pci_id);
|
||||
radeon_destroy(radeon);
|
||||
FREE(rscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -748,7 +737,6 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
|
|||
}
|
||||
|
||||
if (r600_init_tiling(rscreen)) {
|
||||
radeon_destroy(radeon);
|
||||
FREE(rscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@ enum r600_pipe_state_id {
|
|||
struct r600_screen {
|
||||
struct pipe_screen screen;
|
||||
struct radeon_winsys *ws;
|
||||
struct radeon *radeon;
|
||||
unsigned family;
|
||||
enum chip_class chip_class;
|
||||
struct radeon_info info;
|
||||
|
@ -188,7 +187,6 @@ struct r600_pipe_context {
|
|||
void *custom_dsa_flush;
|
||||
struct r600_screen *screen;
|
||||
struct radeon_winsys *ws;
|
||||
struct radeon *radeon;
|
||||
struct r600_pipe_state *states[R600_PIPE_NSTATES];
|
||||
struct r600_context ctx;
|
||||
struct r600_vertex_element *vertex_elements;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
C_SOURCES := \
|
||||
evergreen_hw_context.c \
|
||||
r600_drm.c \
|
||||
r600_hw_context.c
|
||||
|
|
|
@ -898,12 +898,11 @@ static int evergreen_loop_const_init(struct r600_context *ctx, u32 offset)
|
|||
return r600_context_add_block(ctx, r600_loop_consts, nreg, PKT3_SET_LOOP_CONST, EVERGREEN_LOOP_CONST_OFFSET);
|
||||
}
|
||||
|
||||
int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen, struct radeon *radeon)
|
||||
int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen)
|
||||
{
|
||||
int r;
|
||||
|
||||
memset(ctx, 0, sizeof(struct r600_context));
|
||||
ctx->radeon = radeon;
|
||||
ctx->screen = screen;
|
||||
|
||||
LIST_INITHEAD(&ctx->query_list);
|
||||
|
@ -989,7 +988,7 @@ int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen,
|
|||
if (r)
|
||||
goto out_err;
|
||||
|
||||
ctx->cs = radeon->ws->cs_create(radeon->ws);
|
||||
ctx->cs = screen->ws->cs_create(screen->ws);
|
||||
|
||||
/* allocate cs variables */
|
||||
ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
|
||||
*
|
||||
* 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
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, 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 (including the next
|
||||
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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.
|
||||
*
|
||||
* Authors:
|
||||
* Jerome Glisse
|
||||
* Corbin Simpson <MostAwesomeDude@gmail.com>
|
||||
* Joakim Sindholt <opensource@zhasha.com>
|
||||
*/
|
||||
|
||||
#include "r600_priv.h"
|
||||
#include "util/u_memory.h"
|
||||
#include <errno.h>
|
||||
|
||||
struct radeon *radeon_create(struct radeon_winsys *ws)
|
||||
{
|
||||
struct radeon *radeon = CALLOC_STRUCT(radeon);
|
||||
if (radeon == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
radeon->ws = ws;
|
||||
ws->query_info(ws, &radeon->info);
|
||||
|
||||
return radeon;
|
||||
}
|
||||
|
||||
void radeon_destroy(struct radeon *radeon)
|
||||
{
|
||||
FREE(radeon);
|
||||
}
|
|
@ -36,13 +36,13 @@ void r600_get_backend_mask(struct r600_context *ctx)
|
|||
{
|
||||
struct r600_resource *buffer;
|
||||
u32 *results;
|
||||
unsigned num_backends = ctx->radeon->info.r600_num_backends;
|
||||
unsigned num_backends = ctx->screen->info.r600_num_backends;
|
||||
unsigned i, mask = 0;
|
||||
|
||||
/* if backend_map query is supported by the kernel */
|
||||
if (ctx->radeon->info.r600_backend_map_valid) {
|
||||
unsigned num_tile_pipes = ctx->radeon->info.r600_num_tile_pipes;
|
||||
unsigned backend_map = ctx->radeon->info.r600_backend_map;
|
||||
if (ctx->screen->info.r600_backend_map_valid) {
|
||||
unsigned num_tile_pipes = ctx->screen->info.r600_num_tile_pipes;
|
||||
unsigned backend_map = ctx->screen->info.r600_backend_map;
|
||||
unsigned item_width, item_mask;
|
||||
|
||||
if (ctx->screen->chip_class >= EVERGREEN) {
|
||||
|
@ -776,7 +776,7 @@ void r600_context_fini(struct r600_context *ctx)
|
|||
free(ctx->range);
|
||||
free(ctx->blocks);
|
||||
free(ctx->bo);
|
||||
ctx->radeon->ws->cs_destroy(ctx->cs);
|
||||
ctx->screen->ws->cs_destroy(ctx->cs);
|
||||
|
||||
memset(ctx, 0, sizeof(struct r600_context));
|
||||
}
|
||||
|
@ -828,12 +828,11 @@ int r600_setup_block_table(struct r600_context *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int r600_context_init(struct r600_context *ctx, struct r600_screen *screen, struct radeon *radeon)
|
||||
int r600_context_init(struct r600_context *ctx, struct r600_screen *screen)
|
||||
{
|
||||
int r;
|
||||
|
||||
memset(ctx, 0, sizeof(struct r600_context));
|
||||
ctx->radeon = radeon;
|
||||
ctx->screen = screen;
|
||||
|
||||
LIST_INITHEAD(&ctx->query_list);
|
||||
|
@ -911,7 +910,7 @@ int r600_context_init(struct r600_context *ctx, struct r600_screen *screen, stru
|
|||
if (r)
|
||||
goto out_err;
|
||||
|
||||
ctx->cs = radeon->ws->cs_create(radeon->ws);
|
||||
ctx->cs = screen->ws->cs_create(screen->ws);
|
||||
|
||||
/* allocate cs variables */
|
||||
ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
|
||||
|
@ -1506,7 +1505,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
|
|||
|
||||
/* Flush the CS. */
|
||||
ctx->cs->cdw = ctx->pm4_cdwords;
|
||||
ctx->radeon->ws->cs_flush(ctx->cs, flags);
|
||||
ctx->screen->ws->cs_flush(ctx->cs, flags);
|
||||
|
||||
/* We need to get the pointer to the other CS,
|
||||
* the command streams are double-buffered. */
|
||||
|
@ -1833,13 +1832,12 @@ boolean r600_context_query_result(struct r600_context *ctx,
|
|||
if (!r600_query_result(ctx, query, wait))
|
||||
return FALSE;
|
||||
|
||||
|
||||
switch (query->type) {
|
||||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
||||
*result = query->result;
|
||||
break;
|
||||
case PIPE_QUERY_TIME_ELAPSED:
|
||||
*result = (1000000 * query->result) / ctx->radeon->info.r600_clock_crystal_freq;
|
||||
*result = (1000000 * query->result) / ctx->screen->info.r600_clock_crystal_freq;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
|
|
@ -26,19 +26,13 @@
|
|||
#ifndef R600_PRIV_H
|
||||
#define R600_PRIV_H
|
||||
|
||||
#include "r600.h"
|
||||
#include "../../radeon/drm/radeon_winsys.h"
|
||||
#include "r600_pipe.h"
|
||||
#include "util/u_hash_table.h"
|
||||
#include "os/os_thread.h"
|
||||
|
||||
#define PKT_COUNT_C 0xC000FFFF
|
||||
#define PKT_COUNT_S(x) (((x) & 0x3FFF) << 16)
|
||||
|
||||
struct radeon {
|
||||
struct radeon_winsys *ws;
|
||||
struct radeon_info info;
|
||||
};
|
||||
|
||||
/* these flags are used in register flags and added into block flags */
|
||||
#define REG_FLAG_NEED_BO 1
|
||||
#define REG_FLAG_DIRTY_ALWAYS 2
|
||||
|
@ -86,7 +80,7 @@ static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r6
|
|||
assert(usage);
|
||||
|
||||
unsigned reloc_index =
|
||||
ctx->radeon->ws->cs_add_reloc(ctx->cs, rbo->cs_buf,
|
||||
ctx->screen->ws->cs_add_reloc(ctx->cs, rbo->cs_buf,
|
||||
rd, wd);
|
||||
|
||||
if (reloc_index >= ctx->creloc)
|
||||
|
|
Loading…
Reference in New Issue