diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-02-10 13:47:53 -0500 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2011-02-10 13:47:53 -0500 |
commit | 2c5ae1724307e0dba5d0306fe27c1e15a7390a2f (patch) | |
tree | d6b7641a08c909ecc03ff342cf06208317332f64 /src | |
parent | c52d817b51e13447802fe338be2d247ffba2a669 (diff) |
evergreen/ni: consolidate CB state handling
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/evergreen_accel.c | 26 | ||||
-rw-r--r-- | src/evergreen_exa.c | 74 | ||||
-rw-r--r-- | src/evergreen_state.h | 5 | ||||
-rw-r--r-- | src/evergreen_textured_videofuncs.c | 9 |
4 files changed, 53 insertions, 61 deletions
diff --git a/src/evergreen_accel.c b/src/evergreen_accel.c index 4f5a120c..c6c38b2e 100644 --- a/src/evergreen_accel.c +++ b/src/evergreen_accel.c @@ -43,6 +43,25 @@ #include "radeon_vbo.h" #include "radeon_exa_shared.h" +static const uint32_t EVERGREEN_ROP[16] = { + RADEON_ROP3_ZERO, /* GXclear */ + RADEON_ROP3_DSa, /* Gxand */ + RADEON_ROP3_SDna, /* GXandReverse */ + RADEON_ROP3_S, /* GXcopy */ + RADEON_ROP3_DSna, /* GXandInverted */ + RADEON_ROP3_D, /* GXnoop */ + RADEON_ROP3_DSx, /* GXxor */ + RADEON_ROP3_DSo, /* GXor */ + RADEON_ROP3_DSon, /* GXnor */ + RADEON_ROP3_DSxn, /* GXequiv */ + RADEON_ROP3_Dn, /* GXinvert */ + RADEON_ROP3_SDno, /* GXorReverse */ + RADEON_ROP3_Sn, /* GXcopyInverted */ + RADEON_ROP3_DSno, /* GXorInverted */ + RADEON_ROP3_DSan, /* GXnand */ + RADEON_ROP3_ONE, /* GXset */ +}; + void evergreen_start_3d(ScrnInfoPtr pScrn) { @@ -204,7 +223,7 @@ evergreen_set_render_target(ScrnInfoPtr pScrn, cb_config_t *cb_conf, uint32_t do RELOC_BATCH(cb_conf->bo, 0, domain); END_BATCH(); - BEGIN_BATCH(24); + BEGIN_BATCH(33); EREG(CB_COLOR0_PITCH + (0x3c * cb_conf->id), pitch); EREG(CB_COLOR0_SLICE + (0x3c * cb_conf->id), slice); EREG(CB_COLOR0_VIEW + (0x3c * cb_conf->id), 0); @@ -216,7 +235,12 @@ evergreen_set_render_target(ScrnInfoPtr pScrn, cb_config_t *cb_conf, uint32_t do E32(0); E32(0); E32(0); + EREG(CB_TARGET_MASK, (cb_conf->pmask << TARGET0_ENABLE_shift)); + EREG(CB_COLOR_CONTROL, (EVERGREEN_ROP[cb_conf->rop] | + (CB_NORMAL << CB_COLOR_CONTROL__MODE_shift))); + EREG(CB_BLEND0_CONTROL, cb_conf->blendcntl); END_BATCH(); + } static void diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c index 52a5030a..ea01d4c4 100644 --- a/src/evergreen_exa.c +++ b/src/evergreen_exa.c @@ -43,25 +43,6 @@ #include "radeon_exa_shared.h" #include "radeon_vbo.h" -uint32_t EVERGREEN_ROP[16] = { - RADEON_ROP3_ZERO, /* GXclear */ - RADEON_ROP3_DSa, /* Gxand */ - RADEON_ROP3_SDna, /* GXandReverse */ - RADEON_ROP3_S, /* GXcopy */ - RADEON_ROP3_DSna, /* GXandInverted */ - RADEON_ROP3_D, /* GXnoop */ - RADEON_ROP3_DSx, /* GXxor */ - RADEON_ROP3_DSo, /* GXor */ - RADEON_ROP3_DSon, /* GXnor */ - RADEON_ROP3_DSxn, /* GXequiv */ - RADEON_ROP3_Dn, /* GXinvert */ - RADEON_ROP3_SDno, /* GXorReverse */ - RADEON_ROP3_Sn, /* GXcopyInverted */ - RADEON_ROP3_DSno, /* GXorInverted */ - RADEON_ROP3_DSan, /* GXnand */ - RADEON_ROP3_ONE, /* GXset */ -}; - Bool EVERGREENSetAccelState(ScrnInfoPtr pScrn, struct r600_accel_object *src0, @@ -159,7 +140,6 @@ EVERGREENPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) struct radeon_accel_state *accel_state = info->accel_state; cb_config_t cb_conf; shader_config_t vs_conf, ps_conf; - int pmask = 0; uint32_t a, r, g, b; float *ps_alu_consts; const_config_t ps_const_conf; @@ -239,24 +219,19 @@ EVERGREENPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) } cb_conf.source_format = EXPORT_4C_16BPC; cb_conf.blend_clamp = 1; - evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); - /* Render setup */ if (accel_state->planemask & 0x000000ff) - pmask |= 4; /* B */ + cb_conf.pmask |= 4; /* B */ if (accel_state->planemask & 0x0000ff00) - pmask |= 2; /* G */ + cb_conf.pmask |= 2; /* G */ if (accel_state->planemask & 0x00ff0000) - pmask |= 1; /* R */ + cb_conf.pmask |= 1; /* R */ if (accel_state->planemask & 0xff000000) - pmask |= 8; /* A */ - - BEGIN_BATCH(23); - EREG(CB_TARGET_MASK, (pmask << TARGET0_ENABLE_shift)); - EREG(CB_COLOR_CONTROL, (EVERGREEN_ROP[accel_state->rop] | - (CB_NORMAL << CB_COLOR_CONTROL__MODE_shift))); - EREG(CB_BLEND0_CONTROL, 0); + cb_conf.pmask |= 8; /* A */ + cb_conf.rop = accel_state->rop; + evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); + BEGIN_BATCH(14); /* Interpolator setup */ /* one unused export from VS (VS_EXPORT_COUNT is zero based, count minus one) */ EREG(SPI_VS_OUT_CONFIG, (0 << VS_EXPORT_COUNT_shift)); @@ -363,7 +338,6 @@ EVERGREENDoPrepareCopy(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); struct radeon_accel_state *accel_state = info->accel_state; - int pmask = 0; cb_config_t cb_conf; tex_resource_t tex_res; tex_sampler_t tex_samp; @@ -465,24 +439,19 @@ EVERGREENDoPrepareCopy(ScrnInfoPtr pScrn) } cb_conf.source_format = EXPORT_4C_16BPC; cb_conf.blend_clamp = 1; - evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); - /* Render setup */ if (accel_state->planemask & 0x000000ff) - pmask |= 4; /* B */ + cb_conf.pmask |= 4; /* B */ if (accel_state->planemask & 0x0000ff00) - pmask |= 2; /* G */ + cb_conf.pmask |= 2; /* G */ if (accel_state->planemask & 0x00ff0000) - pmask |= 1; /* R */ + cb_conf.pmask |= 1; /* R */ if (accel_state->planemask & 0xff000000) - pmask |= 8; /* A */ - - BEGIN_BATCH(23); - EREG(CB_TARGET_MASK, (pmask << TARGET0_ENABLE_shift)); - EREG(CB_COLOR_CONTROL, (EVERGREEN_ROP[accel_state->rop] | - (CB_NORMAL << CB_COLOR_CONTROL__MODE_shift))); - EREG(CB_BLEND0_CONTROL, 0); + cb_conf.pmask |= 8; /* A */ + cb_conf.rop = accel_state->rop; + evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); + BEGIN_BATCH(14); /* Interpolator setup */ /* export tex coord from VS */ EREG(SPI_VS_OUT_CONFIG, ((1 - 1) << VS_EXPORT_COUNT_shift)); @@ -1191,7 +1160,7 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture, ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); struct radeon_accel_state *accel_state = info->accel_state; - uint32_t blendcntl, dst_format; + uint32_t dst_format; cb_config_t cb_conf; shader_config_t vs_conf, ps_conf; const_config_t vs_const_conf; @@ -1361,16 +1330,13 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture, } cb_conf.source_format = EXPORT_4C_16BPC; cb_conf.blend_clamp = 1; + cb_conf.blendcntl = EVERGREENGetBlendCntl(op, pMaskPicture, pDstPicture->format); + cb_conf.blendcntl |= CB_BLEND0_CONTROL__ENABLE_bit; + cb_conf.rop = 3; + cb_conf.pmask = 0xf; evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); - blendcntl = EVERGREENGetBlendCntl(op, pMaskPicture, pDstPicture->format); - - BEGIN_BATCH(24); - EREG(CB_TARGET_MASK, (0xf << TARGET0_ENABLE_shift)); - EREG(CB_COLOR_CONTROL, (EVERGREEN_ROP[3] | - (CB_NORMAL << CB_COLOR_CONTROL__MODE_shift))); - EREG(CB_BLEND0_CONTROL, blendcntl | CB_BLEND0_CONTROL__ENABLE_bit); - + BEGIN_BATCH(15); /* Interpolator setup */ if (pMask) { /* export 2 tex coords from VS */ diff --git a/src/evergreen_state.h b/src/evergreen_state.h index 7e49164b..5d03adcb 100644 --- a/src/evergreen_state.h +++ b/src/evergreen_state.h @@ -86,6 +86,11 @@ typedef struct { int fast_clear; int compression; int rat; + /* 2D related CB state */ + uint32_t pmask; + int rop; + int blend_enable; + uint32_t blendcntl; struct radeon_bo *bo; } cb_config_t; diff --git a/src/evergreen_textured_videofuncs.c b/src/evergreen_textured_videofuncs.c index d60d1949..434bd2e1 100644 --- a/src/evergreen_textured_videofuncs.c +++ b/src/evergreen_textured_videofuncs.c @@ -423,15 +423,12 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) cb_conf.source_format = EXPORT_4C_16BPC; cb_conf.blend_clamp = 1; + cb_conf.pmask = 0xf; + cb_conf.rop = 3; evergreen_set_render_target(pScrn, &cb_conf, accel_state->dst_obj.domain); /* Render setup */ - BEGIN_BATCH(23); - EREG(CB_TARGET_MASK, (0x0f << TARGET0_ENABLE_shift)); - EREG(CB_COLOR_CONTROL, ((0xcc << ROP3_shift) | - (CB_NORMAL << CB_COLOR_CONTROL__MODE_shift))); - EREG(CB_BLEND0_CONTROL, 0); - + BEGIN_BATCH(14); /* Interpolator setup */ /* export tex coords from VS */ EREG(SPI_VS_OUT_CONFIG, ((1 - 1) << VS_EXPORT_COUNT_shift)); |