summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mueller <MarkKMueller@gmail.com>2013-12-12 17:45:22 -0800
committerMark Mueller <MarkKMueller@gmail.com>2014-01-13 09:46:00 -0800
commit2b5d7076da23addfbcb425d1a8a060fbca21908f (patch)
treea71db7d07d5f7c221a6e937617cb46e59988226d
parentc52be03c9255991b6015902a73bb854e0a027628 (diff)
Piglit fixes for non-linear color formats; formats with samplers that
return raw pixel data; and lower precision internal formats. Cleaned up Mesa formats based on Mesa Dev feedback.
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.cpp24
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp166
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_clear.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_surface_formats.c161
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c11
-rw-r--r--src/mesa/drivers/dri/i965/gen6_blorp.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/gen7_wm_surface_state.c14
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c93
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h2
-rw-r--r--src/mesa/main/formats.c83
-rw-r--r--src/mesa/main/formats.h13
-rw-r--r--src/mesa/main/glformats.c162
-rw-r--r--src/mesa/main/glformats.h3
-rw-r--r--src/mesa/main/texformat.c17
-rw-r--r--src/mesa/main/teximage.c4
17 files changed, 388 insertions, 382 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index adeb058da2..1abeddc361 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -78,35 +78,31 @@ void
brw_blorp_surface_info::set(struct brw_context *brw,
struct intel_mipmap_tree *mt,
unsigned int level, unsigned int layer,
- bool is_render_target)
+ bool is_render_target,
+ bool sRGB_en)
{
brw_blorp_mip_info::set(mt, level, layer);
this->num_samples = mt->num_samples;
this->array_spacing_lod0 = mt->array_spacing_lod0;
- /* The miptree is a W-tiled stencil buffer. Surface states can't be set
- * up for W tiling, so we'll need to use Y tiling and have the WM
- * program swizzle the coordinates.
- */
- this->map_stencil_as_y_tiled = mt->format == MESA_FORMAT_S8;
this->msaa_layout = mt->msaa_layout;
- const gl_format linear_format = _mesa_get_srgb_format_linear(mt->format);
+ const GLenum sRGB_sel = !sRGB_en ? GL_SKIP_DECODE_EXT : 0;
BRW_SURFACE render_surfaceformat;
BRW_SURFACE sample_surfaceformat;
- brw_format_for_mesa_format(linear_format, &this->process_format_flags, &render_surfaceformat, &sample_surfaceformat);
+ translate_tex_format(brw, mt->format, sRGB_sel, &this->process_format_flags, &render_surfaceformat, &sample_surfaceformat);
if (is_render_target || depth_format & this->process_format_flags) {
+ /* The miptree is a W-tiled stencil buffer. Surface states can't be set
+ * up for W tiling, so we'll need to use Y tiling and have the WM
+ * program swizzle the coordinates.
+ */
+ this->map_stencil_as_y_tiled = mt->format == MESA_FORMAT_S8;
+
/* set up for a render target */
this->brw_surfaceformat = render_surfaceformat;
-
- _mesa_debug(&brw->ctx, "%s: using render format: 0x%x for %s\n",
- __FUNCTION__, this->brw_surfaceformat, _mesa_get_format_name(mt->format));
} else {
/* set up for a sample target */
this->brw_surfaceformat = sample_surfaceformat;
-
- _mesa_debug(&brw->ctx, "%s: using sample format: 0x%x for %s\n",
- __FUNCTION__, this->brw_surfaceformat, _mesa_get_format_name(mt->format));
}
#if 0
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index bc45c56347..3d0ba1854b 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -128,7 +128,7 @@ public:
void set(struct brw_context *brw,
struct intel_mipmap_tree *mt,
unsigned int level, unsigned int layer,
- bool is_render_target);
+ bool is_render_target, bool sRGB_en);
uint32_t compute_tile_offsets(uint32_t *tile_x, uint32_t *tile_y) const;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 11515cb118..51040f61a1 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -356,63 +356,73 @@ brw_blorp_GPUcopytexsubimage(struct brw_context *brw,
GLint dstX0, GLint dstY0,
GLint width, GLint height)
{
- /* BLORP is not supported before Gen6. */
- if (brw->gen < 6) {
- DBG("%s: Older Gen not supported.\n", __FUNCTION__);
- return false;
- }
-
- if (
- dst_image->Width < 16) {
- _mesa_debug(&brw->ctx, "%s: Blorp Path requires a minimum 16 wide texture.\n", __FUNCTION__);
- return false;
- }
-
if (!brw->has_llc ||
packing->Alignment > 4 ||
packing->SkipPixels > 0 ||
packing->SkipRows > 0 ||
(packing->RowLength != 0 && packing->RowLength != width) ||
+ packing->SwapBytes ||
packing->LsbFirst ||
packing->Invert ||
dst_image->Height == 0 ||
+ dst_image->Width == 0 ||
dst_image->Depth == 0) {
_mesa_debug(&brw->ctx, "%s: unsupported parameter\n", __FUNCTION__);
return false;
}
- if (0 != srcX0 || 0 != srcY0 || 0 != dstX0 || 0 != dstY0) {
- DBG("%s: Sub image loads not currently supported\n", __FUNCTION__);
+ if (!brw->ctx.Driver.AllocTextureImageBuffer(&brw->ctx, dst_image)) {
+ DBG("%s: AllocTextureImageBuffer failed\n", __FUNCTION__);
+ return false;
+ }
+
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
+ const GLvoid *src =
+ _mesa_validate_pbo_teximage(&brw->ctx, dims, width, height, 1,
+ format, type, src_pixels, packing, "glTexImage");
+
+ if (!src) {
+ return true;
+ }
+
+ /* BLORP is not supported before Gen6. */
+ if (brw->gen < 6) {
+ DBG("%s: Older Gen not supported.\n", __FUNCTION__);
return false;
- }
+ }
+
+ if (dst_image->Width % 16) {
+ _mesa_debug(&brw->ctx, "%s: Blorp Path currently requires texture widths to be on 16 pixel boundry.\n", __FUNCTION__);
+ return false;
+ }
- if (!brw->ctx.Driver.AllocTextureImageBuffer(&brw->ctx, dst_image)) {
- DBG("%s: AllocTextureImageBuffer failed\n", __FUNCTION__);
+ if (0 != srcX0 || 0 != srcY0 || 0 != dstX0 || 0 != dstY0) {
+ _mesa_debug(&brw->ctx, "%s: Sub image loads not currently supported\n", __FUNCTION__);
return false;
}
- /* get pointer to src pixels (may be in a pbo which we'll map here) */
- const GLvoid *src =
- _mesa_validate_pbo_teximage(&brw->ctx, dims, width, height, 1,
- format, type, src_pixels, packing, "glTexImage");
-
- if (!src) {
- return true;
+ if (0 != dst_image->Level) {
+ _mesa_debug(&brw->ctx, "%s: Non-base levels not currently supported\n", __FUNCTION__);
+ return false;
}
/* Come up with a match to the source format for the texture cache */
gl_format cacheTexFormat = _mesa_choose_cached_tex_format(&brw->ctx, format, type);
_mesa_debug(&brw->ctx, "%s: Cache Texture Format: %s, Target Format: %s, Internal Format: %s"
- " Base Internal Format: %s\n",
+ " Packing Alignment: %d\n",
__FUNCTION__, _mesa_get_format_name(cacheTexFormat), _mesa_get_format_name(dst_image->TexFormat),
- _mesa_lookup_enum_by_nr(dst_image->InternalFormat), _mesa_lookup_enum_by_nr(dst_image->_BaseFormat));
+ _mesa_lookup_enum_by_nr(dst_image->InternalFormat), packing->Alignment);
if (!brw_blorp_blit_params::test_formats(brw, cacheTexFormat, dst_image->TexFormat,
dst_image->InternalFormat, dst_image->_BaseFormat)) {
return false;
}
+ if (packing->Alignment > _mesa_get_format_bytes(cacheTexFormat)) {
+ _mesa_debug(&brw->ctx, "%s: Alignment exceeds pixel size, which is not yet supported.\n", __FUNCTION__);
+ }
+
struct intel_mipmap_tree *src_mt =
intel_miptree_create_for_client_texture_DMA(brw, dst_image->TexObject->Target,
format, cacheTexFormat, type, dst_image->Level, src,
@@ -427,8 +437,6 @@ brw_blorp_GPUcopytexsubimage(struct brw_context *brw,
struct intel_mipmap_tree *dst_mt = intel_texture_image(dst_image)->mt;
- GLuint numSlices = 1;
- GLint depth = 1;
/* compute slice info (and do some sanity checks) */
switch (dst_image->TexObject->Target) {
case GL_TEXTURE_2D:
@@ -437,35 +445,14 @@ brw_blorp_GPUcopytexsubimage(struct brw_context *brw,
/* one image slice, nothing special needs to be done */
break;
case GL_TEXTURE_1D:
- DBG("%s: GL_TEXTURE_1D not yet supported\n", __FUNCTION__);
- return false;
- break;
case GL_TEXTURE_1D_ARRAY:
- DBG("%s: GL_TEXTURE_1D_ARRAY not yet supported\n", __FUNCTION__);
- return false;
- numSlices = height;
- height = 1;
- dstY0 = 0;
- break;
case GL_TEXTURE_2D_ARRAY:
- DBG("%s: GL_TEXTURE_2D_ARRAY not yet supported\n", __FUNCTION__);
- return false;
- numSlices = depth;
- depth = 1;
- break;
case GL_TEXTURE_3D:
- DBG("%s: GL_TEXTURE_3D not yet supported\n", __FUNCTION__);
- return false;
- /* we'll store 3D images as a series of slices */
- numSlices = depth;
- break;
case GL_TEXTURE_CUBE_MAP_ARRAY:
- DBG("%s: GL_TEXTURE_CUBE_MAP_ARRAY not yet supported\n", __FUNCTION__);
+ _mesa_debug(&brw->ctx, "Target 0x%x not supported()", dst_image->TexObject->Target);
return false;
- numSlices = depth;
- break;
default:
- _mesa_debug(&brw->ctx, "Unexpected target 0x%x in store_texsubimage()", dst_image->TexObject->Target);
+ _mesa_debug(&brw->ctx, "Unexpected target 0x%x in %s", dst_image->TexObject->Target, __FUNCTION__);
}
/* Source clipping shouldn't be necessary, since copytexsubimage (in
@@ -495,19 +482,15 @@ brw_blorp_GPUcopytexsubimage(struct brw_context *brw,
mirror_y = true;
}
-
- for (slice = 0; slice < numSlices; slice++) {
- if (false == brw_blorp_blit_miptrees(brw,
- src_mt, dst_image->Level, dst_image->Face + slice,
- dst_mt, dst_image->Level, dst_image->Face + slice,
- srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1,
- GL_NEAREST, false, mirror_y)) {
- _mesa_debug(&brw->ctx, "brw_blorp_blit_miptrees failed.\n");
- intel_miptree_release(&src_mt);
- return false;
- }
-
+ if (false == brw_blorp_blit_miptrees(brw,
+ src_mt, 0, 0,
+ dst_mt, dst_image->Level, dst_image->Face + slice,
+ srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1,
+ GL_NEAREST, false, mirror_y)) {
+ _mesa_debug(&brw->ctx, "brw_blorp_blit_miptrees failed.\n");
+ intel_miptree_release(&src_mt);
+ return false;
}
intel_miptree_release(&src_mt);
@@ -1082,6 +1065,7 @@ brw_blorp_blit_program::compile(struct brw_context *brw,
printf("Native code for BLORP blit:\n");
brw_dump_compile(&func, dump_file, 0, func.next_insn_offset);
printf("\n");
+ fflush(stdout);
}
return brw_get_program(&func, program_size);
}
@@ -2262,10 +2246,9 @@ bool
brw_blorp_blit_params::compare_source_to_target(struct brw_context *brw,
GLenum baseSourceFormat,
GLenum baseDestinationFormat) {
- if (baseSourceFormat == baseDestinationFormat) {
+ if (baseDestinationFormat == baseSourceFormat) {
return true;
}
-
bool testPassed = false;
switch (baseSourceFormat) {
case GL_RED:
@@ -2348,7 +2331,8 @@ brw_blorp_blit_params::test_formats(struct brw_context *brw,
/* blorp lies about some formats to placate the GPU. */
blorp_process_format src_format_process_flags;
BRW_SURFACE sample_format;
- translate_tex_format(brw, src_format, 0, &src_format_process_flags, 0, &sample_format);
+ const GLenum sRGB_en = !brw->ctx.Color.sRGBEnabled ? GL_SKIP_DECODE_EXT : 0;
+ translate_tex_format(brw, src_format, sRGB_en, &src_format_process_flags, 0, &sample_format);
if (src_format_process_flags & sample_not_supported_mask) {
_mesa_debug(ctx, "%s: compatible brw_surface format not found for source "
"texture mip tree. Source: %s\n",
@@ -2363,7 +2347,7 @@ brw_blorp_blit_params::test_formats(struct brw_context *brw,
blorp_process_format dst_format_process_flags;
BRW_SURFACE render_format;
- translate_tex_format(brw, dst_format, 0, &dst_format_process_flags, &render_format, 0);
+ translate_tex_format(brw, dst_format, sRGB_en, &dst_format_process_flags, &render_format, 0);
if (!brw_format_for_render(brw, render_format) ||
(dst_format_process_flags & render_not_supported_mask)) {
_mesa_debug(ctx, "%s: The translated target miptree format is not supported as a render target: %s: 0x%x.\n",
@@ -2371,6 +2355,28 @@ brw_blorp_blit_params::test_formats(struct brw_context *brw,
return false;
}
+ // Revisit
+ GLenum dst_format_encoding = _mesa_get_format_color_encoding(dst_format);
+ if (GL_SRGB == dst_format_encoding && dst_format != src_format) {
+ /*
+ * There is a piglit test that uses an SRGBA internal format and reads the
+ * texture back in an SRGBA format, which fails. Other uses are fine.
+ */
+ _mesa_debug(ctx, "%s: SRGB target from non SRGB sample format BLTs aren't yet supported.\n",
+ __FUNCTION__);
+ return false;
+ }
+
+ const bool raw_dst = raw_sample & dst_format_process_flags;
+ const bool raw_src = raw_sample & src_format_process_flags;
+ if (raw_dst || raw_src && dst_format != src_format) {
+ _mesa_debug(ctx, "%s: Blorp doesn't yet convert from or to raw formats"
+ " dst: %s: src: %s.\n",
+ __FUNCTION__, _mesa_get_format_name(dst_format),
+ _mesa_get_format_name(src_format));
+ return false;
+ }
+
if ((alpha_blend_render & src_format_process_flags) ||
(alpha_blend_render & dst_format_process_flags)) {
gl_format linear_src_format = _mesa_get_srgb_format_linear(src_format);
@@ -2398,15 +2404,21 @@ brw_blorp_blit_params::test_formats(struct brw_context *brw,
return false;
}
- if (0 != internal_format ||
- (_mesa_sizeof_packed_type(internal_format) < _mesa_get_format_bytes(dst_format) &&
- _mesa_sizeof_packed_type(internal_format) >_mesa_get_format_bytes(src_format))) {
- _mesa_debug(ctx, "%s: The internal format: %s is smaller then target format %s, and larger"
- "the the source: %s\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr(internal_format), _mesa_get_format_name(dst_format),
+ if (0 == internal_format) {
+ return true;
+ }
+
+ const GLint internal_format_bits = _mesa_get_internalformat_bits(internal_format);
+ if (internal_format_bits < (_mesa_get_format_bytes(dst_format) * 8) &&
+ internal_format_bits > (_mesa_get_format_bytes(src_format) * 8)) {
+ _mesa_debug(ctx, "%s: The internal format: %s, %d - is smaller then target format %s, and larger "
+ "than the source: %s\n",
+ __FUNCTION__, _mesa_lookup_enum_by_nr(internal_format),
+ internal_format_bits, _mesa_get_format_name(dst_format),
_mesa_get_format_name(src_format));
- return false;
+ return false;
}
+ return true;
}
brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
@@ -2424,8 +2436,8 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
struct gl_context *ctx = &brw->ctx;
const struct gl_framebuffer *read_fb = ctx->ReadBuffer;
- src.set(brw, src_mt, src_level, src_layer, false);
- dst.set(brw, dst_mt, dst_level, dst_layer, true);
+ src.set(brw, src_mt, src_level, src_layer, false, brw->ctx.Color.sRGBEnabled);
+ dst.set(brw, dst_mt, dst_level, dst_layer, true, brw->ctx.Color.sRGBEnabled);
/* Even though we do multisample resolves at the time of the blit, OpenGL
* specification defines them as if they happen at the time of rendering,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index f406394a08..5ec769bcfe 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -190,14 +190,14 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
struct gl_context *ctx = &brw->ctx;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- dst.set(brw, irb->mt, irb->mt_level, layer, true);
+ dst.set(brw, irb->mt, irb->mt_level, irb->mt_layer, true, brw->ctx.Color.sRGBEnabled);
/* Override the surface format according to the context's sRGB rules. */
gl_format format = _mesa_get_render_format(ctx, irb->mt->format);
- blorp_process_format process_format_flags;
- brw_format_for_mesa_format(format, &process_format_flags, &dst.brw_surfaceformat, 0);
- _mesa_debug(&brw->ctx, "%s: using render format: 0x%x for %s\n",
- __FUNCTION__, dst.brw_surfaceformat, _mesa_get_format_name(format));
+// blorp_process_format process_format_flags;
+// brw_format_for_mesa_format(format, &process_format_flags, &dst.brw_surfaceformat, 0);
+// _mesa_debug(&brw->ctx, "%s: using render format: 0x%x for %s\n",
+// __FUNCTION__, dst.brw_surfaceformat, _mesa_get_format_name(format));
x0 = fb->_Xmin;
x1 = fb->_Xmax;
@@ -364,7 +364,7 @@ brw_blorp_rt_resolve_params::brw_blorp_rt_resolve_params(
struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
- dst.set(brw, mt, 0 /* level */, 0 /* layer */, true);
+ dst.set(brw, mt, 0 /* level */, 0 /* layer */, true, false);
/* From the Ivy Bridge PRM, Vol2 Part1 11.9 "Render Target Resolve":
*
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index ecab97c255..bf4d650dc3 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -206,6 +206,7 @@ typedef enum {
render_swizzle_w = 1 << 15,
depth_format = 1 << 16,
+ raw_sample = 1 << 17,
scale_mask = scale_x | scale_y | scale_z | scale_w,
scale_xy = scale_x | scale_y,
diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
index 089e304e7b..f96a982954 100644
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
@@ -354,91 +354,91 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
{
[MESA_FORMAT_RGBA8888] = {BRW_SURFACEFORMAT_NONE, /* shadow render target */
BRW_SURFACEFORMAT_R8G8B8A8_UNORM, /* shadow sample target */
- sample_swizzle_all}, /* gl_format to brw surface processing */
+ raw_sample | sample_swizzle_all}, /* gl_format to brw surface processing */
[MESA_FORMAT_RGBA8888_REV] = {BRW_SURFACEFORMAT_R8G8B8A8_UNORM,
BRW_SURFACEFORMAT_R8G8B8A8_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_ARGB8888] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_ARGB8888_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_RGBX8888] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_RGBX8888_REV] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
- alpha_blend_render},
+ raw_sample | alpha_blend_render},
[MESA_FORMAT_XRGB8888] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
- alpha_blend_render},
+ raw_sample | alpha_blend_render},
[MESA_FORMAT_XRGB8888_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_RGB888] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_UNORM,
- sample_scale},
+ raw_sample | sample_scale},
[MESA_FORMAT_BGR888] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_UNORM,
- sample_scale},
+ raw_sample | sample_scale},
[MESA_FORMAT_RGB565] = {BRW_SURFACEFORMAT_B5G6R5_UNORM,
BRW_SURFACEFORMAT_B5G6R5_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_RGB565_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B5G6R5_UNORM,
- sample_swizzle_xyz},
+ raw_sample | sample_swizzle_xyz},
[MESA_FORMAT_ARGB4444] = {BRW_SURFACEFORMAT_B4G4R4A4_UNORM,
BRW_SURFACEFORMAT_B4G4R4A4_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_ARGB4444_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B4G4R4A4_UNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_RGBA5551] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B5G5R5A1_UNORM,
sample_swizzle_all},
[MESA_FORMAT_ARGB1555] = {BRW_SURFACEFORMAT_B5G5R5A1_UNORM,
BRW_SURFACEFORMAT_B5G5R5A1_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_ARGB1555_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B5G5R5A1_UNORM,
- sample_swizzle_yzw},
+ raw_sample | sample_swizzle_yzw},
[MESA_FORMAT_AL44] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8_UNORM,
- scale_x},
+ raw_sample | scale_x},
[MESA_FORMAT_AL88] = {BRW_SURFACEFORMAT_R8G8_UNORM,
BRW_SURFACEFORMAT_L8A8_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_AL88_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8_UNORM,
- sample_swizzle_xy},
+ raw_sample | sample_swizzle_xy},
[MESA_FORMAT_AL1616] = {BRW_SURFACEFORMAT_R16G16_UNORM,
BRW_SURFACEFORMAT_L16A16_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_AL1616_REV] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16_UNORM,
- sample_swizzle_xy},
+ raw_sample | sample_swizzle_xy},
[MESA_FORMAT_RGB332] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_UNORM,
- scale_x},
+ raw_sample | scale_x},
[MESA_FORMAT_A8] = {BRW_SURFACEFORMAT_A8_UNORM,
BRW_SURFACEFORMAT_A8_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_A16] = {BRW_SURFACEFORMAT_R16_UNORM,
BRW_SURFACEFORMAT_A16_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_L8] = {BRW_SURFACEFORMAT_R8_UNORM,
BRW_SURFACEFORMAT_L8_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_L16] = {BRW_SURFACEFORMAT_R16_UNORM,
BRW_SURFACEFORMAT_L16_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_I8] = {BRW_SURFACEFORMAT_R8_UNORM,
BRW_SURFACEFORMAT_I8_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_I16] = {BRW_SURFACEFORMAT_R16_UNORM,
BRW_SURFACEFORMAT_I16_UNORM,
- blorp_shadow_shader},
+ raw_sample | blorp_shadow_shader},
[MESA_FORMAT_YCBCR_REV] = {BRW_SURFACEFORMAT_YCRCB_NORMAL,
BRW_SURFACEFORMAT_YCRCB_NORMAL,
0},
@@ -447,31 +447,31 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
0},
[MESA_FORMAT_R8] = {BRW_SURFACEFORMAT_R8_UNORM,
BRW_SURFACEFORMAT_R8_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_GR88] = {BRW_SURFACEFORMAT_R8G8_UNORM,
BRW_SURFACEFORMAT_R8G8_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_RG88] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8_UNORM,
- sample_swizzle_xy},
+ raw_sample | sample_swizzle_xy},
[MESA_FORMAT_R16] = {BRW_SURFACEFORMAT_R16_UNORM,
BRW_SURFACEFORMAT_R16_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_GR1616] = {BRW_SURFACEFORMAT_R16G16_UNORM,
BRW_SURFACEFORMAT_R16G16_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_RG1616] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16_UNORM,
- sample_swizzle_xy},
+ raw_sample | sample_swizzle_xy},
[MESA_FORMAT_ARGB2101010] = {BRW_SURFACEFORMAT_B10G10R10A2_UNORM,
BRW_SURFACEFORMAT_B10G10R10A2_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_Z24_S8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
- depth_format | sample_swizzle_all},
+ raw_sample | depth_format | sample_swizzle_all},
[MESA_FORMAT_S8_Z24] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
BRW_SURFACEFORMAT_I24X8_UNORM,
- depth_format},
+ raw_sample | depth_format},
/* It appears that Z16 is slower than Z24 (on Intel Ivybridge and newer
* hardware at least), so there's no real reason to prefer it unless you're
* under memory (not memory bandwidth) pressure. Our speculation is that
@@ -486,35 +486,35 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
*/
[MESA_FORMAT_Z16] = {BRW_SURFACEFORMAT_R16_UNORM,
BRW_SURFACEFORMAT_I16_UNORM,
- depth_format | desktop_gl_sel},
+ raw_sample | depth_format | desktop_gl_sel},
[MESA_FORMAT_X8_Z24] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
BRW_SURFACEFORMAT_I24X8_UNORM,
- depth_format},
+ raw_sample | depth_format},
[MESA_FORMAT_Z24_X8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_NONE,
- depth_format | sample_swizzle_all},
+ depth_format},
[MESA_FORMAT_Z32] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_NONE,
- depth_format | sample_swizzle_all},
+ depth_format},
[MESA_FORMAT_S8] = {BRW_SURFACEFORMAT_R8_UNORM,
BRW_SURFACEFORMAT_R8_UNORM,
depth_format},
[MESA_FORMAT_SRGB8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB,
- sample_swizzle_xyz},
+ raw_sample | sample_swizzle_xyz},
[MESA_FORMAT_SRGBA8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_SARGB8] = {BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
- BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
+ raw_sample | BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
0},
[MESA_FORMAT_SL8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_L8_UNORM_SRGB,
- 0},
+ raw_sample},
[MESA_FORMAT_SLA8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_L8A8_UNORM_SRGB,
- 0},
+ raw_sample},
[MESA_FORMAT_SRGB_DXT1] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_DXT1_RGB_SRGB,
0},
@@ -705,7 +705,7 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
[MESA_FORMAT_RGB_INT32] = {BRW_SURFACEFORMAT_R32G32B32_SINT,
BRW_SURFACEFORMAT_R32G32B32_SINT,
0},
- [MESA_FORMAT_RGBA_INT32] = {BRW_SURFACEFORMAT_R32G32B32A32_SINT, /* Though Render format support is shown, it fails piglit tests. */
+ [MESA_FORMAT_RGBA_INT32] = {BRW_SURFACEFORMAT_R32G32B32A32_SINT,
BRW_SURFACEFORMAT_R32G32B32A32_SINT,
0},
@@ -751,34 +751,34 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
0},
[MESA_FORMAT_SIGNED_R8] = {BRW_SURFACEFORMAT_R8_SNORM,
BRW_SURFACEFORMAT_R8_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_RG88_REV] = {BRW_SURFACEFORMAT_R8G8_SNORM,
BRW_SURFACEFORMAT_R8G8_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_RGBX8888] = {BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
- alpha_blend_render | sample_swizzle_all},
+ raw_sample | alpha_blend_render | sample_swizzle_all},
[MESA_FORMAT_SIGNED_RGBA8888] = {BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_SIGNED_RGBA8888_REV] = {BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_R16] = {BRW_SURFACEFORMAT_R16_SNORM,
BRW_SURFACEFORMAT_R16_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_GR1616] = {BRW_SURFACEFORMAT_R16G16_SNORM,
BRW_SURFACEFORMAT_R16G16_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_RGB_16] = {BRW_SURFACEFORMAT_NONE, /* This format requires converting SNORM to another format in blorp. */
BRW_SURFACEFORMAT_R16G16B16_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_SIGNED_RGBA_16] = {BRW_SURFACEFORMAT_R16G16B16A16_SNORM,
BRW_SURFACEFORMAT_R16G16B16A16_SNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_RGBA_16] = {BRW_SURFACEFORMAT_R16G16B16A16_UNORM,
BRW_SURFACEFORMAT_R16G16B16A16_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_RED_RGTC1] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_BC4_UNORM,
@@ -842,35 +842,35 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
[MESA_FORMAT_SIGNED_A8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_L8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_AL88] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_I8] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_A16] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16_SNORM,
sample_swizzle_x},
[MESA_FORMAT_SIGNED_L16] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_AL1616] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_SIGNED_I16] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16_SNORM,
- sample_swizzle_x},
+ raw_sample | sample_swizzle_x},
[MESA_FORMAT_RGB9_E5_FLOAT] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP,
0},
[MESA_FORMAT_R11_G11_B10_FLOAT] = {BRW_SURFACEFORMAT_R11G11B10_FLOAT,
BRW_SURFACEFORMAT_R11G11B10_FLOAT,
- 0},
+ raw_sample},
[MESA_FORMAT_Z32_FLOAT] = {BRW_SURFACEFORMAT_R32_FLOAT,
BRW_SURFACEFORMAT_I32_FLOAT,
@@ -881,38 +881,38 @@ brw_format_for_mesa_format(gl_format mesa_format, blorp_process_format *process_
[MESA_FORMAT_ARGB2101010_UINT] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B10G10R10A2_UINT,
- 0},
+ raw_sample},
[MESA_FORMAT_ABGR2101010_UINT] = {BRW_SURFACEFORMAT_R10G10B10A2_UINT,
BRW_SURFACEFORMAT_R10G10B10A2_UINT,
- 0},
+ raw_sample},
[MESA_FORMAT_XRGB4444_UNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8_UNORM,
- sample_swizzle_xy | scale_xy},
+ raw_sample | sample_swizzle_xy | scale_xy},
[MESA_FORMAT_XRGB1555_UNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B5G5R5X1_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_XBGR8888_SNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_XBGR8888_SRGB] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_XBGR8888_UINT] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8B8A8_UINT,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_XBGR8888_SINT] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R8G8B8A8_SINT,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_XRGB2101010_UNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_B10G10R10X2_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_XBGR16161616_UNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16B16X16_UNORM,
- 0},
+ raw_sample},
[MESA_FORMAT_XBGR16161616_SNORM] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16B16A16_SNORM,
- sample_swizzle_all},
+ raw_sample | sample_swizzle_all},
[MESA_FORMAT_XBGR16161616_FLOAT] = {BRW_SURFACEFORMAT_NONE,
BRW_SURFACEFORMAT_R16G16B16X16_FLOAT,
0},
@@ -1056,6 +1056,15 @@ translate_tex_format(struct brw_context *brw,
brw_format_for_mesa_format(mesa_format, process_flags,
render_surface, sample_surface);
+
+ if (render_surface) {
+ _mesa_debug(&brw->ctx, "%s: using render format: 0x%x for %s\n",
+ __FUNCTION__, *render_surface, _mesa_get_format_name(mesa_format));
+ }
+ if (sample_surface) {
+ _mesa_debug(&brw->ctx, "%s: using sample format: 0x%x for %s\n",
+ __FUNCTION__, *sample_surface, _mesa_get_format_name(mesa_format));
+ }
}
/** Can HiZ be enabled on a depthbuffer of the given format? */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 4fa05acbb2..0f64176d80 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -288,16 +288,7 @@ brw_update_texture_surface(struct gl_context *ctx,
blorp_process_format process_flags;
BRW_SURFACE brw_surface;
-// BRW_SURFACE *dst_format;
-// BRW_SURFACE *src_format;
-
-// if (!for_gather) {
-// dst_format = 0;
-// src_format = &brw_surface;
-// } else {
-// dst_format = &brw_surface;
-// src_format = 0;
-// }
+
translate_tex_format(brw,
mt->format,
sampler->sRGBDecode,
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 2e8e8ab4bb..9483a43b9d 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -272,6 +272,8 @@ gen6_blorp_emit_blend_state(struct brw_context *brw,
blend->blend0.dest_blend_factor = BRW_BLENDFACTOR_ZERO;
blend->blend0.ia_source_blend_factor = BRW_BLENDFACTOR_ONE;
blend->blend0.ia_dest_blend_factor = BRW_BLENDFACTOR_ZERO;
+
+ _mesa_debug(&brw->ctx, "%s forcing Alpha to 1.0", __FUNCTION__);
}
return cc_blend_state_offset;
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index 9dc7256fbf..eef243dd8a 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -291,23 +291,13 @@ gen7_update_texture_surface(struct gl_context *ctx,
blorp_process_format process_flags;
BRW_SURFACE tex_format;
- BRW_SURFACE *dst_format;
- BRW_SURFACE *src_format;
-
- if (!for_gather) {
- dst_format = 0;
- src_format = &tex_format;
- } else {
- dst_format = &tex_format;
- src_format = 0;
- }
translate_tex_format(brw,
mt->format,
sampler->sRGBDecode,
- &process_flags, dst_format, src_format);
+ &process_flags, 0, &tex_format);
- if (for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT && (depth_format & process_flags)) {
+ if (for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT) {
tex_format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
}
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 8133018c01..5a49c16e60 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -798,96 +798,23 @@ CopyClientBuffer(struct brw_context *brw, drm_intel_bo *intelBO,
memcpyTime += time1 - time0;
memcpyBytes += len;
- _mesa_debug(&brw->ctx, "texture size: %d. Memcpy byte/sec: %g.\n",
+ _mesa_debug(&brw->ctx, "texture size: %d. SSE4.1 Memcpy byte/sec: %g.\n",
len, len / (time1 - time0));
return len;
#else
- const unsigned alignOffset = (size_t)targetHead & 0xf;
-
- if (64 >= len || (alignOffset != ((size_t)from & 0xf)) || testmemcpy) {
- bailCount++;
- memcpy(targetHead, from, len);
- drm_intel_bo_unmap(intelBO);
- clock_gettime(CLOCK_MONOTONIC, &timestruct);
- time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
-
- memcpyTime += time1 - time0;
- memcpyBytes += len;
-// _mesa_debug(&brw->ctx, "texture size: %d. Memcpy byte/sec: %g.\n",
-// (unsigned)len, len / (time1 - time0));
-
- return len;
- }
-
- if (testSSE4Memcpy) {
- void *sourceHead;
-
- if (alignOffset) {
- const unsigned byteAlign = 16 - alignOffset;
-
- memcpy(targetHead, from, byteAlign);
-
- targetHead = (void *)((char *)targetHead + byteAlign);
- sourceHead = (void *)((char *)from + byteAlign);
- len -= byteAlign;
- _mesa_debug(&brw->ctx, "aligning offset: %d.\n", byteAlign);
-
- } else {
- sourceHead = (void *)from;
- }
-
- memcpyCount++;
-
- for(unsigned i = 0; i < len / 64; i++) {
- __asm__ __volatile__ (
- " movntdqa (%0), %%xmm0\n"
- " movntdqa 16(%0), %%xmm2\n"
- " movntdqa 32(%0), %%xmm4\n"
- " movntdqa 48(%0), %%xmm6\n"
- " movdqa %%xmm0, (%1)\n"
- " movdqa %%xmm2, 16(%1)\n"
- " movdqa %%xmm4, 32(%1)\n"
- " movdqa %%xmm6, 48(%1)\n"
- : : "r" (sourceHead), "r" (targetHead) : "memory");
- sourceHead += 64;
- targetHead += 64;
- }
- /*
- *Now do the tail of the block
- */
- const unsigned remainingBytes = len & 63;
- if (0 != remainingBytes) {
- memcpy(targetHead, sourceHead, remainingBytes);
- }
-
- drm_intel_bo_unmap(intelBO);
-
-// clock_gettime(CLOCK_MONOTONIC, &timestruct);
-// time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
-
-// se4cpyTime += time1 - time0;
-// se4cpyBytes += len;
-// _mesa_debug(&brw->ctx, "texture size: %d. SEE4 Memcpy byte/sec: %g.\n",
-// (int)len, len / (time1 - time0));
- }
-
- if (testBOSubdata) {
- struct timespec timestruct;
- clock_gettime(CLOCK_MONOTONIC, &timestruct);
- double time0 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
-
- drm_intel_bo_subdata(intelBO, offset, len, from);
+ bailCount++;
+ memcpy(targetHead, from, len);
+ drm_intel_bo_unmap(intelBO);
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
- clock_gettime(CLOCK_MONOTONIC, &timestruct);
- double time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+ memcpyTime += time1 - time0;
+ memcpyBytes += len;
+ _mesa_debug(&brw->ctx, "texture size: %d. Memcpy byte/sec: %g.\n",
+ (unsigned)len, len / (time1 - time0));
- dmaTime += time1 - time0;
- dmaBytes += len;
- _mesa_debug(&brw->ctx, "texture size: %d. DMA sec/byte: %g.\n",
- (int)len, (time1 - time0) / len);
- }
return len;
#endif
}
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 261cc4de0c..e35e78cc02 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -576,7 +576,7 @@ intel_miptree_check_level_layer(struct intel_mipmap_tree *mt,
uint32_t level,
uint32_t layer)
{
- assert(level >= mt->first_level);
+// assert(level >= mt->first_level);
assert(level <= mt->last_level);
// assert(layer < mt->level[level].depth);
}
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 3d177b39d1..9226ddc97f 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1772,26 +1772,6 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
* do not apply and these are not intended to be used as render targets.
* Listing is based on the order presented in the glTexImage2D spec.
*/
- {
- MESA_FORMAT_RGB233_REV,
- "MESA_FORMAT_RGB233_REV",
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- 3, 3, 2, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_RGB101111_REV,
- "MESA_FORMAT_RGB101111_REV",
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- 11, 11, 10, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
-
- /* Blue Green Red */
/* Blue Green Red */
{
MESA_FORMAT_BGR_INT8,
@@ -1865,20 +1845,20 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
0, 0, 0, 0, 0,
1, 1, 12
},
-
- /* Red Green Blue Alpha */
{
- MESA_FORMAT_RGBA1010102,
- "MESA_FORMAT_RGBA1010102",
- GL_RGBA,
+ MESA_FORMAT_BGR332,
+ "MESA_FORMAT_BGR332",
+ GL_RGB,
GL_UNSIGNED_NORMALIZED,
- 10, 10, 10, 2,
+ 3, 3, 2, 0,
0, 0, 0, 0, 0,
- 1, 1, 4
+ 1, 1, 1
},
+
+ /* Red Green Blue Alpha */
{
- MESA_FORMAT_RGBA2101010_REV,
- "MESA_FORMAT_RGBA2101010_REV",
+ MESA_FORMAT_RGBA1010102,
+ "MESA_FORMAT_RGBA1010102",
GL_RGBA,
GL_UNSIGNED_NORMALIZED,
10, 10, 10, 2,
@@ -1886,15 +1866,6 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
1, 1, 4
},
{
- MESA_FORMAT_RGBA5999_REV,
- "MESA_FORMAT_RGBA5999_REV",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 9, 9, 9, 5,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
MESA_FORMAT_RGBA4444, /* Name */
"MESA_FORMAT_RGBA4444", /* StrName */
GL_RGBA, /* BaseFormat */
@@ -1912,15 +1883,6 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 2 /* BlockWidth/Height,Bytes */
},
- {
- MESA_FORMAT_RGBA1555_REV, /* Name */
- "MESA_FORMAT_RGBA1555_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
/* Blue Green Red Alpha */
{
MESA_FORMAT_BGRA_INT8,
@@ -2031,15 +1993,6 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
1, 1, 2 /* BlockWidth/Height,Bytes */
},
{
- MESA_FORMAT_BGRA1555_REV, /* Name */
- "MESA_FORMAT_BGRA1555_REV", /* StrName */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 2 /* BlockWidth/Height,Bytes */
- },
- {
MESA_FORMAT_BGRA1010102,
"MESA_FORMAT_BGRA1010102",
GL_RGBA,
@@ -2048,24 +2001,6 @@ static struct gl_format_info format_info[MESA_PRIVATE_FORMAT_COUNT] =
0, 0, 0, 0, 0,
1, 1, 4
},
- {
- MESA_FORMAT_BGRA2101010_REV,
- "MESA_FORMAT_BGRA2101010_REV",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 10, 10, 10, 2,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_BGRA5999_REV,
- "MESA_FORMAT_BGRA5999_REV",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 9, 9, 9, 5,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
};
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 5b7d0ebe02..d2ff643ed9 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -314,12 +314,8 @@ typedef enum
* do not apply and these are not intended to be used as render targets.
* Listing is based on the order presented in the glTexImage2D spec.
*/
- /* Red Green Blue */
- MESA_FORMAT_RGB233_REV = MESA_FORMAT_COUNT,
- MESA_FORMAT_RGB101111_REV,
-
/* Blue Green Red */
- MESA_FORMAT_BGR_INT8,
+ MESA_FORMAT_BGR_INT8 = MESA_FORMAT_COUNT,
MESA_FORMAT_BGR_UINT8,
MESA_FORMAT_BGR_INT16,
MESA_FORMAT_BGR_UINT16,
@@ -327,14 +323,12 @@ typedef enum
MESA_FORMAT_BGR_INT32,
MESA_FORMAT_BGR_UINT32,
MESA_FORMAT_BGR_FLOAT32,
+ MESA_FORMAT_BGR332,
/* Red Green Blue Alpha */
MESA_FORMAT_RGBA1010102,
- MESA_FORMAT_RGBA2101010_REV,
- MESA_FORMAT_RGBA5999_REV,
MESA_FORMAT_RGBA4444,
MESA_FORMAT_RGBA4444_REV,
- MESA_FORMAT_RGBA1555_REV,
/* Blue Green Red Alpha */
MESA_FORMAT_BGRA_INT8,
@@ -349,10 +343,7 @@ typedef enum
MESA_FORMAT_BGRA4444,
MESA_FORMAT_BGRA4444_REV,
MESA_FORMAT_BGRA5551,
- MESA_FORMAT_BGRA1555_REV,
MESA_FORMAT_BGRA1010102,
- MESA_FORMAT_BGRA2101010_REV,
- MESA_FORMAT_BGRA5999_REV,
MESA_PRIVATE_FORMAT_COUNT
} gl_format;
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index bec7a9bbb6..d6db318ea1 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1240,6 +1240,168 @@ _mesa_get_linear_internalformat(GLenum format)
}
}
+GLint _mesa_get_internalformat_bits(GLenum internal_format) {
+ switch (internal_format) {
+ case GL_ALPHA8:
+ case GL_ALPHA:
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ case GL_ALPHA8I_EXT:
+ case GL_ALPHA8UI_EXT:
+ case GL_INTENSITY:
+ case GL_INTENSITY8:
+ case GL_INTENSITY8I_EXT:
+ case GL_INTENSITY8UI_EXT:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE8I_EXT:
+ case GL_LUMINANCE8UI_EXT:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_RED:
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ case GL_R8:
+ case GL_R8UI:
+ case GL_R8I:
+ case GL_R3_G3_B2:
+ case GL_RGBA2:
+ case GL_STENCIL_INDEX:
+ case GL_STENCIL_INDEX8_EXT:
+ return 8;
+
+ case GL_RGB4:
+ return 12;
+
+ case GL_RGB5:
+ return 15;
+
+ case GL_ALPHA16:
+ case GL_ALPHA16_SNORM:
+ case GL_ALPHA16F_ARB:
+ case GL_ALPHA16I_EXT:
+ case GL_ALPHA16UI_EXT:
+ case GL_DEPTH_COMPONENT16:
+ case GL_INTENSITY16:
+ case GL_INTENSITY16F_ARB:
+ case GL_INTENSITY16I_EXT:
+ case GL_INTENSITY16UI_EXT:
+ case GL_LUMINANCE16:
+ case GL_LUMINANCE16F_ARB:
+ case GL_LUMINANCE16I_EXT:
+ case GL_LUMINANCE16UI_EXT:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE_ALPHA8I_EXT:
+ case GL_LUMINANCE_ALPHA8UI_EXT:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_R16:
+ case GL_R16F:
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_R16_SNORM:
+ case GL_R16UI:
+ case GL_R16I:
+ case GL_STENCIL_INDEX16_EXT:
+ return 16;
+
+ case GL_DEPTH_COMPONENT24:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_RGB:
+ case GL_RGB8:
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ case GL_RG8UI:
+ case GL_RG8I:
+ case GL_SRGB8_EXT:
+ case GL_RGB8UI_EXT:
+ case GL_RGB8I_EXT:
+ return 24;
+
+ case GL_RGB10:
+ return 30;
+
+ case GL_ALPHA32F_ARB:
+ case GL_ALPHA32I_EXT:
+ case GL_ALPHA32UI_EXT:
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT32:
+ case GL_DEPTH_COMPONENT32F:
+ case GL_DEPTH24_STENCIL8_EXT:
+ case GL_DEPTH_STENCIL_EXT:
+ case GL_INTENSITY32F_ARB:
+ case GL_INTENSITY32I_EXT:
+ case GL_INTENSITY32UI_EXT:
+ case GL_LUMINANCE16_ALPHA16:
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ case GL_LUMINANCE_ALPHA16I_EXT:
+ case GL_LUMINANCE_ALPHA16UI_EXT:
+ case GL_LUMINANCE32F_ARB:
+ case GL_LUMINANCE32I_EXT:
+ case GL_LUMINANCE32UI_EXT:
+ case GL_R32F:
+ case GL_R32UI:
+ case GL_R32I:
+ case GL_RG16:
+ case GL_RG16_SNORM:
+ case GL_RG16F:
+ case GL_RG16UI:
+ case GL_RG16I:
+ case GL_RGB10_A2:
+ case GL_RGB9_E5:
+ case GL_R11F_G11F_B10F:
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ case GL_SRGB8_ALPHA8_EXT:
+ case GL_RGBA8UI_EXT:
+ case GL_RGBA8I_EXT:
+ return 32;
+
+ case GL_RGB12:
+ return 36;
+
+ case GL_RGB16:
+ case GL_RGB16_SNORM:
+ case GL_RGB16F:
+ case GL_RGB16UI_EXT:
+ case GL_RGB16I_EXT:
+ case GL_RGBA12:
+ return 48;
+
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ case GL_LUMINANCE_ALPHA32I_EXT:
+ case GL_LUMINANCE_ALPHA32UI_EXT:
+ case GL_DEPTH32F_STENCIL8:
+ case GL_RG32F:
+ case GL_RG32UI:
+ case GL_RG32I:
+ case GL_RGBA16:
+ case GL_RGBA16_SNORM:
+ case GL_RGBA16F:
+ case GL_RGBA16UI_EXT:
+ case GL_RGBA16I_EXT:
+ return 64;
+
+ case GL_RGB32F:
+ case GL_RGB32UI_EXT:
+ case GL_RGB32I_EXT:
+ return 96;
+
+ case GL_RGBA32F:
+ case GL_RGBA32UI_EXT:
+ case GL_RGBA32I_EXT:
+ return 128;
+
+ default:
+ return 0;
+ }
+}
/**
* Do error checking of format/type combinations for glReadPixels,
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index af10899316..66b15f6883 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -117,6 +117,9 @@ extern GLenum
_mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
+extern GLint
+_mesa_get_internalformat_bits(GLenum internal_format);
+
extern GLenum
_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
unsigned dimensions);
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index e4fd99095f..12dd65fee7 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -913,13 +913,13 @@ _mesa_choose_cached_tex_format(struct gl_context *ctx, GLenum format, GLenum typ
case GL_UNSIGNED_BYTE_3_3_2:
return MESA_FORMAT_RGB332;
case GL_UNSIGNED_BYTE_2_3_3_REV:
- return MESA_FORMAT_RGB233_REV;
+ return MESA_FORMAT_BGR332;
case GL_UNSIGNED_SHORT_5_6_5:
return MESA_FORMAT_RGB565;
case GL_UNSIGNED_SHORT_5_6_5_REV:
return MESA_FORMAT_RGB565_REV;
case GL_UNSIGNED_INT_10F_11F_11F_REV:
- return MESA_FORMAT_RGB101111_REV;
+ return MESA_FORMAT_R11_G11_B10_FLOAT;
}
break;
@@ -970,18 +970,12 @@ _mesa_choose_cached_tex_format(struct gl_context *ctx, GLenum format, GLenum typ
return MESA_FORMAT_RGBA4444_REV;
case GL_UNSIGNED_SHORT_5_5_5_1:
return MESA_FORMAT_RGBA5551;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return MESA_FORMAT_RGBA1555_REV;
case GL_UNSIGNED_INT_8_8_8_8:
return MESA_FORMAT_RGBA8888;
case GL_UNSIGNED_INT_8_8_8_8_REV:
return MESA_FORMAT_RGBA8888_REV;
case GL_UNSIGNED_INT_10_10_10_2:
return MESA_FORMAT_RGBA1010102;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return MESA_FORMAT_RGBA2101010_REV;
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- return MESA_FORMAT_RGBA5999_REV;
}
break;
@@ -1010,22 +1004,15 @@ _mesa_choose_cached_tex_format(struct gl_context *ctx, GLenum format, GLenum typ
return MESA_FORMAT_BGRA4444_REV;
case GL_UNSIGNED_SHORT_5_5_5_1:
return MESA_FORMAT_BGRA5551;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return MESA_FORMAT_BGRA1555_REV;
case GL_UNSIGNED_INT_8_8_8_8:
return MESA_FORMAT_BGRA_INT8;
case GL_UNSIGNED_INT_8_8_8_8_REV:
return MESA_FORMAT_BGRA_INT8_REV;
case GL_UNSIGNED_INT_10_10_10_2:
return MESA_FORMAT_BGRA1010102;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return MESA_FORMAT_BGRA2101010_REV;
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- return MESA_FORMAT_BGRA5999_REV;
}
break;
-// case GL_ALPHA8I_EXT:
case GL_LUMINANCE:
switch (type) {
case GL_BYTE:
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index bdce98a4d8..97fcc88bb7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2974,13 +2974,13 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
width, height, depth, border, pixels);
else
_mesa_debug(ctx,
- "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
+ "glTexImage%uD %s %d %s %d %d %d %d %s %s\n",
dims,
_mesa_lookup_enum_by_nr(target), level,
_mesa_lookup_enum_by_nr(internalFormat),
width, height, depth, border,
_mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type), pixels);
+ _mesa_lookup_enum_by_nr(type));
}
internalFormat = override_internal_format(internalFormat, width, height);