summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h4
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c86
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_surface.c126
4 files changed, 50 insertions, 172 deletions
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 80df7f0fba..2f1f036993 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -146,9 +146,6 @@ struct i915_sampler_state {
const struct pipe_sampler_state *templ;
};
-struct i915_alpha_test_state {
- unsigned LIS6;
-};
struct i915_texture {
struct pipe_texture base;
@@ -186,7 +183,6 @@ struct i915_context
/* The most recent drawing state as set by the driver:
*/
- const struct i915_alpha_test_state *alpha_test;
const struct i915_blend_state *blend;
const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct i915_depth_stencil_state *depth_stencil;
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 2a9a587a37..f8332aab37 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -284,13 +284,13 @@ static void i915_delete_sampler_state(struct pipe_context *pipe,
static void *
i915_create_depth_stencil_state(struct pipe_context *pipe,
- const struct pipe_depth_stencil_state *depth_stencil)
+ const struct pipe_depth_stencil_alpha_state *depth_stencil)
{
struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state );
{
- int testmask = depth_stencil->stencil.value_mask[0] & 0xff;
- int writemask = depth_stencil->stencil.write_mask[0] & 0xff;
+ int testmask = depth_stencil->stencil[0].value_mask & 0xff;
+ int writemask = depth_stencil->stencil[0].write_mask & 0xff;
cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD |
ENABLE_STENCIL_TEST_MASK |
@@ -299,12 +299,12 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
STENCIL_WRITE_MASK(writemask));
}
- if (depth_stencil->stencil.front_enabled) {
- int test = i915_translate_compare_func(depth_stencil->stencil.front_func);
- int fop = i915_translate_stencil_op(depth_stencil->stencil.front_fail_op);
- int dfop = i915_translate_stencil_op(depth_stencil->stencil.front_zfail_op);
- int dpop = i915_translate_stencil_op(depth_stencil->stencil.front_zpass_op);
- int ref = depth_stencil->stencil.ref_value[0] & 0xff;
+ if (depth_stencil->stencil[0].enabled) {
+ int test = i915_translate_compare_func(depth_stencil->stencil[0].func);
+ int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op);
+ int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op);
+ int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op);
+ int ref = depth_stencil->stencil[0].ref_value & 0xff;
cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE |
S5_STENCIL_WRITE_ENABLE |
@@ -315,14 +315,14 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
(dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
}
- if (depth_stencil->stencil.back_enabled) {
- int test = i915_translate_compare_func(depth_stencil->stencil.back_func);
- int fop = i915_translate_stencil_op(depth_stencil->stencil.back_fail_op);
- int dfop = i915_translate_stencil_op(depth_stencil->stencil.back_zfail_op);
- int dpop = i915_translate_stencil_op(depth_stencil->stencil.back_zpass_op);
- int ref = depth_stencil->stencil.ref_value[1] & 0xff;
- int tmask = depth_stencil->stencil.value_mask[1] & 0xff;
- int wmask = depth_stencil->stencil.write_mask[1] & 0xff;
+ if (depth_stencil->stencil[1].enabled) {
+ int test = i915_translate_compare_func(depth_stencil->stencil[1].func);
+ int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op);
+ int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
+ int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
+ int ref = depth_stencil->stencil[1].ref_value & 0xff;
+ int tmask = depth_stencil->stencil[1].value_mask & 0xff;
+ int wmask = depth_stencil->stencil[1].write_mask & 0xff;
cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
BFO_ENABLE_STENCIL_FUNCS |
@@ -363,6 +363,15 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE;
}
+ if (depth_stencil->alpha.enabled) {
+ int test = i915_translate_compare_func(depth_stencil->alpha.func);
+ ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref);
+
+ cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE |
+ (test << S6_ALPHA_TEST_FUNC_SHIFT) |
+ (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
+ }
+
return cso;
}
@@ -383,39 +392,6 @@ static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
}
-static void *
-i915_create_alpha_test_state(struct pipe_context *pipe,
- const struct pipe_alpha_test_state *alpha_test)
-{
- struct i915_alpha_test_state *cso = CALLOC_STRUCT( i915_alpha_test_state );
-
- if (alpha_test->enabled) {
- int test = i915_translate_compare_func(alpha_test->func);
- ubyte refByte = float_to_ubyte(alpha_test->ref);
-
- cso->LIS6 |= (S6_ALPHA_TEST_ENABLE |
- (test << S6_ALPHA_TEST_FUNC_SHIFT) |
- (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
- }
- return cso;
-}
-
-static void i915_bind_alpha_test_state(struct pipe_context *pipe,
- void *alpha)
-{
- struct i915_context *i915 = i915_context(pipe);
-
- i915->alpha_test = (const struct i915_alpha_test_state*)alpha;
-
- i915->dirty |= I915_NEW_ALPHA_TEST;
-}
-
-static void i915_delete_alpha_test_state(struct pipe_context *pipe,
- void *alpha)
-{
- FREE(alpha);
-}
-
static void i915_set_scissor_state( struct pipe_context *pipe,
const struct pipe_scissor_state *scissor )
{
@@ -674,10 +650,6 @@ static void i915_set_vertex_element( struct pipe_context *pipe,
void
i915_init_state_functions( struct i915_context *i915 )
{
- i915->pipe.create_alpha_test_state = i915_create_alpha_test_state;
- i915->pipe.bind_alpha_test_state = i915_bind_alpha_test_state;
- i915->pipe.delete_alpha_test_state = i915_delete_alpha_test_state;
-
i915->pipe.create_blend_state = i915_create_blend_state;
i915->pipe.bind_blend_state = i915_bind_blend_state;
i915->pipe.delete_blend_state = i915_delete_blend_state;
@@ -686,9 +658,9 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.bind_sampler_state = i915_bind_sampler_state;
i915->pipe.delete_sampler_state = i915_delete_sampler_state;
- i915->pipe.create_depth_stencil_state = i915_create_depth_stencil_state;
- i915->pipe.bind_depth_stencil_state = i915_bind_depth_stencil_state;
- i915->pipe.delete_depth_stencil_state = i915_delete_depth_stencil_state;
+ i915->pipe.create_depth_stencil_alpha_state = i915_create_depth_stencil_state;
+ i915->pipe.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state;
+ i915->pipe.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state;
i915->pipe.create_rasterizer_state = i915_create_rasterizer_state;
i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state;
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index da2402c018..752d25f233 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -159,10 +159,6 @@ static void upload_S6( struct i915_context *i915 )
unsigned LIS6 = (S6_COLOR_WRITE_ENABLE |
(2 << S6_TRISTRIP_PV_SHIFT));
- /* I915_NEW_ALPHA_TEST
- */
- LIS6 |= i915->alpha_test->LIS6;
-
/* I915_NEW_BLEND
*/
LIS6 |= i915->blend->LIS6;
@@ -178,7 +174,7 @@ static void upload_S6( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_S6 = {
- I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
+ I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
upload_S6
};
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c
index d4c02c5359..79e74e1143 100644
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ b/src/mesa/pipe/i915simple/i915_surface.c
@@ -33,89 +33,7 @@
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-
-#include "pipe/softpipe/sp_rgba_tile.h" /* XXX TEMPORARY */
-
-
-#define CLIP_TILE \
- do { \
- if (x >= ps->width) \
- return; \
- if (y >= ps->height) \
- return; \
- if (x + w > ps->width) \
- w = ps->width - x; \
- if (y + h > ps->height) \
- h = ps->height -y; \
- } while(0)
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-i915_get_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- void *p, int dst_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (dst_stride == 0) {
- dst_stride = w0 * cpp;
- }
-
- pSrc = ps->map + (y * ps->pitch + x) * cpp;
- pDest = (ubyte *) p;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += dst_stride;
- pSrc += ps->pitch * cpp;
- }
-}
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-i915_put_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- const void *p, int src_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (src_stride == 0) {
- src_stride = w0 * cpp;
- }
-
- pSrc = (const ubyte *) p;
- pDest = ps->map + (y * ps->pitch + x) * cpp;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->pitch * cpp;
- pSrc += src_stride;
- }
-}
+#include "pipe/util/p_tile.h"
/*
@@ -158,21 +76,18 @@ i915_get_tex_surface(struct pipe_context *pipe,
}
-/*
- * XXX Move this into core Mesa?
- */
static void
-_mesa_copy_rect(ubyte * dst,
- unsigned cpp,
- unsigned dst_pitch,
- unsigned dst_x,
- unsigned dst_y,
- unsigned width,
- unsigned height,
- const ubyte * src,
- unsigned src_pitch,
- unsigned src_x,
- unsigned src_y)
+copy_rect(ubyte * dst,
+ unsigned cpp,
+ unsigned dst_pitch,
+ unsigned dst_x,
+ unsigned dst_y,
+ unsigned width,
+ unsigned height,
+ const ubyte *src,
+ unsigned src_pitch,
+ unsigned src_x,
+ unsigned src_y)
{
unsigned i;
@@ -210,10 +125,9 @@ i915_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_pitch,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- _mesa_copy_rect(pipe_surface_map(dst),
- dst->cpp,
- dst->pitch,
- dstx, dsty, width, height, src, src_pitch, srcx, srcy);
+ copy_rect(pipe_surface_map(dst),
+ dst->cpp, dst->pitch,
+ dstx, dsty, width, height, src, src_pitch, srcx, srcy);
pipe_surface_unmap(dst);
}
@@ -233,7 +147,7 @@ i915_surface_copy(struct pipe_context *pipe,
assert( dst->cpp == src->cpp );
if (0) {
- _mesa_copy_rect(pipe_surface_map(dst),
+ copy_rect(pipe_surface_map(dst),
dst->cpp,
dst->pitch,
dstx, dsty,
@@ -323,10 +237,10 @@ void
i915_init_surface_functions(struct i915_context *i915)
{
i915->pipe.get_tex_surface = i915_get_tex_surface;
- i915->pipe.get_tile = i915_get_tile;
- i915->pipe.put_tile = i915_put_tile;
- i915->pipe.get_tile_rgba = softpipe_get_tile_rgba;
- i915->pipe.put_tile_rgba = softpipe_put_tile_rgba;
+ i915->pipe.get_tile = pipe_get_tile_raw;
+ i915->pipe.put_tile = pipe_put_tile_raw;
+ i915->pipe.get_tile_rgba = pipe_get_tile_rgba;
+ i915->pipe.put_tile_rgba = pipe_put_tile_rgba;
i915->pipe.surface_data = i915_surface_data;
i915->pipe.surface_copy = i915_surface_copy;