Subversion Repositories Kolibri OS

Rev

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