Mesa (master): nouveau: nv30: Hack to enforce same number of bits as front buffer, for render targets
Patrice Mandin
pmandin at kemper.freedesktop.org
Thu Oct 15 20:41:24 UTC 2009
Module: Mesa
Branch: master
Commit: a5a05fd782bf7bc3843e475df7b12fe6784c1b9e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a5a05fd782bf7bc3843e475df7b12fe6784c1b9e
Author: Patrice Mandin <patmandin at gmail.com>
Date: Thu Oct 15 22:41:09 2009 +0200
nouveau: nv30: Hack to enforce same number of bits as front buffer, for render targets
---
src/gallium/drivers/nv30/nv30_screen.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 41af384..5b1e5ca 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -10,6 +10,22 @@
#define NV34TCL_CHIPSET_3X_MASK 0x00000010
#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
+/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h
+ * to get the pointer to the context front buffer, so I copied nouveau_winsys here.
+ * nv30_screen_surface_format_supported() can then use it to enforce creating fbo
+ * with same number of bits everywhere.
+ */
+struct nouveau_winsys {
+ struct pipe_winsys base;
+
+ struct pipe_screen *pscreen;
+
+ unsigned nr_pctx;
+ struct pipe_context **pctx;
+
+ struct pipe_surface *front;
+};
+
static int
nv30_screen_get_param(struct pipe_screen *pscreen, int param)
{
@@ -83,21 +99,19 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
enum pipe_texture_target target,
unsigned tex_usage, unsigned geom_flags)
{
+ struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
+
if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- switch (format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_R5G6B5_UNORM:
- return TRUE;
- default:
- break;
- }
+ return (format == front->format);
} else
if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
switch (format) {
case PIPE_FORMAT_Z24S8_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
+ return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM)
+ || (front->format == PIPE_FORMAT_A8R8G8B8_UNORM);
case PIPE_FORMAT_Z16_UNORM:
- return TRUE;
+ return (front->format == PIPE_FORMAT_R5G6B5_UNORM);
default:
break;
}
More information about the mesa-commit
mailing list