Home | History | Annotate | Download | only in xorg
      1 #ifndef XORG_RENDERER_H
      2 #define XORG_RENDERER_H
      3 
      4 #include "pipe/p_context.h"
      5 #include "pipe/p_state.h"
      6 
      7 struct xorg_shaders;
      8 struct exa_pixmap_priv;
      9 
     10 /* max number of vertices *
     11  * max number of attributes per vertex *
     12  * max number of components per attribute
     13  *
     14  * currently the max is 100 quads
     15  */
     16 #define BUF_SIZE (100 * 4 * 3 * 4)
     17 
     18 struct xorg_renderer {
     19    struct pipe_context *pipe;
     20 
     21    struct cso_context *cso;
     22    struct xorg_shaders *shaders;
     23 
     24    int fb_width;
     25    int fb_height;
     26    struct pipe_resource *vs_const_buffer;
     27    struct pipe_resource *fs_const_buffer;
     28 
     29    float buffer[BUF_SIZE];
     30    int buffer_size;
     31    struct pipe_vertex_element velems[3];
     32 
     33    /* number of attributes per vertex for the current
     34     * draw operation */
     35    int attrs_per_vertex;
     36 };
     37 
     38 struct xorg_renderer *renderer_create(struct pipe_context *pipe);
     39 void renderer_destroy(struct xorg_renderer *renderer);
     40 
     41 void renderer_bind_destination(struct xorg_renderer *r,
     42                                struct pipe_surface *surface,
     43                                int width,
     44                                int height );
     45 
     46 void renderer_bind_framebuffer(struct xorg_renderer *r,
     47                                struct exa_pixmap_priv *priv);
     48 void renderer_bind_viewport(struct xorg_renderer *r,
     49                             struct exa_pixmap_priv *dst);
     50 void renderer_set_constants(struct xorg_renderer *r,
     51                             int shader_type,
     52                             const float *buffer,
     53                             int size);
     54 
     55 
     56 void renderer_draw_yuv(struct xorg_renderer *r,
     57                        float src_x, float src_y, float src_w, float src_h,
     58                        int dst_x, int dst_y, int dst_w, int dst_h,
     59                        struct pipe_resource **textures);
     60 
     61 void renderer_begin_solid(struct xorg_renderer *r);
     62 void renderer_solid(struct xorg_renderer *r,
     63                     int x0, int y0,
     64                     int x1, int y1,
     65                     float *color);
     66 
     67 void renderer_begin_textures(struct xorg_renderer *r,
     68                              int num_textures);
     69 
     70 void renderer_texture(struct xorg_renderer *r,
     71                       int *pos,
     72                       int width, int height,
     73                       struct pipe_sampler_view **textures,
     74                       int num_textures,
     75                       float *src_matrix,
     76                       float *mask_matrix);
     77 
     78 void renderer_draw_flush(struct xorg_renderer *r);
     79 
     80 
     81 #endif
     82