Home | History | Annotate | Line # | Download | only in src
      1 /*
      2  * Copyright (c) 2007 Advanced Micro Devices, Inc.
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the "Software"),
      6  * to deal in the Software without restriction, including without limitation
      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      8  * and/or sell copies of the Software, and to permit persons to whom the
      9  * Software is furnished to do so, subject to the following conditions:
     10  *
     11  * The above copyright notice and this permission notice shall be included in
     12  * all copies or substantial portions of the Software.
     13  *
     14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     20  * DEALINGS IN THE SOFTWARE.
     21  *
     22  * Neither the name of the Advanced Micro Devices, Inc. nor the names of its
     23  * contributors may be used to endorse or promote products derived from this
     24  * software without specific prior written permission.
     25  */
     26 
     27 #ifndef AMD_BLEND_H_
     28 #define AMD_BLEND_H_
     29 
     30 #define GEODEPTR_FROM_PIXMAP(x)		\
     31 		GEODEPTR(xf86Screens[(x)->drawable.pScreen->myNum])
     32 #define GEODEPTR_FROM_SCREEN(x)		\
     33 		GEODEPTR(xf86Screens[(x)->myNum])
     34 #define GEODEPTR_FROM_PICTURE(x)	\
     35 		GEODEPTR(xf86Screens[(x)->pDrawable->pScreen->myNum])
     36 
     37 #define usesPasses(op) (((		\
     38    ( 1 << PictOpAtop ) | 		\
     39    ( 1 << PictOpAtopReverse ) | \
     40    ( 1 << PictOpXor ) | 		\
     41    0 ) >> (op)) & 1)
     42 
     43 /* pass1 or pass2 */
     44 #define usesSrcAlpha(op) ((( 		\
     45    ( 1 << PictOpOver ) | 			\
     46    ( 1 << PictOpInReverse  ) | 		\
     47    ( 1 << PictOpOutReverse  ) | 	\
     48    ( 1 << PictOpAtop ) | 			\
     49    ( 1 << PictOpAtopReverse ) | 	\
     50    ( 1 << PictOpXor ) | 			\
     51    0 ) >> (op)) & 1)
     52 
     53 /* pass1 or pass2 */
     54 #define usesDstAlpha(op) ((( 		\
     55    ( 1 << PictOpOverReverse ) | 	\
     56    ( 1 << PictOpIn ) | 				\
     57    ( 1 << PictOpOut ) | 			\
     58    ( 1 << PictOpAtop ) | 			\
     59    ( 1 << PictOpAtopReverse ) | 	\
     60    ( 1 << PictOpXor ) | 			\
     61    0 ) >> (op)) & 1)
     62 
     63 /* non 2 pass ops */
     64 #define usesChanB0(op) ((( 			\
     65    ( 1 << PictOpOver ) | 			\
     66    ( 1 << PictOpOverReverse ) | 	\
     67    ( 1 << PictOpIn ) | 				\
     68    ( 1 << PictOpInReverse ) | 		\
     69    ( 1 << PictOpOut ) | 			\
     70    ( 1 << PictOpOutReverse ) | 		\
     71    ( 1 << PictOpAdd ) | 			\
     72    0 ) >> (op)) & 1)
     73 
     74 /* pass 1 ops */
     75 #define usesChanB1(op) ((( 			\
     76    ( 1 << PictOpAtop ) | 			\
     77    ( 1 << PictOpAtopReverse ) | 	\
     78    ( 1 << PictOpXor ) | 			\
     79    0 ) >> (op)) & 1)
     80 
     81 /* pass 2 ops */
     82 #define usesChanB2(op) ((( 			\
     83    ( 1 << PictOpAtop ) | 			\
     84    ( 1 << PictOpAtopReverse ) | 	\
     85    ( 1 << PictOpXor ) | 			\
     86    0 ) >> (op)) & 1)
     87 
     88 #endif
     89