i915: Improved the not used tile code
This commit is contained in:
@@ -211,14 +211,18 @@ i915_emit_hardware_state(struct i915_context *i915 )
|
||||
struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
|
||||
|
||||
if (cbuf_surface) {
|
||||
unsigned pitch = (cbuf_surface->pitch * cbuf_surface->cpp);
|
||||
unsigned cpitch = (cbuf_surface->pitch * cbuf_surface->cpp);
|
||||
unsigned ctile = BUF_3D_USE_FENCE;
|
||||
#if 0
|
||||
if (!((cpitch - 1) & cpitch) && cpitch >= 512)
|
||||
ctile = BUF_3D_TILED_SURFACE;
|
||||
#endif
|
||||
|
||||
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
|
||||
|
||||
OUT_BATCH(BUF_3D_ID_COLOR_BACK |
|
||||
BUF_3D_PITCH(pitch) | /* pitch in bytes */
|
||||
// BUF_3D_TILED_SURFACE); /* JB: Used to force tileing */
|
||||
BUF_3D_USE_FENCE);
|
||||
BUF_3D_PITCH(cpitch) | /* pitch in bytes */
|
||||
ctile);
|
||||
|
||||
OUT_RELOC(cbuf_surface->buffer,
|
||||
I915_BUFFER_ACCESS_WRITE,
|
||||
@@ -229,12 +233,17 @@ i915_emit_hardware_state(struct i915_context *i915 )
|
||||
*/
|
||||
if (depth_surface) {
|
||||
unsigned zpitch = (depth_surface->pitch * depth_surface->cpp);
|
||||
|
||||
unsigned ztile = BUF_3D_USE_FENCE;
|
||||
#if 0
|
||||
if (!((zpitch - 1) & zpitch) && zpitch >= 512)
|
||||
ztile = BUF_3D_TILED_SURFACE;
|
||||
#endif
|
||||
|
||||
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
|
||||
|
||||
OUT_BATCH(BUF_3D_ID_DEPTH |
|
||||
BUF_3D_PITCH(zpitch) | /* pitch in bytes */
|
||||
BUF_3D_USE_FENCE);
|
||||
ztile);
|
||||
|
||||
OUT_RELOC(depth_surface->buffer,
|
||||
I915_BUFFER_ACCESS_WRITE,
|
||||
|
||||
@@ -104,16 +104,14 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
|
||||
*/
|
||||
}
|
||||
|
||||
#if 0
|
||||
static unsigned
|
||||
power_of_two(unsigned x)
|
||||
{
|
||||
int value = 1;
|
||||
unsigned value = 1;
|
||||
while (value <= x)
|
||||
value = value << 1;
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned
|
||||
round_up(unsigned n, unsigned multiple)
|
||||
@@ -125,8 +123,7 @@ round_up(unsigned n, unsigned multiple)
|
||||
* Special case to deal with display targets.
|
||||
*/
|
||||
static boolean
|
||||
i915_displaytarget_layout(struct pipe_screen *screen,
|
||||
struct i915_texture *tex)
|
||||
i915_displaytarget_layout(struct i915_texture *tex)
|
||||
{
|
||||
struct pipe_texture *pt = &tex->base;
|
||||
|
||||
@@ -139,13 +136,19 @@ i915_displaytarget_layout(struct pipe_screen *screen,
|
||||
1 );
|
||||
i915_miptree_set_image_offset( tex, 0, 0, 0, 0 );
|
||||
|
||||
#if 0
|
||||
tex->pitch = MAX2(512, power_of_two(tex->base.width[0] * pt->cpp)) / pt->cpp;
|
||||
tex->total_height = round_up(tex->base.height[0], 8);
|
||||
#else
|
||||
tex->pitch = round_up(tex->base.width[0], 64 / pt->cpp);
|
||||
tex->total_height = tex->base.height[0];
|
||||
#endif
|
||||
if (tex->base.width[0] >= 128) {
|
||||
tex->pitch = power_of_two(tex->base.width[0] * pt->cpp) / pt->cpp;
|
||||
tex->total_height = round_up(tex->base.height[0], 8);
|
||||
} else {
|
||||
tex->pitch = round_up(tex->base.width[0], 64 / pt->cpp);
|
||||
tex->total_height = tex->base.height[0];
|
||||
}
|
||||
|
||||
/*
|
||||
printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
||||
tex->base.width[0], tex->base.height[0], pt->cpp,
|
||||
tex->pitch, tex->total_height, tex->pitch * tex->total_height * 4);
|
||||
*/
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -161,6 +164,12 @@ i945_miptree_layout_2d( struct i915_texture *tex )
|
||||
unsigned width = pt->width[0];
|
||||
unsigned height = pt->height[0];
|
||||
|
||||
#if 0 /* used for tiled display targets */
|
||||
if (pt->last_level == 0 && pt->cpp == 4)
|
||||
if (i915_displaytarget_layout(tex))
|
||||
return;
|
||||
#endif
|
||||
|
||||
tex->pitch = pt->width[0];
|
||||
|
||||
/* May need to adjust pitch to accomodate the placement of
|
||||
|
||||
Reference in New Issue
Block a user