typedef uint16_t u16;
typedef uint8_t u8;
-struct radeon;
struct winsys_handle;
enum radeon_family {
#define R600_CONTEXT_CHECK_EVENT_FLUSH (1 << 2)
struct r600_context {
- struct radeon *radeon;
struct r600_screen *screen;
struct radeon_winsys_cs *cs;
};
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);
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);
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,
/* 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;
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;
}
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;
}
if (rscreen == NULL)
return;
- radeon_destroy(rscreen->radeon);
rscreen->ws->destroy(rscreen->ws);
util_slab_destroy(&rscreen->pool_buffers);
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;
}
}
if (r600_init_tiling(rscreen)) {
- radeon_destroy(radeon);
FREE(rscreen);
return NULL;
}
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;
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;
C_SOURCES := \
evergreen_hw_context.c \
- r600_drm.c \
r600_hw_context.c
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);
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 *));
+++ /dev/null
-/*
- * 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);
-}
{
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) {
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));
}
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);
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 *));
/* 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. */
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);
#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
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)