Subversion Repositories Kolibri OS

Rev

Rev 3278 | Go to most recent revision | 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 (*blit_tex)(struct sna *sna,
  221.               uint8_t op,
  222.               PixmapPtr src, struct kgem_bo *src_bo,
  223.               PixmapPtr mask,struct kgem_bo *mask_bo,
  224.               PixmapPtr dst, struct kgem_bo *dst_bo,
  225.               int32_t src_x, int32_t src_y,
  226.               int32_t msk_x, int32_t msk_y,
  227.               int32_t dst_x, int32_t dst_y,
  228.               int32_t width, int32_t height,
  229.               struct sna_composite_op *tmp);
  230.  
  231.         bool (*copy)(struct sna *sna, uint8_t alu,
  232.                      PixmapPtr src, struct kgem_bo *src_bo,
  233.                      PixmapPtr dst, struct kgem_bo *dst_bo,
  234.                      struct sna_copy_op *op);
  235.  
  236.         void (*flush)(struct sna *sna);
  237.         void (*reset)(struct sna *sna);
  238.         void (*fini)(struct sna *sna);
  239.  
  240. #if 0
  241.  
  242.         struct sna_alpha_cache {
  243.                 struct kgem_bo *cache_bo;
  244.                 struct kgem_bo *bo[256+7];
  245.         } alpha_cache;
  246.  
  247.     struct sna_solid_cache {
  248.          struct kgem_bo *cache_bo;
  249.          struct kgem_bo *bo[1024];
  250.                 uint32_t color[1025];
  251.          int last;
  252.          int size;
  253.          int dirty;
  254.     } solid_cache;
  255.  
  256.         struct {
  257.                 struct sna_gradient_cache {
  258.                         struct kgem_bo *bo;
  259.                         int nstops;
  260.                         PictGradientStop *stops;
  261.                 } cache[GRADIENT_CACHE_SIZE];
  262.                 int size;
  263.         } gradient_cache;
  264.  
  265.         struct sna_glyph_cache{
  266.                 PicturePtr picture;
  267.                 struct sna_glyph **glyphs;
  268.                 uint16_t count;
  269.                 uint16_t evict;
  270.         } glyph[2];
  271.         pixman_image_t *white_image;
  272.         PicturePtr white_picture;
  273. #if HAS_PIXMAN_GLYPHS
  274.         pixman_glyph_cache_t *glyph_cache;
  275. #endif
  276.  
  277. #endif
  278.  
  279.         uint16_t vb_id;
  280.         uint16_t vertex_offset;
  281.         uint16_t vertex_start;
  282.         uint16_t vertex_index;
  283.         uint16_t vertex_used;
  284.         uint16_t vertex_size;
  285.         uint16_t vertex_reloc[16];
  286.         int nvertex_reloc;
  287.  
  288.     struct kgem_bo *vbo;
  289.         float *vertices;
  290.  
  291.         float vertex_data[1024];
  292. };
  293.  
  294. struct gen2_render_state {
  295.         uint32_t target;
  296.         bool need_invariant;
  297.         uint32_t logic_op_enabled;
  298.         uint32_t ls1, ls2, vft;
  299.         uint32_t diffuse;
  300.         uint32_t specular;
  301. };
  302.  
  303. struct gen3_render_state {
  304.         uint32_t current_dst;
  305.         bool need_invariant;
  306.         uint32_t tex_count;
  307.         uint32_t last_drawrect_limit;
  308.         uint32_t last_target;
  309.         uint32_t last_blend;
  310.         uint32_t last_constants;
  311.         uint32_t last_sampler;
  312.         uint32_t last_shader;
  313.         uint32_t last_diffuse;
  314.         uint32_t last_specular;
  315.  
  316.         uint16_t last_vertex_offset;
  317.         uint16_t floats_per_vertex;
  318.         uint16_t last_floats_per_vertex;
  319.  
  320.         uint32_t tex_map[4];
  321.         uint32_t tex_handle[2];
  322.         uint32_t tex_delta[2];
  323. };
  324.  
  325. struct gen4_render_state {
  326.         struct kgem_bo *general_bo;
  327.  
  328.         uint32_t vs;
  329.         uint32_t sf;
  330.         uint32_t wm;
  331.         uint32_t cc;
  332.  
  333.         int ve_id;
  334.         uint32_t drawrect_offset;
  335.         uint32_t drawrect_limit;
  336.         uint32_t last_pipelined_pointers;
  337.         uint16_t last_primitive;
  338.         int16_t floats_per_vertex;
  339.         uint16_t surface_table;
  340.  
  341.         bool needs_invariant;
  342.         bool needs_urb;
  343. };
  344.  
  345. struct gen5_render_state {
  346.         struct kgem_bo *general_bo;
  347.  
  348.         uint32_t vs;
  349.         uint32_t sf[2];
  350.         uint32_t wm;
  351.         uint32_t cc;
  352.  
  353.         int ve_id;
  354.         uint32_t drawrect_offset;
  355.         uint32_t drawrect_limit;
  356.         uint16_t last_primitive;
  357.         int16_t floats_per_vertex;
  358.         uint16_t surface_table;
  359.         uint16_t last_pipelined_pointers;
  360.  
  361.         bool needs_invariant;
  362. };
  363.  
  364. enum {
  365.         GEN6_WM_KERNEL_NOMASK = 0,
  366.         GEN6_WM_KERNEL_NOMASK_P,
  367.  
  368.     GEN6_WM_KERNEL_MASK,
  369.         GEN6_WM_KERNEL_MASK_P,
  370.  
  371.         GEN6_WM_KERNEL_MASKCA,
  372.         GEN6_WM_KERNEL_MASKCA_P,
  373.  
  374.         GEN6_WM_KERNEL_MASKSA,
  375.         GEN6_WM_KERNEL_MASKSA_P,
  376.  
  377.         GEN6_WM_KERNEL_OPACITY,
  378.         GEN6_WM_KERNEL_OPACITY_P,
  379.  
  380.         GEN6_WM_KERNEL_VIDEO_PLANAR,
  381.         GEN6_WM_KERNEL_VIDEO_PACKED,
  382.     GEN6_KERNEL_COUNT
  383. };
  384.  
  385. struct gen6_render_state {
  386.         const struct gt_info *info;
  387.     struct kgem_bo *general_bo;
  388.  
  389.         uint32_t vs_state;
  390.         uint32_t sf_state;
  391.         uint32_t sf_mask_state;
  392.         uint32_t wm_state;
  393.         uint32_t wm_kernel[GEN6_KERNEL_COUNT][3];
  394.  
  395.         uint32_t cc_blend;
  396.  
  397.         uint32_t drawrect_offset;
  398.         uint32_t drawrect_limit;
  399.         uint32_t blend;
  400.         uint32_t samplers;
  401.         uint32_t kernel;
  402.  
  403.         uint16_t num_sf_outputs;
  404.         uint16_t ve_id;
  405.         uint16_t last_primitive;
  406.         int16_t floats_per_vertex;
  407.         uint16_t surface_table;
  408.  
  409.         bool needs_invariant;
  410.         bool first_state_packet;
  411. };
  412.  
  413. enum {
  414.         GEN7_WM_KERNEL_NOMASK = 0,
  415.         GEN7_WM_KERNEL_NOMASK_P,
  416.  
  417.         GEN7_WM_KERNEL_MASK,
  418.         GEN7_WM_KERNEL_MASK_P,
  419.  
  420.         GEN7_WM_KERNEL_MASKCA,
  421.         GEN7_WM_KERNEL_MASKCA_P,
  422.  
  423.         GEN7_WM_KERNEL_MASKSA,
  424.         GEN7_WM_KERNEL_MASKSA_P,
  425.  
  426.         GEN7_WM_KERNEL_OPACITY,
  427.         GEN7_WM_KERNEL_OPACITY_P,
  428.  
  429.         GEN7_WM_KERNEL_VIDEO_PLANAR,
  430.         GEN7_WM_KERNEL_VIDEO_PACKED,
  431.         GEN7_WM_KERNEL_COUNT
  432. };
  433.  
  434. struct gen7_render_state {
  435.         const struct gt_info *info;
  436.         struct kgem_bo *general_bo;
  437.  
  438.         uint32_t vs_state;
  439.         uint32_t sf_state;
  440.         uint32_t sf_mask_state;
  441.         uint32_t wm_state;
  442.         uint32_t wm_kernel[GEN7_WM_KERNEL_COUNT][3];
  443.  
  444.         uint32_t cc_blend;
  445.  
  446.         uint32_t drawrect_offset;
  447.         uint32_t drawrect_limit;
  448.         uint32_t blend;
  449.         uint32_t samplers;
  450.         uint32_t kernel;
  451.  
  452.         uint16_t num_sf_outputs;
  453.         uint16_t ve_id;
  454.         uint16_t last_primitive;
  455.         int16_t floats_per_vertex;
  456.         uint16_t surface_table;
  457.  
  458.         bool needs_invariant;
  459.         bool emit_flush;
  460. };
  461.  
  462. struct sna_static_stream {
  463.         uint32_t size, used;
  464.         uint8_t *data;
  465. };
  466.  
  467. int sna_static_stream_init(struct sna_static_stream *stream);
  468. uint32_t sna_static_stream_add(struct sna_static_stream *stream,
  469.                                const void *data, uint32_t len, uint32_t align);
  470. void *sna_static_stream_map(struct sna_static_stream *stream,
  471.                             uint32_t len, uint32_t align);
  472. uint32_t sna_static_stream_offsetof(struct sna_static_stream *stream,
  473.                                     void *ptr);
  474. unsigned sna_static_stream_compile_sf(struct sna *sna,
  475.                                       struct sna_static_stream *stream,
  476.                                       bool (*compile)(struct brw_compile *));
  477.  
  478. unsigned sna_static_stream_compile_wm(struct sna *sna,
  479.                                       struct sna_static_stream *stream,
  480.                                       bool (*compile)(struct brw_compile *, int),
  481.                                       int width);
  482. struct kgem_bo *sna_static_stream_fini(struct sna *sna,
  483.                                        struct sna_static_stream *stream);
  484.  
  485. struct kgem_bo *
  486. sna_render_get_solid(struct sna *sna,
  487.                      uint32_t color);
  488.  
  489. void
  490. sna_render_flush_solid(struct sna *sna);
  491.  
  492.  
  493. uint32_t sna_rgba_for_color(uint32_t color, int depth);
  494. uint32_t sna_rgba_to_color(uint32_t rgba, uint32_t format);
  495. bool sna_get_rgba_from_pixel(uint32_t pixel,
  496.                              uint16_t *red,
  497.                              uint16_t *green,
  498.                              uint16_t *blue,
  499.                              uint16_t *alpha,
  500.                              uint32_t format);
  501. bool sna_picture_is_solid(PicturePtr picture, uint32_t *color);
  502.  
  503. void no_render_init(struct sna *sna);
  504.  
  505. bool gen2_render_init(struct sna *sna);
  506. bool gen3_render_init(struct sna *sna);
  507. bool gen4_render_init(struct sna *sna);
  508. bool gen5_render_init(struct sna *sna);
  509. bool gen6_render_init(struct sna *sna);
  510. bool gen7_render_init(struct sna *sna);
  511.  
  512. #if 0
  513.  
  514. bool sna_tiling_composite(uint32_t op,
  515.                           PicturePtr src,
  516.                           PicturePtr mask,
  517.                           PicturePtr dst,
  518.                           int16_t src_x, int16_t src_y,
  519.                           int16_t mask_x, int16_t mask_y,
  520.                           int16_t dst_x, int16_t dst_y,
  521.                           int16_t width, int16_t height,
  522.                           struct sna_composite_op *tmp);
  523. bool sna_tiling_fill_boxes(struct sna *sna,
  524.                            CARD8 op,
  525.                            PictFormat format,
  526.                            const xRenderColor *color,
  527.                            PixmapPtr dst, struct kgem_bo *dst_bo,
  528.                            const BoxRec *box, int n);
  529.  
  530. bool sna_tiling_copy_boxes(struct sna *sna, uint8_t alu,
  531.                            PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  532.                            PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  533.                            const BoxRec *box, int n);
  534.  
  535. bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
  536.                                struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  537.                                struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  538.                                int bpp, const BoxRec *box, int nbox);
  539.  
  540. bool sna_blt_composite(struct sna *sna,
  541.                        uint32_t op,
  542.                        PicturePtr src,
  543.                        PicturePtr dst,
  544.                        int16_t src_x, int16_t src_y,
  545.                        int16_t dst_x, int16_t dst_y,
  546.                        int16_t width, int16_t height,
  547.                        struct sna_composite_op *tmp,
  548.                        bool fallback);
  549. bool sna_blt_composite__convert(struct sna *sna,
  550.                                 int x, int y,
  551.                                 int width, int height,
  552.                        struct sna_composite_op *tmp);
  553.  
  554. bool sna_blt_fill(struct sna *sna, uint8_t alu,
  555.                   struct kgem_bo *bo,
  556.                   int bpp,
  557.                   uint32_t pixel,
  558.                   struct sna_fill_op *fill);
  559.  
  560. bool sna_blt_copy(struct sna *sna, uint8_t alu,
  561.                   struct kgem_bo *src,
  562.                   struct kgem_bo *dst,
  563.                   int bpp,
  564.                   struct sna_copy_op *copy);
  565.  
  566. bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
  567.                         struct kgem_bo *bo,
  568.                         int bpp,
  569.                         uint32_t pixel,
  570.                         const BoxRec *box, int n);
  571.  
  572. bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
  573.                         struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  574.                         struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  575.                         int bpp,
  576.                         const BoxRec *box, int n);
  577. bool sna_blt_copy_boxes_fallback(struct sna *sna, uint8_t alu,
  578.                                  PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
  579.                                  PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
  580.                                  const BoxRec *box, int nbox);
  581.  
  582. bool _sna_get_pixel_from_rgba(uint32_t *pixel,
  583.                              uint16_t red,
  584.                              uint16_t green,
  585.                              uint16_t blue,
  586.                              uint16_t alpha,
  587.                              uint32_t format);
  588.  
  589. static inline bool
  590. sna_get_pixel_from_rgba(uint32_t * pixel,
  591.                         uint16_t red,
  592.                         uint16_t green,
  593.                         uint16_t blue,
  594.                         uint16_t alpha,
  595.                         uint32_t format)
  596. {
  597.         switch (format) {
  598.         case PICT_x8r8g8b8:
  599.                 alpha = 0xffff;
  600.                 /* fall through to re-use a8r8g8b8 expansion */
  601.         case PICT_a8r8g8b8:
  602.                 *pixel = ((alpha >> 8 << 24) |
  603.                           (red >> 8 << 16) |
  604.                           (green & 0xff00) |
  605.                           (blue >> 8));
  606.                 return TRUE;
  607.         case PICT_a8:
  608.                 *pixel = alpha >> 8;
  609.                 return TRUE;
  610.         }
  611.  
  612.         return _sna_get_pixel_from_rgba(pixel, red, green, blue, alpha, format);
  613. }
  614.  
  615. struct kgem_bo *
  616. __sna_render_pixmap_bo(struct sna *sna,
  617.                        PixmapPtr pixmap,
  618.                        const BoxRec *box,
  619.                        bool blt);
  620.  
  621. int
  622. sna_render_pixmap_bo(struct sna *sna,
  623.                      struct sna_composite_channel *channel,
  624.                      PixmapPtr pixmap,
  625.                      int16_t x, int16_t y,
  626.                      int16_t w, int16_t h,
  627.                      int16_t dst_x, int16_t dst_y);
  628.  
  629. bool
  630. sna_render_pixmap_partial(struct sna *sna,
  631.                           PixmapPtr pixmap,
  632.                           struct kgem_bo *bo,
  633.                           struct sna_composite_channel *channel,
  634.                           int16_t x, int16_t y,
  635.                           int16_t w, int16_t h);
  636.  
  637. int
  638. sna_render_picture_extract(struct sna *sna,
  639.                            PicturePtr picture,
  640.                            struct sna_composite_channel *channel,
  641.                            int16_t x, int16_t y,
  642.                            int16_t w, int16_t h,
  643.                            int16_t dst_x, int16_t dst_y);
  644.  
  645. int
  646. sna_render_picture_approximate_gradient(struct sna *sna,
  647.                                         PicturePtr picture,
  648.                                         struct sna_composite_channel *channel,
  649.                                         int16_t x, int16_t y,
  650.                                         int16_t w, int16_t h,
  651.                                         int16_t dst_x, int16_t dst_y);
  652.  
  653. int
  654. sna_render_picture_fixup(struct sna *sna,
  655.                          PicturePtr picture,
  656.                          struct sna_composite_channel *channel,
  657.                          int16_t x, int16_t y,
  658.                          int16_t w, int16_t h,
  659.                          int16_t dst_x, int16_t dst_y);
  660.  
  661. int
  662. sna_render_picture_convert(struct sna *sna,
  663.                            PicturePtr picture,
  664.                            struct sna_composite_channel *channel,
  665.                            PixmapPtr pixmap,
  666.                            int16_t x, int16_t y,
  667.                            int16_t w, int16_t h,
  668.                            int16_t dst_x, int16_t dst_y,
  669.                            bool fixup_alpha);
  670.  
  671. inline static void sna_render_composite_redirect_init(struct sna_composite_op *op)
  672. {
  673.         struct sna_composite_redirect *t = &op->redirect;
  674.         t->real_bo = NULL;
  675.         t->damage = NULL;
  676. }
  677.  
  678. bool
  679. sna_render_composite_redirect(struct sna *sna,
  680.                               struct sna_composite_op *op,
  681.                               int x, int y, int width, int height);
  682.  
  683. void
  684. sna_render_composite_redirect_done(struct sna *sna,
  685.                                    const struct sna_composite_op *op);
  686.  
  687. bool
  688. sna_composite_mask_is_opaque(PicturePtr mask);
  689.  
  690. #endif
  691. void sna_vertex_init(struct sna *sna);
  692.  
  693. static inline void sna_vertex_lock(struct sna_render *r)
  694. {
  695. //      pthread_mutex_lock(&r->lock);
  696. }
  697.  
  698. static inline void sna_vertex_acquire__locked(struct sna_render *r)
  699. {
  700.         r->active++;
  701. }
  702.  
  703. static inline void sna_vertex_unlock(struct sna_render *r)
  704. {
  705. //      pthread_mutex_unlock(&r->lock);
  706. }
  707.  
  708. static inline void sna_vertex_release__locked(struct sna_render *r)
  709. {
  710.         assert(r->active > 0);
  711.         --r->active;
  712. //      if (--r->active == 0)
  713. //              pthread_cond_signal(&r->wait);
  714. }
  715.  
  716. static inline bool sna_vertex_wait__locked(struct sna_render *r)
  717. {
  718.         bool was_active = r->active;
  719. //      while (r->active)
  720. //              pthread_cond_wait(&r->wait, &r->lock);
  721.         return was_active;
  722. }
  723.  
  724. #endif /* SNA_RENDER_H */
  725.