1706f2543Smrg#ifdef HAVE_XORG_CONFIG_H 2706f2543Smrg#include <xorg-config.h> 3706f2543Smrg#endif 4706f2543Smrg 5706f2543Smrg#include <X11/X.h> 6706f2543Smrg#include "misc.h" 7706f2543Smrg#include "xf86.h" 8706f2543Smrg#include "xf86_OSproc.h" 9706f2543Smrg 10706f2543Smrg#include "scrnintstr.h" 11706f2543Smrg#include "xf86str.h" 12706f2543Smrg#include "xaarop.h" 13706f2543Smrg#include "xaa.h" 14706f2543Smrg#include "xaalocal.h" 15706f2543Smrg 16706f2543Smrg 17706f2543Smrgint XAACopyROP[16] = 18706f2543Smrg{ 19706f2543Smrg ROP_0, /* GXclear */ 20706f2543Smrg ROP_DSa, /* GXand */ 21706f2543Smrg ROP_SDna, /* GXandReverse */ 22706f2543Smrg ROP_S, /* GXcopy */ 23706f2543Smrg ROP_DSna, /* GXandInverted */ 24706f2543Smrg ROP_D, /* GXnoop */ 25706f2543Smrg ROP_DSx, /* GXxor */ 26706f2543Smrg ROP_DSo, /* GXor */ 27706f2543Smrg ROP_DSon, /* GXnor */ 28706f2543Smrg ROP_DSxn, /* GXequiv */ 29706f2543Smrg ROP_Dn, /* GXinvert*/ 30706f2543Smrg ROP_SDno, /* GXorReverse */ 31706f2543Smrg ROP_Sn, /* GXcopyInverted */ 32706f2543Smrg ROP_DSno, /* GXorInverted */ 33706f2543Smrg ROP_DSan, /* GXnand */ 34706f2543Smrg ROP_1 /* GXset */ 35706f2543Smrg}; 36706f2543Smrg 37706f2543Smrgint XAACopyROP_PM[16] = 38706f2543Smrg{ 39706f2543Smrg ROP_0, /* not used */ 40706f2543Smrg ROP_DSPnoa, 41706f2543Smrg ROP_DPSnaon, 42706f2543Smrg ROP_DPSDxax, 43706f2543Smrg ROP_DPSana, 44706f2543Smrg ROP_D, /* not used */ 45706f2543Smrg ROP_DPSax, 46706f2543Smrg ROP_DPSao, 47706f2543Smrg ROP_DPSaon, 48706f2543Smrg ROP_DPSaxn, 49706f2543Smrg ROP_Dn, /* not used */ 50706f2543Smrg ROP_DPSanan, 51706f2543Smrg ROP_PSDPxox, /* is that correct ? */ 52706f2543Smrg ROP_DPSnao, 53706f2543Smrg ROP_DSPnoan, 54706f2543Smrg ROP_1 /* not used */ 55706f2543Smrg}; 56706f2543Smrg 57706f2543Smrg 58706f2543Smrgint XAAPatternROP[16]= 59706f2543Smrg{ 60706f2543Smrg ROP_0, 61706f2543Smrg ROP_DPa, 62706f2543Smrg ROP_PDna, 63706f2543Smrg ROP_P, 64706f2543Smrg ROP_DPna, 65706f2543Smrg ROP_D, 66706f2543Smrg ROP_DPx, 67706f2543Smrg ROP_DPo, 68706f2543Smrg ROP_DPon, 69706f2543Smrg ROP_PDxn, 70706f2543Smrg ROP_Dn, 71706f2543Smrg ROP_PDno, 72706f2543Smrg ROP_Pn, 73706f2543Smrg ROP_DPno, 74706f2543Smrg ROP_DPan, 75706f2543Smrg ROP_1 76706f2543Smrg}; 77706f2543Smrg 78706f2543Smrgint XAAPatternROP_PM[16] = 79706f2543Smrg{ 80706f2543Smrg ROP_DPna, 81706f2543Smrg ROP_DPSnoa, 82706f2543Smrg ROP_DSPnaon, 83706f2543Smrg ROP_DSPDxax, 84706f2543Smrg ROP_DPSana, 85706f2543Smrg ROP_D, 86706f2543Smrg ROP_DPSax, 87706f2543Smrg ROP_DPSao, 88706f2543Smrg ROP_DPSaon, 89706f2543Smrg ROP_DPSaxn, 90706f2543Smrg ROP_DPx, 91706f2543Smrg ROP_DPSanan, 92706f2543Smrg ROP_SPDSxox, /* is that correct ? */ 93706f2543Smrg ROP_DSPnao, 94706f2543Smrg ROP_DPSnoan, 95706f2543Smrg ROP_DPo 96706f2543Smrg}; 97706f2543Smrg 98706f2543Smrgint XAAGetCopyROP(int i) 99706f2543Smrg{ 100706f2543Smrg return XAACopyROP[i]; 101706f2543Smrg} 102706f2543Smrg 103706f2543Smrgint XAAGetCopyROP_PM(int i) 104706f2543Smrg{ 105706f2543Smrg return XAACopyROP_PM[i]; 106706f2543Smrg} 107706f2543Smrg 108706f2543Smrgint XAAGetPatternROP(int i) 109706f2543Smrg{ 110706f2543Smrg return XAAPatternROP[i]; 111706f2543Smrg} 112706f2543Smrg 113706f2543Smrgint XAAGetPatternROP_PM(int i) 114706f2543Smrg{ 115706f2543Smrg return XAAPatternROP_PM[i]; 116706f2543Smrg} 117706f2543Smrg 118706f2543Smrgint 119706f2543SmrgXAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop) 120706f2543Smrg{ 121706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 122706f2543Smrg int ret = 0; 123706f2543Smrg 124706f2543Smrg pm &= infoRec->FullPlanemasks[pScrn->depth - 1]; 125706f2543Smrg 126706f2543Smrg if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) { 127706f2543Smrg if(!NO_SRC_ROP(*rop)) 128706f2543Smrg ret |= ROP_PAT; 129706f2543Smrg *rop = XAAPatternROP[*rop]; 130706f2543Smrg } else { 131706f2543Smrg switch(*rop) { 132706f2543Smrg case GXnoop: 133706f2543Smrg break; 134706f2543Smrg case GXset: 135706f2543Smrg case GXclear: 136706f2543Smrg case GXinvert: 137706f2543Smrg ret |= ROP_PAT; 138706f2543Smrg *fg = pm; 139706f2543Smrg if(*bg != -1) 140706f2543Smrg *bg = pm; 141706f2543Smrg break; 142706f2543Smrg default: 143706f2543Smrg ret |= ROP_PAT | ROP_SRC; 144706f2543Smrg break; 145706f2543Smrg } 146706f2543Smrg *rop = XAAPatternROP_PM[*rop]; 147706f2543Smrg } 148706f2543Smrg 149706f2543Smrg return ret; 150706f2543Smrg} 151706f2543Smrg 152706f2543Smrg 153706f2543Smrgint 154706f2543SmrgXAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop) 155706f2543Smrg{ 156706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 157706f2543Smrg int ret = 0; 158706f2543Smrg 159706f2543Smrg pm &= infoRec->FullPlanemasks[pScrn->depth - 1]; 160706f2543Smrg 161706f2543Smrg if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) { 162706f2543Smrg if(!NO_SRC_ROP(*rop)) 163706f2543Smrg ret |= ROP_PAT; 164706f2543Smrg *rop = XAAPatternROP[*rop]; 165706f2543Smrg } else { 166706f2543Smrg switch(*rop) { 167706f2543Smrg case GXnoop: 168706f2543Smrg break; 169706f2543Smrg case GXset: 170706f2543Smrg case GXclear: 171706f2543Smrg case GXinvert: 172706f2543Smrg ret |= ROP_PAT; 173706f2543Smrg *fg = pm; 174706f2543Smrg break; 175706f2543Smrg default: 176706f2543Smrg ret |= ROP_PAT | ROP_SRC; 177706f2543Smrg break; 178706f2543Smrg } 179706f2543Smrg *rop = XAAPatternROP_PM[*rop]; 180706f2543Smrg } 181706f2543Smrg 182706f2543Smrg return ret; 183706f2543Smrg} 184706f2543Smrg 185