1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2011 Adam Rak <adam.rak@streamnovation.com> 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"), 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * on the rights to use, copy, modify, merge, publish, distribute, sub 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * license, and/or sell copies of the Software, and to permit persons to whom 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the Software is furnished to do so, subject to the following conditions: 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the next 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * paragraph) shall be included in all copies or substantial portions of the 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software. 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * USE OR OTHER DEALINGS IN THE SOFTWARE. 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Authors: 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Adam Rak <adam.rak@streamnovation.com> 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef EVERGREEN_COMPUTE_H 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define EVERGREEN_COMPUTE_H 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "r600.h" 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "r600_pipe.h" 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct r600_atom; 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct evergreen_compute_resource; 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid *evergreen_create_compute_state(struct pipe_context *ctx, const const struct pipe_compute_state *cso); 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid evergreen_delete_compute_state(struct pipe_context *ctx, void *state); 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid evergreen_compute_upload_input(struct pipe_context *context, const uint *block_layout, const uint *grid_layout, const void *input); 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid evergreen_init_atom_start_compute_cs(struct r600_context *rctx); 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid evergreen_init_compute_state_functions(struct r600_context *rctx); 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid evergreen_emit_cs_shader(struct r600_context *rctx, struct r600_atom * atom); 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_resource *r600_compute_global_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ); 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid r600_compute_global_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *res); 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid* r600_compute_global_transfer_map(struct pipe_context *ctx, struct pipe_transfer* transfer); 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid r600_compute_global_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer); 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_transfer * r600_compute_global_get_transfer(struct pipe_context *, struct pipe_resource *, unsigned level, 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned usage, const struct pipe_box *); 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid r600_compute_global_transfer_destroy(struct pipe_context *, struct pipe_transfer *); 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid r600_compute_global_transfer_flush_region( struct pipe_context *, struct pipe_transfer *, const struct pipe_box *); 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid r600_compute_global_transfer_inline_write( struct pipe_context *, struct pipe_resource *, unsigned level, 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned usage, const struct pipe_box *, const void *data, unsigned stride, unsigned layer_stride); 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic inline void COMPUTE_DBG(const char *fmt, ...) 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org static bool check_debug = false, debug = false; 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (!check_debug) { 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org debug = debug_get_bool_option("R600_COMPUTE_DEBUG", FALSE); 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org if (debug) { 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org va_list ap; 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org va_start(ap, fmt); 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org _debug_vprintf(fmt, ap); 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org va_end(ap); 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 71