From 948e1eb8e9c166ad5b74abc630d0760768ce78c9 Mon Sep 17 00:00:00 2001 From: Fredrik Höglund Date: Tue, 29 Mar 2011 19:43:59 +0200 Subject: r600g: implement the pipe_screen fence functions v2: Allocate the fences from a single shared buffer object. v3: Allocate the r600_fence structs in blocks of 16. Spin a few times before calling sched_yield in r600_fence_finish(). --- src/gallium/drivers/r600/r600_pipe.c | 145 +++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 0e28bda6eb6..c5fc2ba2d35 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -37,6 +37,7 @@ #include #include #include "util/u_upload_mgr.h" +#include "os/os_time.h" #include #include "r600.h" #include "r600d.h" @@ -48,15 +49,82 @@ /* * pipe_context */ +static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx) +{ + struct r600_fence *fence = NULL; + + if (!ctx->fences.bo) { + /* Create the shared buffer object */ + ctx->fences.bo = r600_bo(ctx->radeon, 4096, 0, 0, 0); + if (!ctx->fences.bo) { + R600_ERR("r600: failed to create bo for fence objects\n"); + return NULL; + } + ctx->fences.data = r600_bo_map(ctx->radeon, ctx->fences.bo, PB_USAGE_UNSYNCHRONIZED, NULL); + } + + if (!LIST_IS_EMPTY(&ctx->fences.pool)) { + struct r600_fence *entry; + + /* Try to find a freed fence that has been signalled */ + LIST_FOR_EACH_ENTRY(entry, &ctx->fences.pool, head) { + if (ctx->fences.data[entry->index] != 0) { + LIST_DELINIT(&entry->head); + fence = entry; + break; + } + } + } + + if (!fence) { + /* Allocate a new fence */ + struct r600_fence_block *block; + unsigned index; + + if ((ctx->fences.next_index + 1) >= 1024) { + R600_ERR("r600: too many concurrent fences\n"); + return NULL; + } + + index = ctx->fences.next_index++; + + if (!(index % FENCE_BLOCK_SIZE)) { + /* Allocate a new block */ + block = CALLOC_STRUCT(r600_fence_block); + if (block == NULL) + return NULL; + + LIST_ADD(&block->head, &ctx->fences.blocks); + } else { + block = LIST_ENTRY(struct r600_fence_block, ctx->fences.blocks.next, head); + } + + fence = &block->fences[index % FENCE_BLOCK_SIZE]; + fence->ctx = ctx; + fence->index = index; + } + + pipe_reference_init(&fence->reference, 1); + + ctx->fences.data[fence->index] = 0; + r600_context_emit_fence(&ctx->ctx, ctx->fences.bo, fence->index, 1); + return fence; +} + static void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_fence **rfence = (struct r600_fence**)fence; + #if 0 static int dc = 0; char dname[256]; #endif + if (rfence) + *rfence = r600_create_fence(rctx); + if (!rctx->ctx.pm4_cdwords) return; @@ -112,6 +180,18 @@ static void r600_destroy_context(struct pipe_context *context) u_vbuf_mgr_destroy(rctx->vbuf_mgr); util_slab_destroy(&rctx->pool_transfers); + if (rctx->fences.bo) { + struct r600_fence_block *entry, *tmp; + + LIST_FOR_EACH_ENTRY_SAFE(entry, tmp, &rctx->fences.blocks, head) { + LIST_DEL(&entry->head); + FREE(entry); + } + + r600_bo_unmap(rctx->radeon, rctx->fences.bo); + r600_bo_reference(rctx->radeon, &rctx->fences.bo, NULL); + } + r600_update_num_contexts(rctx->screen, -1); FREE(rctx); @@ -139,6 +219,12 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void rctx->radeon = rscreen->radeon; rctx->family = r600_get_family(rctx->radeon); + rctx->fences.bo = NULL; + rctx->fences.data = NULL; + rctx->fences.next_index = 0; + LIST_INITHEAD(&rctx->fences.pool); + LIST_INITHEAD(&rctx->fences.blocks); + r600_init_blit_functions(rctx); r600_init_query_functions(rctx); r600_init_context_resource_functions(rctx); @@ -491,6 +577,62 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) FREE(rscreen); } +static void r600_fence_reference(struct pipe_screen *pscreen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + struct r600_fence **oldf = (struct r600_fence**)ptr; + struct r600_fence *newf = (struct r600_fence*)fence; + + if (pipe_reference(&(*oldf)->reference, &newf->reference)) { + struct r600_pipe_context *ctx = (*oldf)->ctx; + LIST_ADDTAIL(&(*oldf)->head, &ctx->fences.pool); + } + + *ptr = fence; +} + +static boolean r600_fence_signalled(struct pipe_screen *pscreen, + struct pipe_fence_handle *fence) +{ + struct r600_fence *rfence = (struct r600_fence*)fence; + struct r600_pipe_context *ctx = rfence->ctx; + + return ctx->fences.data[rfence->index]; +} + +static boolean r600_fence_finish(struct pipe_screen *pscreen, + struct pipe_fence_handle *fence, + uint64_t timeout) +{ + struct r600_fence *rfence = (struct r600_fence*)fence; + struct r600_pipe_context *ctx = rfence->ctx; + int64_t start_time = 0; + unsigned spins = 0; + + if (timeout != PIPE_TIMEOUT_INFINITE) { + start_time = os_time_get(); + + /* Convert to microseconds. */ + timeout /= 1000; + } + + while (ctx->fences.data[rfence->index] == 0) { + if (++spins % 256) + continue; +#ifdef PIPE_OS_UNIX + sched_yield(); +#else + os_time_sleep(10); +#endif + if (timeout != PIPE_TIMEOUT_INFINITE && + os_time_get() - start_time >= timeout) { + return FALSE; + } + } + + return TRUE; +} struct pipe_screen *r600_screen_create(struct radeon *radeon) { @@ -511,6 +653,9 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon) rscreen->screen.get_paramf = r600_get_paramf; rscreen->screen.is_format_supported = r600_is_format_supported; rscreen->screen.context_create = r600_create_context; + rscreen->screen.fence_reference = r600_fence_reference; + rscreen->screen.fence_signalled = r600_fence_signalled; + rscreen->screen.fence_finish = r600_fence_finish; r600_init_screen_resource_functions(&rscreen->screen); rscreen->tiling_info = r600_get_tiling_info(radeon); -- cgit v1.2.3 From 4a7f013f9db793dab8dbc9f71646dab49f12ed2f Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 29 Mar 2011 18:18:05 +0200 Subject: gallium: set PIPE_CAP_MIXED_COLORBUFFER_FORMATS in some drivers --- src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/noop/noop_pipe.c | 1 + src/gallium/drivers/nv50/nv50_screen.c | 1 + src/gallium/drivers/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/nvfx/nvfx_screen.c | 2 ++ src/gallium/drivers/r300/r300_screen.c | 2 ++ src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/svga/svga_screen.c | 2 ++ 8 files changed, 11 insertions(+) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 521a52ad3ae..036a6e0c379 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -166,6 +166,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; default: return 0; diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 496b7f5ec6d..18308b796f3 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -337,6 +337,7 @@ static int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_TEXTURE_SHADOW_MAP: case PIPE_CAP_TEXTURE_SWIZZLE: case PIPE_CAP_BLEND_EQUATION_SEPARATE: + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; case PIPE_CAP_DUAL_SOURCE_BLEND: diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 9978d1e7861..cfa49aa0394 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -131,6 +131,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART: case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index f0f5237de52..e98a4c0fd42 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -115,6 +115,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_PRIMITIVE_RESTART: case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 9e6b9d6ef8f..0c8d33fb0aa 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -81,6 +81,8 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; // TODO: implement primitive restart case PIPE_CAP_SHADER_STENCIL_EXPORT: return 0; + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: + return 0; default: NOUVEAU_ERR("Warning: unknown PIPE_CAP %d\n", param); return 0; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index deaeb77429f..f09c9c02972 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -118,6 +118,8 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 1; case PIPE_CAP_TEXTURE_SWIZZLE: return util_format_s3tc_enabled ? r300screen->caps.dxtc_swizzle : 1; + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: + return is_r500 ? 1 : 0; /* Unsupported features (boolean caps). */ case PIPE_CAP_TIMER_QUERY: diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index c5fc2ba2d35..3e24bfafe4a 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -371,6 +371,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_SHADER_STENCIL_EXPORT: case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; case PIPE_CAP_INDEP_BLEND_ENABLE: /* R600 doesn't support per-MRT blends */ diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 6c987abe056..b847cf331b3 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -181,6 +181,8 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: return 1; + case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: + return 0; default: return 0; -- cgit v1.2.3 From 09eff39a58885bb3b8507d02920b53b4e81a66ea Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 7 Apr 2011 22:21:20 +0200 Subject: r600g: Unreference framebuffer state on context destruction. Signed-off-by: Henri Verbeet --- src/gallium/drivers/r600/r600_pipe.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 3e24bfafe4a..2c2245b67a8 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -168,6 +168,7 @@ static void r600_destroy_context(struct pipe_context *context) struct r600_pipe_context *rctx = (struct r600_pipe_context *)context; rctx->context.delete_depth_stencil_alpha_state(&rctx->context, rctx->custom_dsa_flush); + util_unreference_framebuffer_state(&rctx->framebuffer); r600_context_fini(&rctx->ctx); -- cgit v1.2.3 From 5c477ab2de9fb2ad3b0e4ae53f5930f1288cb90e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 11 Apr 2011 14:37:58 +0200 Subject: r600g: handle PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL in get_param --- src/gallium/drivers/r600/r600_pipe.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 2c2245b67a8..5f95540a479 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -385,6 +385,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_STREAM_OUTPUT: case PIPE_CAP_PRIMITIVE_RESTART: case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */ + case PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL: /* R600 doesn't support per-MRT blends */ if (family == CHIP_R600) return 0; -- cgit v1.2.3 From 75fa5c99a86c1ae0f8a4fecc016a5f82da9ae80a Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 11 Apr 2011 06:23:00 +0200 Subject: gallium: add and use generic function for querying patented format support (v2) v2: Unsigned floats are allowed regardless of the configure switch. --- src/gallium/auxiliary/util/u_format.c | 49 +++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_format.h | 10 ++++++ src/gallium/drivers/i915/i915_screen.c | 3 ++ src/gallium/drivers/i965/brw_screen.c | 3 ++ src/gallium/drivers/nv50/nv50_screen.c | 13 ++----- src/gallium/drivers/nvc0/nvc0_screen.c | 13 ++----- src/gallium/drivers/nvfx/nvfx_screen.c | 3 ++ src/gallium/drivers/r300/r300_screen.c | 3 ++ src/gallium/drivers/r300/r300_state_derived.c | 19 ----------- src/gallium/drivers/r600/r600_pipe.c | 3 ++ 10 files changed, 78 insertions(+), 41 deletions(-) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 4896faa12bf..9cbdd0a5b99 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -36,6 +36,55 @@ #include "u_memory.h" #include "u_rect.h" #include "u_format.h" +#include "u_format_s3tc.h" + +#include "pipe/p_defines.h" + + +boolean +util_format_is_float(enum pipe_format format) +{ + const struct util_format_description *desc = util_format_description(format); + unsigned i; + + assert(desc); + if (!desc) { + return FALSE; + } + + /* Find the first non-void channel. */ + for (i = 0; i < 4; i++) { + if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) { + break; + } + } + + if (i == 4) { + return FALSE; + } + + return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE; +} + + +boolean +util_format_is_supported(enum pipe_format format, unsigned bind) +{ + if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) { + return FALSE; + } + +#ifndef TEXTURE_FLOAT_ENABLED + if ((bind & PIPE_BIND_RENDER_TARGET) && + format != PIPE_FORMAT_R9G9B9E5_FLOAT && + format != PIPE_FORMAT_R11G11B10_FLOAT && + util_format_is_float(format)) { + return FALSE; + } +#endif + + return TRUE; +} void diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 7659a802a41..bb3ed72e932 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -473,6 +473,10 @@ util_format_colormask(const struct util_format_description *desc) } +boolean +util_format_is_float(enum pipe_format format); + + /** * Whether the src format can be blitted to destation format with a simple * memcpy. @@ -481,6 +485,12 @@ boolean util_is_format_compatible(const struct util_format_description *src_desc, const struct util_format_description *dst_desc); +/** + * Whether the format is supported by Gallium for the given bindings. + * This covers S3TC textures and floating-point render targets. + */ +boolean +util_format_is_supported(enum pipe_format format, unsigned bind); /** * Whether this format is a rgab8 variant. diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index e62b609eb5a..6f6a342791a 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -285,6 +285,9 @@ i915_is_format_supported(struct pipe_screen *screen, const enum pipe_format *list; uint i; + if (!util_format_is_supported(format, tex_usage)) + return FALSE; + if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 25204fd088d..5353ae23250 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -333,6 +333,9 @@ brw_is_format_supported(struct pipe_screen *screen, const enum pipe_format *list; uint i; + if (!util_format_is_supported(format, tex_usage)) + return FALSE; + if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 46622b4be76..e0eea3ed750 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -45,17 +45,8 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, if (sample_count > 1) return FALSE; - if (!util_format_s3tc_enabled) { - switch (format) { - case PIPE_FORMAT_DXT1_RGB: - case PIPE_FORMAT_DXT1_RGBA: - case PIPE_FORMAT_DXT3_RGBA: - case PIPE_FORMAT_DXT5_RGBA: - return FALSE; - default: - break; - } - } + if (!util_format_is_supported(format, bindings)) + return FALSE; switch (format) { case PIPE_FORMAT_Z16_UNORM: diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 31133f0cc6c..c4cdface502 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -39,17 +39,8 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen, if (sample_count > 1) return FALSE; - if (!util_format_s3tc_enabled) { - switch (format) { - case PIPE_FORMAT_DXT1_RGB: - case PIPE_FORMAT_DXT1_RGBA: - case PIPE_FORMAT_DXT3_RGBA: - case PIPE_FORMAT_DXT5_RGBA: - return FALSE; - default: - break; - } - } + if (!util_format_is_supported(format, bindings)) + return FALSE; /* transfers & shared are always supported */ bindings &= ~(PIPE_BIND_TRANSFER_READ | diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 0c8d33fb0aa..abbed9651ee 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -208,6 +208,9 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen, { struct nvfx_screen *screen = nvfx_screen(pscreen); + if (!util_format_is_supported(format, bind)) + return FALSE; + if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index e1f5a9fd221..acb7d9f02d2 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -334,6 +334,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, format == PIPE_FORMAT_R16G16B16_FLOAT || format == PIPE_FORMAT_R16G16B16A16_FLOAT; + if (!util_format_is_supported(format, usage)) + return FALSE; + /* Check multisampling support. */ switch (sample_count) { case 0: diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index b4d45f5eee0..afc1451183d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -741,25 +741,6 @@ static uint32_t r300_get_border_color(enum pipe_format format, return uc.ui; } -static boolean util_format_is_float(enum pipe_format format) -{ - const struct util_format_description *desc = util_format_description(format); - unsigned i; - - if (!format) - return FALSE; - - /* Find the first non-void channel. */ - for (i = 0; i < 4; i++) - if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) - break; - - if (i == 4) - return FALSE; - - return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE; -} - static void r300_merge_textures_and_samplers(struct r300_context* r300) { struct r300_textures_state *state = diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 5f95540a479..066768f9c38 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -523,6 +523,9 @@ static boolean r600_is_format_supported(struct pipe_screen* screen, return FALSE; } + if (!util_format_is_supported(format, usage)) + return FALSE; + /* Multisample */ if (sample_count > 1) return FALSE; -- cgit v1.2.3 From b5dfc38eea8a4b497574ca791452c11fa4163c8a Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Sat, 16 Apr 2011 22:15:52 +0200 Subject: gallium: include u_format.h for util_format_is_supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without it gcc complains: nv50_screen.c: In function ‘nv50_screen_is_format_supported’: nv50_screen.c:48: warning: implicit declaration of function ‘util_format_is_supported’ and handles it wrongly - util_format_is_supported returns boolean, which is typedef'ed to uchar, but function without prototype is assumed to return int. For me nv50_screen_is_format_supported was returning true for float formats without --enable-texture-float... --- src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/i965/brw_screen.c | 1 + src/gallium/drivers/nv50/nv50_screen.c | 1 + src/gallium/drivers/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/nvfx/nvfx_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + 6 files changed, 6 insertions(+) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 6f6a342791a..0f4327fdc81 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -27,6 +27,7 @@ #include "draw/draw_context.h" +#include "util/u_format.h" #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_string.h" diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 5353ae23250..9178dfa8f69 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -26,6 +26,7 @@ **************************************************************************/ +#include "util/u_format.h" #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_string.h" diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index e0eea3ed750..641ad7e2780 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -20,6 +20,7 @@ * SOFTWARE. */ +#include "util/u_format.h" #include "util/u_format_s3tc.h" #include "pipe/p_screen.h" diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index de62fd68b28..ca0691d2aee 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -20,6 +20,7 @@ * SOFTWARE. */ +#include "util/u_format.h" #include "util/u_format_s3tc.h" #include "pipe/p_screen.h" diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index abbed9651ee..ab063d6fe4e 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -1,5 +1,6 @@ #include "pipe/p_screen.h" #include "pipe/p_state.h" +#include "util/u_format.h" #include "util/u_format_s3tc.h" #include "util/u_simple_screen.h" diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 066768f9c38..1a581c791a3 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -30,6 +30,7 @@ #include #include #include +#include "util/u_format.h" #include #include #include -- cgit v1.2.3 From fc8e30edbcc802aac61a3562a3be42bb18b5dcd5 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 17 Apr 2011 01:57:13 +0200 Subject: r600g: disable ARB_draw_instanced The very presence of this extension breaks things. This should bring us closer to being able to run Unigine Heaven. The extension will be re-enabled once gl_InstanceID is implemented. --- src/gallium/drivers/r600/r600_pipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/r600/r600_pipe.c') diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 1a581c791a3..d0d380392a0 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -371,7 +371,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: case PIPE_CAP_DEPTH_CLAMP: case PIPE_CAP_SHADER_STENCIL_EXPORT: - case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 1; @@ -382,6 +381,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) else return 1; + case PIPE_CAP_TGSI_INSTANCEID: + return 0; + /* Unsupported features (boolean caps). */ case PIPE_CAP_STREAM_OUTPUT: case PIPE_CAP_PRIMITIVE_RESTART: -- cgit v1.2.3