Subversion Repositories Kolibri OS

Rev

Rev 3263 | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef SNA_RENDER_H
  2. #define SNA_RENDER_H
  3.  
  4. #include "compiler.h"
  5.  
  6. #include <stdbool.h>
  7. #include <stdint.h>
  8.  
  9. #define GRADIENT_CACHE_SIZE 16
  10.  
  11. #define GXinvalid 0xff
  12.  
  13. struct sna;
  14. struct sna_glyph;
  15. struct sna_video;
  16. struct sna_video_frame;
  17. struct brw_compile;
  18.  
  19. struct sna_composite_rectangles {
  20.         struct sna_coordinate {
  21.                 int16_t x, y;
  22.         } src, mask, dst;
  23.         int16_t width, height;
  24. };
  25.  
  26. struct sna_composite_op {
  27.     fastcall void (*blt)(struct sna *sna, const struct sna_composite_op *op,
  28.                  const struct sna_composite_rectangles *r);
  29.     fastcall void (*box)(struct sna *sna,
  30.                  const struct sna_composite_op *op,
  31.                  const BoxRec *box);
  32.     void (*boxes)(struct sna *sna, const struct sna_composite_op *op,
  33.               const BoxRec *box, int nbox);
  34.     void (*done)(struct sna *sna, const struct sna_composite_op *op);
  35.  
  36.     struct sna_damage **damage;
  37.  
  38.     uint32_t op;
  39.  
  40.     struct {
  41.                 PixmapPtr pixmap;
  42.         CARD32    format;
  43.         struct kgem_bo *bo;
  44.         int16_t   x, y;
  45.         uint16_t  width, height;
  46.     } dst;
  47.  
  48.     struct sna_composite_channel {
  49.         struct kgem_bo *bo;
  50.         PictTransform *transform;
  51.         uint16_t width;
  52.         uint16_t height;
  53.         uint32_t pict_format;
  54.         uint32_t card_format;
  55.         uint32_t filter;
  56.         uint32_t repeat;
  57.         uint32_t is_affine : 1;
  58.         uint32_t is_solid : 1;
  59.         uint32_t is_linear : 1;
  60.         uint32_t is_opaque : 1;
  61.         uint32_t alpha_fixup : 1;
  62.         uint32_t rb_reversed : 1;
  63.         int16_t offset[2];
  64.         float scale[2];
  65.  
  66. //        pixman_transform_t embedded_transform;
  67.  
  68.         union {
  69.             struct {
  70.                                 float dx, dy, offset;
  71.                         } linear;
  72.                         struct {
  73.                 uint32_t pixel;
  74.             } gen2;
  75.             struct gen3_shader_channel {
  76.                 int type;
  77.                 uint32_t mode;
  78.                 uint32_t constants;
  79.             } gen3;
  80.         } u;
  81.     } src, mask;
  82.     uint32_t is_affine : 1;
  83.     uint32_t has_component_alpha : 1;
  84.     uint32_t need_magic_ca_pass : 1;
  85.     uint32_t rb_reversed : 1;
  86.  
  87.     int16_t floats_per_vertex;
  88.     int16_t floats_per_rect;
  89.     fastcall void (*prim_emit)(struct sna *sna,
  90.                    const struct sna_composite_op *op,
  91.                    const struct sna_composite_rectangles *r);
  92.  
  93.     struct sna_composite_redirect {
  94.         struct kgem_bo *real_bo;
  95.         struct sna_damage **real_damage, *damage;
  96.         BoxRec box;
  97.     } redirect;
  98.  
  99.     union {
  100.         struct sna_blt_state {
  101.                         PixmapPtr src_pixmap;
  102.             int16_t sx, sy;
  103.  
  104.             uint32_t inplace :1;
  105.             uint32_t overwrites:1;
  106.             uint32_t bpp : 6;
  107.  
  108.             uint32_t cmd;
  109.             uint32_t br13;
  110.             uint32_t pitch[2];
  111.             uint32_t pixel;
  112.             struct kgem_bo *bo[2];
  113.         } blt;
  114.  
  115.         struct {
  116.             float constants[8];
  117.             uint32_t num_constants;
  118.         } gen3;
  119.  
  120.         struct {
  121.             int wm_kernel;
  122.             int ve_id;
  123.         } gen4;
  124.  
  125.         struct {
  126.                         int16_t wm_kernel;
  127.                         int16_t ve_id;
  128.         } gen5;
  129.  
  130.         struct {
  131.                         uint32_t flags;
  132.         } gen6;
  133.  
  134.         struct {
  135.                         uint32_t flags;
  136.         } gen7;
  137.         } u;
  138.  
  139.         void *priv;
  140. };
  141.  
  142. struct sna_copy_op {
  143.         struct sna_composite_op base;
  144.  
  145.         void (*blt)(struct sna *sna, const struct sna_copy_op *op,
  146.                     int16_t sx, int16_t sy,
  147.                     int16_t w, int16_t h,
  148.                     int16_t dx, int16_t dy);
  149.         void (*done)(struct sna *sna, const struct sna_copy_op *op);
  150. };
  151.  
  152. struct sna_render {
  153.         int active;
  154.  
  155.         int max_3d_size;
  156.         int max_3d_pitch;
  157.  
  158.         unsigned prefer_gpu;
  159. #define PREFER_GPU_BLT 0x1
  160. #define PREFER_GPU_RENDER 0x2
  161. #define PREFER_GPU_SPANS 0x4
  162.  
  163.  
  164.         bool (*composite)(struct sna *sna, uint8_t op,
  165.                           PicturePtr dst, PicturePtr src, PicturePtr mask,
  166.                           int16_t src_x, int16_t src_y,
  167.                           int16_t msk_x, int16_t msk_y,
  168.                           int16_t dst_x, int16_t dst_y,
  169.                           int16_t w, int16_t h,
  170.                           struct sna_composite_op *tmp);
  171.  
  172. #if 0
  173.         bool (*check_composite_spans)(struct sna *sna, uint8_t op,
  174.                                       PicturePtr dst, PicturePtr src,
  175.                                       int16_t w, int16_t h, unsigned flags);
  176.         bool (*composite_spans)(struct sna *sna, uint8_t op,
  177.                                 PicturePtr dst, PicturePtr src,
  178.                                 int16_t src_x, int16_t src_y,
  179.                                 int16_t dst_x, int16_t dst_y,
  180.                                 int16_t w, int16_t h,
  181.                                 unsigned flags,
  182.                                 struct sna_composite_spans_op *tmp);
  183. #define COMPOSITE_SPANS_RECTILINEAR 0x1
  184. #define COMPOSITE_SPANS_INPLACE_HINT 0x2
  185.  
  186.         bool (*video)(struct sna *sna,
  187.                       struct sna_video *video,
  188.                       struct sna_video_frame *frame,
  189.                       RegionPtr dstRegion,
  190.                       short src_w, short src_h,
  191.                       short drw_w, short drw_h,
  192.                       short dx, short dy,
  193.                       PixmapPtr pixmap);
  194.  
  195.         bool (*fill_boxes)(struct sna *sna,
  196.                            CARD8 op,
  197.                            PictFormat format,
  198.                            const xRenderColor *color,
  199.                            PixmapPtr dst, struct kgem_bo *dst_bo,
  200.                            const BoxRec *box, int n);
  201.         bool (*fill)(struct sna *sna, uint8_t alu,
  202.                      PixmapPtr dst, struct kgem_bo *dst_bo,
  203.                      uint32_t color,
  204.                      struct sna_fill_op *tmp);
  205.         bool (*fill_one)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo,
  206.                          uint32_t color,
  207.                          int16_t x1, int16_t y1, int16_t x2, int16_t y2,
  208.                          uint8_t alu);
  209.         bool (*clear)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo);
  210.  
  211.         bool (*copy_boxes)(struct sna *sna, uint8_t alu,
  212.                            PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  213.                            PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  214.                            const BoxRec *box, int n, unsigned flags);
  215. #define COPY_LAST 0x1
  216. #define COPY_SYNC 0x2
  217.  
  218. #endif
  219.  
  220.         bool (*copy)(struct sna *sna, uint8_t alu,
  221.                      PixmapPtr src, struct kgem_bo *src_bo,
  222.                      PixmapPtr dst, struct kgem_bo *dst_bo,
  223.                      struct sna_copy_op *op);
  224.  
  225.         void (*flush)(struct sna *sna);
  226.         void (*reset)(struct sna *sna);
  227.         void (*fini)(struct sna *sna);
  228.  
  229. #if 0
  230.  
  231.         struct sna_alpha_cache {
  232.                 struct kgem_bo *cache_bo;
  233.                 struct kgem_bo *bo[256+7];
  234.         } alpha_cache;
  235.  
  236.     struct sna_solid_cache {
  237.          struct kgem_bo *cache_bo;
  238.          struct kgem_bo *bo[1024];
  239.                 uint32_t color[1025];
  240.          int last;
  241.          int size;
  242.          int dirty;
  243.     } solid_cache;
  244.  
  245.         struct {
  246.                 struct sna_gradient_cache {
  247.                         struct kgem_bo *bo;
  248.                         int nstops;
  249.                         PictGradientStop *stops;
  250.                 } cache[GRADIENT_CACHE_SIZE];
  251.                 int size;
  252.         } gradient_cache;
  253.  
  254.         struct sna_glyph_cache{
  255.                 PicturePtr picture;
  256.                 struct sna_glyph **glyphs;
  257.                 uint16_t count;
  258.                 uint16_t evict;
  259.         } glyph[2];
  260.         pixman_image_t *white_image;
  261.         PicturePtr white_picture;
  262. #if HAS_PIXMAN_GLYPHS
  263.         pixman_glyph_cache_t *glyph_cache;
  264. #endif
  265.  
  266. #endif
  267.  
  268.         uint16_t vb_id;
  269.         uint16_t vertex_offset;
  270.         uint16_t vertex_start;
  271.         uint16_t vertex_index;
  272.         uint16_t vertex_used;
  273.         uint16_t vertex_size;
  274.         uint16_t vertex_reloc[16];
  275.         int nvertex_reloc;
  276.  
  277.     struct kgem_bo *vbo;
  278.         float *vertices;
  279.  
  280.         float vertex_data[1024];
  281. };
  282.  
  283. struct gen2_render_state {
  284.         uint32_t target;
  285.         bool need_invariant;
  286.         uint32_t logic_op_enabled;
  287.         uint32_t ls1, ls2, vft;
  288.         uint32_t diffuse;
  289.         uint32_t specular;
  290. };
  291.  
  292. struct gen3_render_state {
  293.         uint32_t current_dst;
  294.         bool need_invariant;
  295.         uint32_t tex_count;
  296.         uint32_t last_drawrect_limit;
  297.         uint32_t last_target;
  298.         uint32_t last_blend;
  299.         uint32_t last_constants;
  300.         uint32_t last_sampler;
  301.         uint32_t last_shader;
  302.         uint32_t last_diffuse;
  303.         uint32_t last_specular;
  304.  
  305.         uint16_t last_vertex_offset;
  306.         uint16_t floats_per_vertex;
  307.         uint16_t last_floats_per_vertex;
  308.  
  309.         uint32_t tex_map[4];
  310.         uint32_t tex_handle[2];
  311.         uint32_t tex_delta[2];
  312. };
  313.  
  314. struct gen4_render_state {
  315.         struct kgem_bo *general_bo;
  316.  
  317.         uint32_t vs;
  318.         uint32_t sf;
  319.         uint32_t wm;
  320.         uint32_t cc;
  321.  
  322.         int ve_id;
  323.         uint32_t drawrect_offset;
  324.         uint32_t drawrect_limit;
  325.         uint32_t last_pipelined_pointers;
  326.         uint16_t last_primitive;
  327.         int16_t floats_per_vertex;
  328.         uint16_t surface_table;
  329.  
  330.         bool needs_invariant;
  331.         bool needs_urb;
  332. };
  333.  
  334. struct gen5_render_state {
  335.         struct kgem_bo *general_bo;
  336.  
  337.         uint32_t vs;
  338.         uint32_t sf[2];
  339.         uint32_t wm;
  340.         uint32_t cc;
  341.  
  342.         int ve_id;
  343.         uint32_t drawrect_offset;
  344.         uint32_t drawrect_limit;
  345.         uint16_t last_primitive;
  346.         int16_t floats_per_vertex;
  347.         uint16_t surface_table;
  348.         uint16_t last_pipelined_pointers;
  349.  
  350.         bool needs_invariant;
  351. };
  352.  
  353. enum {
  354.         GEN6_WM_KERNEL_NOMASK = 0,
  355.         GEN6_WM_KERNEL_NOMASK_P,
  356.  
  357.     GEN6_WM_KERNEL_MASK,
  358.         GEN6_WM_KERNEL_MASK_P,
  359.  
  360.         GEN6_WM_KERNEL_MASKCA,
  361.         GEN6_WM_KERNEL_MASKCA_P,
  362.  
  363.         GEN6_WM_KERNEL_MASKSA,
  364.         GEN6_WM_KERNEL_MASKSA_P,
  365.  
  366.         GEN6_WM_KERNEL_OPACITY,
  367.         GEN6_WM_KERNEL_OPACITY_P,
  368.  
  369.         GEN6_WM_KERNEL_VIDEO_PLANAR,
  370.         GEN6_WM_KERNEL_VIDEO_PACKED,
  371.     GEN6_KERNEL_COUNT
  372. };
  373.  
  374. struct gen6_render_state {
  375.         const struct gt_info *info;
  376.     struct kgem_bo *general_bo;
  377.  
  378.         uint32_t vs_state;
  379.         uint32_t sf_state;
  380.         uint32_t sf_mask_state;
  381.         uint32_t wm_state;
  382.         uint32_t wm_kernel[GEN6_KERNEL_COUNT][3];
  383.  
  384.         uint32_t cc_blend;
  385.  
  386.         uint32_t drawrect_offset;
  387.         uint32_t drawrect_limit;
  388.         uint32_t blend;
  389.         uint32_t samplers;
  390.         uint32_t kernel;
  391.  
  392.         uint16_t num_sf_outputs;
  393.         uint16_t ve_id;
  394.         uint16_t last_primitive;
  395.         int16_t floats_per_vertex;
  396.         uint16_t surface_table;
  397.  
  398.         bool needs_invariant;
  399.         bool first_state_packet;
  400. };
  401.  
  402. enum {
  403.         GEN7_WM_KERNEL_NOMASK = 0,
  404.         GEN7_WM_KERNEL_NOMASK_P,
  405.  
  406.         GEN7_WM_KERNEL_MASK,
  407.         GEN7_WM_KERNEL_MASK_P,
  408.  
  409.         GEN7_WM_KERNEL_MASKCA,
  410.         GEN7_WM_KERNEL_MASKCA_P,
  411.  
  412.         GEN7_WM_KERNEL_MASKSA,
  413.         GEN7_WM_KERNEL_MASKSA_P,
  414.  
  415.         GEN7_WM_KERNEL_OPACITY,
  416.         GEN7_WM_KERNEL_OPACITY_P,
  417.  
  418.         GEN7_WM_KERNEL_VIDEO_PLANAR,
  419.         GEN7_WM_KERNEL_VIDEO_PACKED,
  420.         GEN7_WM_KERNEL_COUNT
  421. };
  422.  
  423. struct gen7_render_state {
  424.         const struct gt_info *info;
  425.         struct kgem_bo *general_bo;
  426.  
  427.         uint32_t vs_state;
  428.         uint32_t sf_state;
  429.         uint32_t sf_mask_state;
  430.         uint32_t wm_state;
  431.         uint32_t wm_kernel[GEN7_WM_KERNEL_COUNT][3];
  432.  
  433.         uint32_t cc_blend;
  434.  
  435.         uint32_t drawrect_offset;
  436.         uint32_t drawrect_limit;
  437.         uint32_t blend;
  438.         uint32_t samplers;
  439.         uint32_t kernel;
  440.  
  441.         uint16_t num_sf_outputs;
  442.         uint16_t ve_id;
  443.         uint16_t last_primitive;
  444.         int16_t floats_per_vertex;
  445.         uint16_t surface_table;
  446.  
  447.         bool needs_invariant;
  448.         bool emit_flush;
  449. };
  450.  
  451. struct sna_static_stream {
  452.         uint32_t size, used;
  453.         uint8_t *data;
  454. };
  455.  
  456. int sna_static_stream_init(struct sna_static_stream *stream);
  457. uint32_t sna_static_stream_add(struct sna_static_stream *stream,
  458.                                const void *data, uint32_t len, uint32_t align);
  459. void *sna_static_stream_map(struct sna_static_stream *stream,
  460.                             uint32_t len, uint32_t align);
  461. uint32_t sna_static_stream_offsetof(struct sna_static_stream *stream,
  462.                                     void *ptr);
  463. unsigned sna_static_stream_compile_sf(struct sna *sna,
  464.                                       struct sna_static_stream *stream,
  465.                                       bool (*compile)(struct brw_compile *));
  466.  
  467. unsigned sna_static_stream_compile_wm(struct sna *sna,
  468.                                       struct sna_static_stream *stream,
  469.                                       bool (*compile)(struct brw_compile *, int),
  470.                                       int width);
  471. struct kgem_bo *sna_static_stream_fini(struct sna *sna,
  472.                                        struct sna_static_stream *stream);
  473.  
  474. struct kgem_bo *
  475. sna_render_get_solid(struct sna *sna,
  476.                      uint32_t color);
  477.  
  478. void
  479. sna_render_flush_solid(struct sna *sna);
  480.  
  481.  
  482. uint32_t sna_rgba_for_color(uint32_t color, int depth);
  483. uint32_t sna_rgba_to_color(uint32_t rgba, uint32_t format);
  484. bool sna_get_rgba_from_pixel(uint32_t pixel,
  485.                              uint16_t *red,
  486.                              uint16_t *green,
  487.                              uint16_t *blue,
  488.                              uint16_t *alpha,
  489.                              uint32_t format);
  490. bool sna_picture_is_solid(PicturePtr picture, uint32_t *color);
  491.  
  492. void no_render_init(struct sna *sna);
  493.  
  494. bool gen2_render_init(struct sna *sna);
  495. bool gen3_render_init(struct sna *sna);
  496. bool gen4_render_init(struct sna *sna);
  497. bool gen5_render_init(struct sna *sna);
  498. bool gen6_render_init(struct sna *sna);
  499. bool gen7_render_init(struct sna *sna);
  500.  
  501. #if 0
  502.  
  503. bool sna_tiling_composite(uint32_t op,
  504.                           PicturePtr src,
  505.                           PicturePtr mask,
  506.                           PicturePtr dst,
  507.                           int16_t src_x, int16_t src_y,
  508.                           int16_t mask_x, int16_t mask_y,
  509.                           int16_t dst_x, int16_t dst_y,
  510.                           int16_t width, int16_t height,
  511.                           struct sna_composite_op *tmp);
  512. bool sna_tiling_fill_boxes(struct sna *sna,
  513.                            CARD8 op,
  514.                            PictFormat format,
  515.                            const xRenderColor *color,
  516.                            PixmapPtr dst, struct kgem_bo *dst_bo,
  517.                            const BoxRec *box, int n);
  518.  
  519. bool sna_tiling_copy_boxes(struct sna *sna, uint8_t alu,
  520.                            PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  521.                            PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  522.                            const BoxRec *box, int n);
  523.  
  524. bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
  525.                                struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  526.                                struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  527.                                int bpp, const BoxRec *box, int nbox);
  528.  
  529. bool sna_blt_composite(struct sna *sna,
  530.                        uint32_t op,
  531.                        PicturePtr src,
  532.                        PicturePtr dst,
  533.                        int16_t src_x, int16_t src_y,
  534.                        int16_t dst_x, int16_t dst_y,
  535.                        int16_t width, int16_t height,
  536.                        struct sna_composite_op *tmp,
  537.                        bool fallback);
  538. bool sna_blt_composite__convert(struct sna *sna,
  539.                                 int x, int y,
  540.                                 int width, int height,
  541.                        struct sna_composite_op *tmp);
  542.  
  543. bool sna_blt_fill(struct sna *sna, uint8_t alu,
  544.                   struct kgem_bo *bo,
  545.                   int bpp,
  546.                   uint32_t pixel,
  547.                   struct sna_fill_op *fill);
  548.  
  549. bool sna_blt_copy(struct sna *sna, uint8_t alu,
  550.                   struct kgem_bo *src,
  551.                   struct kgem_bo *dst,
  552.                   int bpp,
  553.                   struct sna_copy_op *copy);
  554.  
  555. bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
  556.                         struct kgem_bo *bo,
  557.                         int bpp,
  558.                         uint32_t pixel,
  559.                         const BoxRec *box, int n);
  560.  
  561. bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
  562.                         struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  563.                         struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  564.                         int bpp,
  565.                         const BoxRec *box, int n);
  566. bool sna_blt_copy_boxes_fallback(struct sna *sna, uint8_t alu,
  567.                                  PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  568.                                  PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  569.                                  const BoxRec *box, int nbox);
  570.  
  571. bool _sna_get_pixel_from_rgba(uint32_t *pixel,
  572.                              uint16_t red,
  573.                              uint16_t green,
  574.                              uint16_t blue,
  575.                              uint16_t alpha,
  576.                              uint32_t format);
  577.  
  578. static inline bool
  579. sna_get_pixel_from_rgba(uint32_t * pixel,
  580.                         uint16_t red,
  581.                         uint16_t green,
  582.                         uint16_t blue,
  583.                         uint16_t alpha,
  584.                         uint32_t format)
  585. {
  586.         switch (format) {
  587.         case PICT_x8r8g8b8:
  588.                 alpha = 0xffff;
  589.                 /* fall through to re-use a8r8g8b8 expansion */
  590.         case PICT_a8r8g8b8:
  591.                 *pixel = ((alpha >> 8 << 24) |
  592.                           (red >> 8 << 16) |
  593.                           (green & 0xff00) |
  594.                           (blue >> 8));
  595.                 return TRUE;
  596.         case PICT_a8:
  597.                 *pixel = alpha >> 8;
  598.                 return TRUE;
  599.         }
  600.  
  601.         return _sna_get_pixel_from_rgba(pixel, red, green, blue, alpha, format);
  602. }
  603.  
  604. struct kgem_bo *
  605. __sna_render_pixmap_bo(struct sna *sna,
  606.                        PixmapPtr pixmap,
  607.                        const BoxRec *box,
  608.                        bool blt);
  609.  
  610. int
  611. sna_render_pixmap_bo(struct sna *sna,
  612.                      struct sna_composite_channel *channel,
  613.                      PixmapPtr pixmap,
  614.                      int16_t x, int16_t y,
  615.                      int16_t w, int16_t h,
  616.                      int16_t dst_x, int16_t dst_y);
  617.  
  618. bool
  619. sna_render_pixmap_partial(struct sna *sna,
  620.                           PixmapPtr pixmap,
  621.                           struct kgem_bo *bo,
  622.                           struct sna_composite_channel *channel,
  623.                           int16_t x, int16_t y,
  624.                           int16_t w, int16_t h);
  625.  
  626. int
  627. sna_render_picture_extract(struct sna *sna,
  628.                            PicturePtr picture,
  629.                            struct sna_composite_channel *channel,
  630.                            int16_t x, int16_t y,
  631.                            int16_t w, int16_t h,
  632.                            int16_t dst_x, int16_t dst_y);
  633.  
  634. int
  635. sna_render_picture_approximate_gradient(struct sna *sna,
  636.                                         PicturePtr picture,
  637.                                         struct sna_composite_channel *channel,
  638.                                         int16_t x, int16_t y,
  639.                                         int16_t w, int16_t h,
  640.                                         int16_t dst_x, int16_t dst_y);
  641.  
  642. int
  643. sna_render_picture_fixup(struct sna *sna,
  644.                          PicturePtr picture,
  645.                          struct sna_composite_channel *channel,
  646.                          int16_t x, int16_t y,
  647.                          int16_t w, int16_t h,
  648.                          int16_t dst_x, int16_t dst_y);
  649.  
  650. int
  651. sna_render_picture_convert(struct sna *sna,
  652.                            PicturePtr picture,
  653.                            struct sna_composite_channel *channel,
  654.                            PixmapPtr pixmap,
  655.                            int16_t x, int16_t y,
  656.                            int16_t w, int16_t h,
  657.                            int16_t dst_x, int16_t dst_y,
  658.                            bool fixup_alpha);
  659.  
  660. inline static void sna_render_composite_redirect_init(struct sna_composite_op *op)
  661. {
  662.         struct sna_composite_redirect *t = &op->redirect;
  663.         t->real_bo = NULL;
  664.         t->damage = NULL;
  665. }
  666.  
  667. bool
  668. sna_render_composite_redirect(struct sna *sna,
  669.                               struct sna_composite_op *op,
  670.                               int x, int y, int width, int height);
  671.  
  672. void
  673. sna_render_composite_redirect_done(struct sna *sna,
  674.                                    const struct sna_composite_op *op);
  675.  
  676. bool
  677. sna_composite_mask_is_opaque(PicturePtr mask);
  678.  
  679. #endif
  680. void sna_vertex_init(struct sna *sna);
  681.  
  682. static inline void sna_vertex_lock(struct sna_render *r)
  683. {
  684. //      pthread_mutex_lock(&r->lock);
  685. }
  686.  
  687. static inline void sna_vertex_acquire__locked(struct sna_render *r)
  688. {
  689.         r->active++;
  690. }
  691.  
  692. static inline void sna_vertex_unlock(struct sna_render *r)
  693. {
  694. //      pthread_mutex_unlock(&r->lock);
  695. }
  696.  
  697. static inline void sna_vertex_release__locked(struct sna_render *r)
  698. {
  699.         assert(r->active > 0);
  700.         --r->active;
  701. //      if (--r->active == 0)
  702. //              pthread_cond_signal(&r->wait);
  703. }
  704.  
  705. static inline bool sna_vertex_wait__locked(struct sna_render *r)
  706. {
  707.         bool was_active = r->active;
  708. //      while (r->active)
  709. //              pthread_cond_wait(&r->wait, &r->lock);
  710.         return was_active;
  711. }
  712.  
  713. #endif /* SNA_RENDER_H */
  714.