summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c23
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c19
-rw-r--r--src/gallium/drivers/failover/fo_context.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_context.c55
-rw-r--r--src/gallium/drivers/i915simple/i915_screen.c48
-rw-r--r--src/gallium/drivers/i965simple/brw_context.c69
-rw-r--r--src/gallium/drivers/i965simple/brw_screen.c67
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c26
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c24
9 files changed, 159 insertions, 174 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index 351601473d..2301df5ba5 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -57,26 +57,6 @@
-static boolean
-cell_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format, uint type )
-{
- /*struct cell_context *cell = cell_context( pipe );*/
-
- switch (type) {
- case PIPE_TEXTURE:
- /* cell supports all texture formats, XXX for now anyway */
- return TRUE;
- case PIPE_SURFACE:
- /* cell supports all (off-screen) surface formats, XXX for now */
- return TRUE;
- default:
- assert(0);
- return FALSE;
- }
-}
-
-
static void
cell_destroy_context( struct pipe_context *pipe )
{
@@ -122,9 +102,6 @@ cell_create_context(struct pipe_screen *screen,
cell->pipe.screen = screen;
cell->pipe.destroy = cell_destroy_context;
- /* queries */
- cell->pipe.is_format_supported = cell_is_format_supported;
-
/* state setters */
cell->pipe.set_vertex_buffer = cell_set_vertex_buffer;
cell->pipe.set_vertex_element = cell_set_vertex_element;
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index 75255c0466..124670df25 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -112,6 +112,24 @@ cell_get_paramf(struct pipe_screen *screen, int param)
}
+static boolean
+cell_is_format_supported( struct pipe_screen *screen,
+ enum pipe_format format, uint type )
+{
+ switch (type) {
+ case PIPE_TEXTURE:
+ /* cell supports all texture formats, XXX for now anyway */
+ return TRUE;
+ case PIPE_SURFACE:
+ /* cell supports all (off-screen) surface formats, XXX for now */
+ return TRUE;
+ default:
+ assert(0);
+ return FALSE;
+ }
+}
+
+
static void
cell_destroy_screen( struct pipe_screen *screen )
{
@@ -140,6 +158,7 @@ cell_create_screen(struct pipe_winsys *winsys)
screen->get_vendor = cell_get_vendor;
screen->get_param = cell_get_param;
screen->get_paramf = cell_get_paramf;
+ screen->is_format_supported = cell_is_format_supported;
cell_init_screen_texture_funcs(screen);
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index d5e54f5d61..f559cc0d47 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -119,8 +119,8 @@ struct pipe_context *failover_create( struct pipe_context *hw,
failover->pipe.winsys = hw->winsys;
failover->pipe.screen = hw->screen;
failover->pipe.destroy = failover_destroy;
- failover->pipe.is_format_supported = hw->is_format_supported;
#if 0
+ failover->pipe.is_format_supported = hw->is_format_supported;
failover->pipe.get_name = hw->get_name;
failover->pipe.get_vendor = hw->get_vendor;
failover->pipe.get_param = hw->get_param;
diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c
index 42355552de..15ff2360b7 100644
--- a/src/gallium/drivers/i915simple/i915_context.c
+++ b/src/gallium/drivers/i915simple/i915_context.c
@@ -39,58 +39,6 @@
#include "pipe/p_screen.h"
-/**
- * Query format support for creating a texture, drawing surface, etc.
- * \param format the format to test
- * \param type one of PIPE_TEXTURE, PIPE_SURFACE
- */
-static boolean
-i915_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format, uint type )
-{
- static const enum pipe_format tex_supported[] = {
- PIPE_FORMAT_R8G8B8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_U_L8,
- PIPE_FORMAT_U_A8,
- PIPE_FORMAT_U_I8,
- PIPE_FORMAT_U_A8_L8,
- PIPE_FORMAT_YCBCR,
- PIPE_FORMAT_YCBCR_REV,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_NONE /* list terminator */
- };
- static const enum pipe_format surface_supported[] = {
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_R5G6B5_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- /*PIPE_FORMAT_R16G16B16A16_SNORM,*/
- PIPE_FORMAT_NONE /* list terminator */
- };
- const enum pipe_format *list;
- uint i;
-
- switch (type) {
- case PIPE_TEXTURE:
- list = tex_supported;
- break;
- case PIPE_SURFACE:
- list = surface_supported;
- break;
- default:
- assert(0);
- }
-
- for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {
- if (list[i] == format)
- return TRUE;
- }
-
- return FALSE;
-}
-
-
static void i915_destroy( struct pipe_context *pipe )
{
struct i915_context *i915 = i915_context( pipe );
@@ -101,8 +49,6 @@ static void i915_destroy( struct pipe_context *pipe )
}
-
-
static boolean
i915_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
@@ -188,7 +134,6 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen,
i915->pipe.screen = screen;
i915->pipe.destroy = i915_destroy;
- i915->pipe.is_format_supported = i915_is_format_supported;
i915->pipe.clear = i915_clear;
diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c
index b9b4d6b6fa..8d7bf0b33e 100644
--- a/src/gallium/drivers/i915simple/i915_screen.c
+++ b/src/gallium/drivers/i915simple/i915_screen.c
@@ -145,6 +145,53 @@ i915_get_paramf(struct pipe_screen *screen, int param)
}
+static boolean
+i915_is_format_supported( struct pipe_screen *screen,
+ enum pipe_format format, uint type )
+{
+ static const enum pipe_format tex_supported[] = {
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM,
+ PIPE_FORMAT_U_L8,
+ PIPE_FORMAT_U_A8,
+ PIPE_FORMAT_U_I8,
+ PIPE_FORMAT_U_A8_L8,
+ PIPE_FORMAT_YCBCR,
+ PIPE_FORMAT_YCBCR_REV,
+ PIPE_FORMAT_S8Z24_UNORM,
+ PIPE_FORMAT_NONE /* list terminator */
+ };
+ static const enum pipe_format surface_supported[] = {
+ PIPE_FORMAT_A8R8G8B8_UNORM,
+ PIPE_FORMAT_R5G6B5_UNORM,
+ PIPE_FORMAT_S8Z24_UNORM,
+ /*PIPE_FORMAT_R16G16B16A16_SNORM,*/
+ PIPE_FORMAT_NONE /* list terminator */
+ };
+ const enum pipe_format *list;
+ uint i;
+
+ switch (type) {
+ case PIPE_TEXTURE:
+ list = tex_supported;
+ break;
+ case PIPE_SURFACE:
+ list = surface_supported;
+ break;
+ default:
+ assert(0);
+ }
+
+ for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {
+ if (list[i] == format)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
static void
i915_destroy_screen( struct pipe_screen *screen )
{
@@ -195,6 +242,7 @@ i915_create_screen(struct pipe_winsys *winsys, uint pci_id)
i915screen->screen.get_vendor = i915_get_vendor;
i915screen->screen.get_param = i915_get_param;
i915screen->screen.get_paramf = i915_get_paramf;
+ i915screen->screen.is_format_supported = i915_is_format_supported;
i915_init_screen_texture_functions(&i915screen->screen);
diff --git a/src/gallium/drivers/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c
index e0a4037286..7c908da672 100644
--- a/src/gallium/drivers/i965simple/brw_context.c
+++ b/src/gallium/drivers/i965simple/brw_context.c
@@ -71,74 +71,6 @@ static void brw_clear(struct pipe_context *pipe, struct pipe_surface *ps,
}
-static boolean
-brw_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format, uint type )
-{
-#if 0
- /* XXX: This is broken -- rewrite if still needed. */
- static const unsigned tex_supported[] = {
- PIPE_FORMAT_U_R8_G8_B8_A8,
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_R5_G6_B5,
- PIPE_FORMAT_U_L8,
- PIPE_FORMAT_U_A8,
- PIPE_FORMAT_U_I8,
- PIPE_FORMAT_U_L8_A8,
- PIPE_FORMAT_YCBCR,
- PIPE_FORMAT_YCBCR_REV,
- PIPE_FORMAT_S8_Z24,
- };
-
-
- /* Actually a lot more than this - add later:
- */
- static const unsigned render_supported[] = {
- PIPE_FORMAT_U_A8_R8_G8_B8,
- PIPE_FORMAT_U_R5_G6_B5,
- };
-
- /*
- */
- static const unsigned z_stencil_supported[] = {
- PIPE_FORMAT_U_Z16,
- PIPE_FORMAT_U_Z32,
- PIPE_FORMAT_S8_Z24,
- };
-
- switch (type) {
- case PIPE_RENDER_FORMAT:
- *numFormats = Elements(render_supported);
- return render_supported;
-
- case PIPE_TEX_FORMAT:
- *numFormats = Elements(tex_supported);
- return render_supported;
-
- case PIPE_Z_STENCIL_FORMAT:
- *numFormats = Elements(render_supported);
- return render_supported;
-
- default:
- *numFormats = 0;
- return NULL;
- }
-#else
- switch (format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_R5G6B5_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- return TRUE;
- default:
- return FALSE;
- };
- return FALSE;
-#endif
-}
-
-
-
-
struct pipe_context *brw_create(struct pipe_screen *screen,
struct brw_winsys *brw_winsys,
unsigned pci_id)
@@ -158,7 +90,6 @@ struct pipe_context *brw_create(struct pipe_screen *screen,
brw->pipe.screen = screen;
brw->pipe.destroy = brw_destroy;
- brw->pipe.is_format_supported = brw_is_format_supported;
brw->pipe.clear = brw_clear;
brw_init_surface_functions(brw);
diff --git a/src/gallium/drivers/i965simple/brw_screen.c b/src/gallium/drivers/i965simple/brw_screen.c
index 7afe070bd8..5be369fe52 100644
--- a/src/gallium/drivers/i965simple/brw_screen.c
+++ b/src/gallium/drivers/i965simple/brw_screen.c
@@ -133,6 +133,72 @@ brw_get_paramf(struct pipe_screen *screen, int param)
}
+static boolean
+brw_is_format_supported( struct pipe_screen *screen,
+ enum pipe_format format, uint type )
+{
+#if 0
+ /* XXX: This is broken -- rewrite if still needed. */
+ static const unsigned tex_supported[] = {
+ PIPE_FORMAT_U_R8_G8_B8_A8,
+ PIPE_FORMAT_U_A8_R8_G8_B8,
+ PIPE_FORMAT_U_R5_G6_B5,
+ PIPE_FORMAT_U_L8,
+ PIPE_FORMAT_U_A8,
+ PIPE_FORMAT_U_I8,
+ PIPE_FORMAT_U_L8_A8,
+ PIPE_FORMAT_YCBCR,
+ PIPE_FORMAT_YCBCR_REV,
+ PIPE_FORMAT_S8_Z24,
+ };
+
+
+ /* Actually a lot more than this - add later:
+ */
+ static const unsigned render_supported[] = {
+ PIPE_FORMAT_U_A8_R8_G8_B8,
+ PIPE_FORMAT_U_R5_G6_B5,
+ };
+
+ /*
+ */
+ static const unsigned z_stencil_supported[] = {
+ PIPE_FORMAT_U_Z16,
+ PIPE_FORMAT_U_Z32,
+ PIPE_FORMAT_S8_Z24,
+ };
+
+ switch (type) {
+ case PIPE_RENDER_FORMAT:
+ *numFormats = Elements(render_supported);
+ return render_supported;
+
+ case PIPE_TEX_FORMAT:
+ *numFormats = Elements(tex_supported);
+ return render_supported;
+
+ case PIPE_Z_STENCIL_FORMAT:
+ *numFormats = Elements(render_supported);
+ return render_supported;
+
+ default:
+ *numFormats = 0;
+ return NULL;
+ }
+#else
+ switch (format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
+ return TRUE;
+ default:
+ return FALSE;
+ };
+ return FALSE;
+#endif
+}
+
+
static void
brw_destroy_screen( struct pipe_screen *screen )
{
@@ -161,6 +227,7 @@ brw_create_screen(struct pipe_winsys *winsys, uint pci_id)
brwscreen->screen.get_vendor = brw_get_vendor;
brwscreen->screen.get_param = brw_get_param;
brwscreen->screen.get_paramf = brw_get_paramf;
+ brwscreen->screen.is_format_supported = brw_is_format_supported;
brw_init_screen_texture_funcs(&brwscreen->screen);
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 6a88c277aa..fa16ed94e8 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -48,29 +48,6 @@
/**
- * Query format support for creating a texture, drawing surface, etc.
- * \param format the format to test
- * \param type one of PIPE_TEXTURE, PIPE_SURFACE
- */
-static boolean
-softpipe_is_format_supported( struct pipe_context *pipe,
- enum pipe_format format, uint type )
-{
- switch (type) {
- case PIPE_TEXTURE:
- /* softpipe supports all texture formats */
- return TRUE;
- case PIPE_SURFACE:
- /* softpipe supports all (off-screen) surface formats */
- return TRUE;
- default:
- assert(0);
- return FALSE;
- }
-}
-
-
-/**
* Map any drawing surfaces which aren't already mapped
*/
void
@@ -163,9 +140,6 @@ softpipe_create( struct pipe_screen *screen,
softpipe->pipe.screen = screen;
softpipe->pipe.destroy = softpipe_destroy;
- /* queries */
- softpipe->pipe.is_format_supported = softpipe_is_format_supported;
-
/* state setters */
softpipe->pipe.create_blend_state = softpipe_create_blend_state;
softpipe->pipe.bind_blend_state = softpipe_bind_blend_state;
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index cc3b962580..1850a1ced3 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -107,6 +107,29 @@ softpipe_get_paramf(struct pipe_screen *screen, int param)
}
+/**
+ * Query format support for creating a texture, drawing surface, etc.
+ * \param format the format to test
+ * \param type one of PIPE_TEXTURE, PIPE_SURFACE
+ */
+static boolean
+softpipe_is_format_supported( struct pipe_screen *screen,
+ enum pipe_format format, uint type )
+{
+ switch (type) {
+ case PIPE_TEXTURE:
+ /* softpipe supports all texture formats */
+ return TRUE;
+ case PIPE_SURFACE:
+ /* softpipe supports all (off-screen) surface formats */
+ return TRUE;
+ default:
+ assert(0);
+ return FALSE;
+ }
+}
+
+
static void
softpipe_destroy_screen( struct pipe_screen *screen )
{
@@ -134,6 +157,7 @@ softpipe_create_screen(struct pipe_winsys *winsys)
screen->get_vendor = softpipe_get_vendor;
screen->get_param = softpipe_get_param;
screen->get_paramf = softpipe_get_paramf;
+ screen->is_format_supported = softpipe_is_format_supported;
softpipe_init_screen_texture_funcs(screen);