Commit 28fcd7cd authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

Rearrange data structure and remove unused fileds.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent bdd72da0
......@@ -343,60 +343,60 @@ glamor_init(ScreenPtr screen, unsigned int flags)
goto fail;
}
glamor_priv->saved_close_screen = screen->CloseScreen;
glamor_priv->saved_procs.close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen;
glamor_priv->saved_create_gc = screen->CreateGC;
glamor_priv->saved_procs.create_gc = screen->CreateGC;
screen->CreateGC = glamor_create_gc;
glamor_priv->saved_create_pixmap = screen->CreatePixmap;
glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap;
screen->CreatePixmap = glamor_create_pixmap;
glamor_priv->saved_destroy_pixmap = screen->DestroyPixmap;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
glamor_priv->saved_get_spans = screen->GetSpans;
glamor_priv->saved_procs.get_spans = screen->GetSpans;
screen->GetSpans = glamor_get_spans;
glamor_priv->saved_get_image = screen->GetImage;
glamor_priv->saved_procs.get_image = screen->GetImage;
screen->GetImage = glamor_get_image;
glamor_priv->saved_change_window_attributes =
glamor_priv->saved_procs.change_window_attributes =
screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes =
glamor_change_window_attributes;
glamor_priv->saved_copy_window = screen->CopyWindow;
glamor_priv->saved_procs.copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_bitmap_to_region =
glamor_priv->saved_procs.bitmap_to_region =
screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
}
#ifdef RENDER
if (flags & GLAMOR_USE_PICTURE_SCREEN) {
glamor_priv->saved_composite = ps->Composite;
glamor_priv->saved_procs.composite = ps->Composite;
ps->Composite = glamor_composite;
glamor_priv->saved_trapezoids = ps->Trapezoids;
glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
ps->Trapezoids = glamor_trapezoids;
glamor_priv->saved_glyphs = ps->Glyphs;
glamor_priv->saved_procs.glyphs = ps->Glyphs;
ps->Glyphs = glamor_glyphs;
glamor_priv->saved_triangles = ps->Triangles;
glamor_priv->saved_procs.triangles = ps->Triangles;
ps->Triangles = glamor_triangles;
glamor_priv->saved_addtraps = ps->AddTraps;
glamor_priv->saved_procs.addtraps = ps->AddTraps;
ps->AddTraps = glamor_add_traps;
glamor_priv->saved_unrealize_glyph = ps->UnrealizeGlyph;
glamor_priv->saved_procs.unrealize_glyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = glamor_glyph_unrealize;
}
glamor_priv->saved_create_picture = ps->CreatePicture;
glamor_priv->saved_procs.create_picture = ps->CreatePicture;
ps->CreatePicture = glamor_create_picture;
glamor_priv->saved_destroy_picture = ps->DestroyPicture;
glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
ps->DestroyPicture = glamor_destroy_picture;
glamor_init_composite_shaders(screen);
#endif
......@@ -430,22 +430,22 @@ glamor_close_screen(int idx, ScreenPtr screen)
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_close_screen;
screen->CreateGC = glamor_priv->saved_create_gc;
screen->CreatePixmap = glamor_priv->saved_create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_destroy_pixmap;
screen->GetSpans = glamor_priv->saved_get_spans;
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
screen->CreateGC = glamor_priv->saved_procs.create_gc;
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
screen->GetSpans = glamor_priv->saved_procs.get_spans;
screen->ChangeWindowAttributes =
glamor_priv->saved_change_window_attributes;
screen->CopyWindow = glamor_priv->saved_copy_window;
screen->BitmapToRegion = glamor_priv->saved_bitmap_to_region;
glamor_priv->saved_procs.change_window_attributes;
screen->CopyWindow = glamor_priv->saved_procs.copy_window;
screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
#ifdef RENDER
if (ps) {
ps->Composite = glamor_priv->saved_composite;
ps->Trapezoids = glamor_priv->saved_trapezoids;
ps->Glyphs = glamor_priv->saved_glyphs;
ps->Triangles = glamor_priv->saved_triangles;
ps->CreatePicture = glamor_priv->saved_create_picture;
ps->Composite = glamor_priv->saved_procs.composite;
ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
ps->Glyphs = glamor_priv->saved_procs.glyphs;
ps->Triangles = glamor_priv->saved_procs.triangles;
ps->CreatePicture = glamor_priv->saved_procs.create_picture;
}
#endif
if (glamor_priv->vb)
......
......@@ -4,6 +4,7 @@
#include <stdlib.h>
#include "mipict.h"
#include "glamor_priv.h"
/* Upload picture to texture. We may need to flip the y axis or
......@@ -73,7 +74,7 @@ glamor_create_picture(PicturePtr picture)
if (pixmap_priv->type == GLAMOR_TEXTURE_DRM)
glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
}
return glamor_priv->saved_create_picture(picture);
return miCreatePicture(picture);
}
void
......@@ -95,7 +96,7 @@ glamor_destroy_picture(PicturePtr picture)
pixmap_priv->is_picture = 0;
pixmap_priv->pict_format = 0;
}
glamor_priv->saved_destroy_picture(picture);
miDestroyPicture(picture);
}
void
......
......@@ -124,7 +124,6 @@ enum glamor_gl_flavor {
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_NUM_GLYPH_CACHES 4
#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2
typedef struct {
......@@ -137,46 +136,57 @@ typedef struct {
#include "glamor_gl_dispatch.h"
typedef struct glamor_screen_private {
CloseScreenProcPtr saved_close_screen;
CreateGCProcPtr saved_create_gc;
CreatePixmapProcPtr saved_create_pixmap;
DestroyPixmapProcPtr saved_destroy_pixmap;
GetSpansProcPtr saved_get_spans;
GetImageProcPtr saved_get_image;
CompositeProcPtr saved_composite;
TrapezoidsProcPtr saved_trapezoids;
GlyphsProcPtr saved_glyphs;
ChangeWindowAttributesProcPtr saved_change_window_attributes;
CopyWindowProcPtr saved_copy_window;
BitmapToRegionProcPtr saved_bitmap_to_region;
TrianglesProcPtr saved_triangles;
AddTrapsProcPtr saved_addtraps;
CreatePictureProcPtr saved_create_picture;
DestroyPictureProcPtr saved_destroy_picture;
UnrealizeGlyphProcPtr saved_unrealize_glyph;
struct glamor_saved_procs {
CloseScreenProcPtr close_screen;
CreateGCProcPtr create_gc;
CreatePixmapProcPtr create_pixmap;
DestroyPixmapProcPtr destroy_pixmap;
GetSpansProcPtr get_spans;
GetImageProcPtr get_image;
CompositeProcPtr composite;
TrapezoidsProcPtr trapezoids;
GlyphsProcPtr glyphs;
ChangeWindowAttributesProcPtr change_window_attributes;
CopyWindowProcPtr copy_window;
BitmapToRegionProcPtr bitmap_to_region;
TrianglesProcPtr triangles;
AddTrapsProcPtr addtraps;
CreatePictureProcPtr create_picture;
DestroyPictureProcPtr destroy_picture;
UnrealizeGlyphProcPtr unrealize_glyph;
};
typedef struct glamor_screen_private {
struct glamor_gl_dispatch dispatch;
int yInverted;
int screen_fbo;
enum glamor_gl_flavor gl_flavor;
int has_pack_invert;
int has_fbo_blit;
int max_fbo_size;
/* glamor_solid */
GLint solid_prog;
GLint solid_color_uniform_location;
/* vertext/elment_index buffer object for render */
GLuint vbo, ebo;
int vbo_offset;
int vbo_size;
char *vb;
int vb_stride;
enum glamor_gl_flavor gl_flavor;
int has_pack_invert;
int has_fbo_blit;
int max_fbo_size;
Bool has_source_coords, has_mask_coords;
int render_nr_verts;
glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT]
[SHADER_MASK_COUNT]
[SHADER_IN_COUNT];
glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
Bool glyph_cache_initialized;
/* glamor_finishaccess */
/* shaders to restore a texture to another texture.*/
GLint finish_access_prog[2];
GLint finish_access_no_revert[2];
GLint finish_access_swap_rb[2];
/* glamor_solid */
GLint solid_prog;
GLint solid_color_uniform_location;
/* glamor_tile */
GLint tile_prog;
......@@ -185,19 +195,11 @@ typedef struct glamor_screen_private {
GLint put_image_xybitmap_fg_uniform_location;
GLint put_image_xybitmap_bg_uniform_location;
/* glamor_composite */
glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT]
[SHADER_MASK_COUNT][SHADER_IN_COUNT];
Bool has_source_coords, has_mask_coords;
int render_nr_verts;
glamor_pixmap_validate_function_t *pixmap_validate_funcs;
glamor_glyph_cache_t glyph_caches[GLAMOR_NUM_GLYPH_CACHES];
int screen_fbo;
struct glamor_saved_procs saved_procs;
char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1];
int delayed_fallback_pending;
glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
Bool glyph_cache_initialized;
struct glamor_gl_dispatch dispatch;
glamor_pixmap_validate_function_t *pixmap_validate_funcs;
} glamor_screen_private;
typedef enum glamor_access {
......@@ -236,7 +238,6 @@ typedef union _glamor_pending_op {
* @container: The corresponding pixmap's pointer.
**/
typedef struct glamor_pixmap_private {
glamor_pixmap_type_t type;
unsigned char gl_fbo:1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment