From 8097c887023b72744cb2cb943c2deca7ca0c404a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jul 2015 13:11:20 -0700 Subject: [PATCH] glamor: Drop tracking of the last picture attached to pixmaps. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eric Anholt Acked-by: Michel Dänzer Reviewed-by: Dave Airlie --- glamor/glamor.c | 11 ---------- glamor/glamor_picture.c | 48 ----------------------------------------- glamor/glamor_priv.h | 15 ------------- glamor/glamor_render.c | 3 --- glamor/glamor_utils.h | 10 ++++----- glamor/glamor_window.c | 32 --------------------------- 6 files changed, 5 insertions(+), 114 deletions(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index 04c548d75..6dcc25954 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -649,15 +649,6 @@ glamor_init(ScreenPtr screen, unsigned int flags) glamor_priv->saved_procs.glyphs = ps->Glyphs; ps->Glyphs = glamor_composite_glyphs; - glamor_priv->saved_procs.create_picture = ps->CreatePicture; - ps->CreatePicture = glamor_create_picture; - - glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture; - ps->DestroyPicture = glamor_destroy_picture; - - glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap; - screen->SetWindowPixmap = glamor_set_window_pixmap; - glamor_init_vbo(screen); glamor_init_pixmap_fbo(screen); glamor_init_finish_access_shaders(screen); @@ -719,10 +710,8 @@ glamor_close_screen(ScreenPtr screen) ps->Composite = glamor_priv->saved_procs.composite; ps->Trapezoids = glamor_priv->saved_procs.trapezoids; ps->Triangles = glamor_priv->saved_procs.triangles; - ps->CreatePicture = glamor_priv->saved_procs.create_picture; ps->CompositeRects = glamor_priv->saved_procs.composite_rects; ps->Glyphs = glamor_priv->saved_procs.glyphs; - screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap; screen_pixmap = screen->GetScreenPixmap(screen); glamor_pixmap_destroy_fbo(screen_pixmap); diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c index c36d9d6c9..691f179c7 100644 --- a/glamor/glamor_picture.c +++ b/glamor/glamor_picture.c @@ -900,51 +900,3 @@ glamor_upload_picture_to_texture(PicturePtr picture) else return GLAMOR_UPLOAD_FAILED; } - -/* - * We should already have drawable attached to it, if it has one. - * Then set the attached pixmap to is_picture format, and set - * the pict format. - * */ -int -glamor_create_picture(PicturePtr picture) -{ - PixmapPtr pixmap; - glamor_pixmap_private *pixmap_priv; - - if (!picture || !picture->pDrawable) - return 0; - - pixmap = glamor_get_drawable_pixmap(picture->pDrawable); - pixmap_priv = glamor_get_pixmap_private(pixmap); - pixmap_priv->is_picture = 1; - pixmap_priv->picture = picture; - - return miCreatePicture(picture); -} - -void -glamor_destroy_picture(PicturePtr picture) -{ - PixmapPtr pixmap; - glamor_pixmap_private *pixmap_priv; - - if (!picture || !picture->pDrawable) - return; - - pixmap = glamor_get_drawable_pixmap(picture->pDrawable); - pixmap_priv = glamor_get_pixmap_private(pixmap); - - if (pixmap_priv) { - pixmap_priv->is_picture = 0; - pixmap_priv->picture = NULL; - } - miDestroyPicture(picture); -} - -void -glamor_picture_format_fixup(PicturePtr picture, - glamor_pixmap_private *pixmap_priv) -{ - pixmap_priv->picture = picture; -} diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 2792afa3c..5989dc4d4 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -173,9 +173,6 @@ struct glamor_saved_procs { BitmapToRegionProcPtr bitmap_to_region; TrianglesProcPtr triangles; AddTrapsProcPtr addtraps; - CreatePictureProcPtr create_picture; - DestroyPictureProcPtr destroy_picture; - SetWindowPixmapProcPtr set_window_pixmap; #if XSYNC SyncScreenFuncsRec sync_screen_funcs; #endif @@ -350,13 +347,10 @@ typedef struct glamor_pixmap_private { * that data on glamor_finish_access(). */ glamor_access_t map_access; - /** Set if the pixmap is currenty attached to a Picture. */ - unsigned char is_picture:1; glamor_pixmap_fbo *fbo; /** current fbo's coords in the whole pixmap. */ BoxRec box; int drm_stride; - PicturePtr picture; GLuint pbo; RegionRec prepare_region; Bool prepared; @@ -734,15 +728,6 @@ Bool glamor_composite_largepixmap_region(CARD8 op, **/ enum glamor_pixmap_status glamor_upload_picture_to_texture(PicturePtr picture); -int glamor_create_picture(PicturePtr picture); - -void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap); - -void glamor_destroy_picture(PicturePtr picture); - -void glamor_picture_format_fixup(PicturePtr picture, - glamor_pixmap_private *pixmap_priv); - void glamor_add_traps(PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntrap, xTrap *traps); diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 3048cd8bb..c3a8f1771 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -936,9 +936,6 @@ glamor_composite_choose_shader(CARD8 op, goto fail; } - if (source->format != saved_source_format) { - glamor_picture_format_fixup(source, source_pixmap_priv); - } /* XXX * By default, glamor_upload_picture_to_texture will wire alpha to 1 * if one picture doesn't have alpha. So we don't do that again in diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index 81820069e..59e6b6479 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -33,6 +33,7 @@ #define __GLAMOR_UTILS_H__ #include "glamor_prepare.h" +#include "mipict.h" #define v_from_x_coord_x(_xscale_, _x_) ( 2 * (_x_) * (_xscale_) - 1.0) #define v_from_x_coord_y(_yscale_, _y_) (-2 * (_y_) * (_yscale_) + 1.0) @@ -756,7 +757,6 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy) || _depth_ == 30 \ || _depth_ == 32) -#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv->is_picture == 1) #define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL) /** @@ -1287,9 +1287,9 @@ glamor_compare_pictures(ScreenPtr screen, if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) { if (fst_generated) - glamor_destroy_picture(fst_picture); + miDestroyPicture(fst_picture); if (snd_generated) - glamor_destroy_picture(snd_picture); + miDestroyPicture(snd_picture); ErrorF("Different pixmap depth can not compare!\n"); return; @@ -1315,9 +1315,9 @@ glamor_compare_pictures(ScreenPtr screen, glamor_finish_access(&snd_pixmap->drawable); if (fst_generated) - glamor_destroy_picture(fst_picture); + miDestroyPicture(fst_picture); if (snd_generated) - glamor_destroy_picture(snd_picture); + miDestroyPicture(snd_picture); return; } diff --git a/glamor/glamor_window.c b/glamor/glamor_window.c index a39e723ef..5fd463b43 100644 --- a/glamor/glamor_window.c +++ b/glamor/glamor_window.c @@ -65,35 +65,3 @@ glamor_change_window_attributes(WindowPtr pWin, unsigned long mask) } return TRUE; } - -void -glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap) -{ - ScreenPtr screen = win->drawable.pScreen; - glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - PixmapPtr old = screen->GetWindowPixmap(win); - - if (pPixmap != old) { - glamor_pixmap_private *pixmap_priv; - PicturePtr pic = NULL; - - pixmap_priv = glamor_get_pixmap_private(old); - if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) && - pixmap_priv->picture->pDrawable == (DrawablePtr) win) { - pic = pixmap_priv->picture; - pixmap_priv->is_picture = 0; - pixmap_priv->picture = NULL; - } - - pixmap_priv = glamor_get_pixmap_private(pPixmap); - if (pixmap_priv) { - pixmap_priv->is_picture = ! !pic; - pixmap_priv->picture = pic; - } - } - - screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap; - (screen->SetWindowPixmap) (win, pPixmap); - glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap; - screen->SetWindowPixmap = glamor_set_window_pixmap; -}