(!1975) glamor: BUG_RETURN*() on pixmap private data
Usually shouldn't happen trying to accessing pixmap's glamor private data w/o having it initialized first. But just in case there's some subtle bug, adding extra checks, which don't cost us much. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									9060792354
								
							
						
					
					
						commit
						a3eae0f568
					
				|  | @ -30,10 +30,14 @@ | |||
|  * This file covers the initialization and teardown of glamor, and has various | ||||
|  * functions not responsible for performing rendering. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "mipict.h" | ||||
| 
 | ||||
|  | @ -95,6 +99,7 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type) | |||
|     glamor_pixmap_private *pixmap_priv; | ||||
| 
 | ||||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
|     pixmap_priv->type = type; | ||||
|     glamor_init_pixmap_private_small(pixmap, pixmap_priv); | ||||
| } | ||||
|  | @ -110,6 +115,8 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) | |||
|     glamor_priv = glamor_get_screen_private(screen); | ||||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     if (pixmap_priv->fbo) { | ||||
|         fbo = glamor_pixmap_detach_fbo(pixmap_priv); | ||||
|         glamor_destroy_fbo(glamor_priv, fbo); | ||||
|  | @ -141,6 +148,7 @@ glamor_clear_pixmap(PixmapPtr pixmap) | |||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
|     pixmap_format = glamor_format_for_pixmap(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
|     assert(pixmap_priv->fbo != NULL); | ||||
| 
 | ||||
|     glamor_pixmap_clear_fbo(glamor_priv, pixmap_priv->fbo, pixmap_format); | ||||
|  | @ -224,6 +232,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, | |||
|         pixmap = fbCreatePixmap(screen, 0, 0, depth, usage); | ||||
| 
 | ||||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
|     BUG_RETURN_VAL(!pixmap_priv, NULL); | ||||
| 
 | ||||
|     pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR; | ||||
| 
 | ||||
|  | @ -427,6 +436,8 @@ glamor_format_for_pixmap(PixmapPtr pixmap) | |||
|     glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen); | ||||
|     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, NULL); | ||||
| 
 | ||||
|     if (pixmap_priv->is_cbcr) | ||||
|         return &glamor_priv->cbcr_format; | ||||
|     else | ||||
|  | @ -1012,6 +1023,9 @@ _glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, | |||
| 
 | ||||
|     if (!glamor_priv->dri3_enabled) | ||||
|         return 0; | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, 0); | ||||
| 
 | ||||
|     switch (pixmap_priv->type) { | ||||
|     case GLAMOR_TEXTURE_DRM: | ||||
|     case GLAMOR_TEXTURE_ONLY: | ||||
|  | @ -1089,6 +1103,8 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size) | |||
| { | ||||
|     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, -1); | ||||
| 
 | ||||
|     switch (pixmap_priv->type) { | ||||
|     case GLAMOR_TEXTURE_DRM: | ||||
|     case GLAMOR_TEXTURE_ONLY: | ||||
|  |  | |||
|  | @ -19,9 +19,13 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <stdlib.h> | ||||
| #include "Xprintf.h" | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "Xprintf.h" | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_transform.h" | ||||
| #include "glamor_transfer.h" | ||||
|  | @ -267,6 +271,8 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst, | |||
| 
 | ||||
|         glUniform1i(prog->atlas_uniform, 1); | ||||
| 
 | ||||
|         BUG_RETURN(!pixmap_priv); | ||||
| 
 | ||||
|         glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|             BoxPtr box = RegionRects(dst->pCompositeClip); | ||||
|             int nbox = RegionNumRects(dst->pCompositeClip); | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_transfer.h" | ||||
|  | @ -446,6 +449,8 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src, | |||
| 
 | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!src_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(src_priv, src_box_index) { | ||||
|         BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_index); | ||||
| 
 | ||||
|  | @ -456,6 +461,8 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src, | |||
|         if (!glamor_use_program(dst, gc, prog, &args)) | ||||
|             goto bail_ctx; | ||||
| 
 | ||||
|         BUG_RETURN_VAL(!dst_priv, FALSE); | ||||
| 
 | ||||
|         glamor_pixmap_loop(dst_priv, dst_box_index) { | ||||
|             BoxRec scissor = { | ||||
|                 .x1 = max(-args.dx, bounds.x1), | ||||
|  | @ -701,6 +708,9 @@ glamor_copy_gl(DrawablePtr src, | |||
|     glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap); | ||||
|     glamor_pixmap_private *dst_priv = glamor_get_pixmap_private(dst_pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!dst_priv, FALSE); | ||||
|     BUG_RETURN_VAL(!src_priv, FALSE); | ||||
| 
 | ||||
|     if (GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_priv)) { | ||||
|         if (GLAMOR_PIXMAP_PRIV_HAS_FBO(src_priv)) { | ||||
|             if (glamor_copy_needs_temp(src, dst, box, nbox, dx, dy)) | ||||
|  |  | |||
|  | @ -30,9 +30,12 @@ | |||
|  * | ||||
|  * This file covers core X rendering in glamor. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| 
 | ||||
| Bool | ||||
|  | @ -41,6 +44,8 @@ glamor_get_drawable_location(const DrawablePtr drawable) | |||
|     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); | ||||
|     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     if (pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) | ||||
|         return 'm'; | ||||
|     else | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_program.h" | ||||
|  | @ -210,6 +213,8 @@ glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog, | |||
| 
 | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         int nbox = RegionNumRects(gc->pCompositeClip); | ||||
|         BoxPtr box = RegionRects(gc->pCompositeClip); | ||||
|  |  | |||
|  | @ -43,6 +43,7 @@ | |||
| #include <drm_fourcc.h> | ||||
| 
 | ||||
| #include "glamor/glamor_priv.h" | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_egl.h" | ||||
| #include "glamor_glx_provider.h" | ||||
|  | @ -152,6 +153,8 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image, | |||
|         glamor_get_pixmap_private(pixmap); | ||||
|     EGLImageKHR old; | ||||
| 
 | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
| 
 | ||||
|     old = pixmap_priv->image; | ||||
|     if (old) { | ||||
|         ScreenPtr                               screen = pixmap->drawable.pScreen; | ||||
|  | @ -261,6 +264,8 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) | |||
|     PixmapPtr exported; | ||||
|     GCPtr scratch_gc; | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     if (pixmap_priv->image && | ||||
|         (modifiers_ok || !pixmap_priv->used_modifiers)) | ||||
|         return TRUE; | ||||
|  | @ -363,6 +368,8 @@ glamor_gbm_bo_from_pixmap_internal(ScreenPtr screen, PixmapPtr pixmap) | |||
|     struct glamor_pixmap_private *pixmap_priv = | ||||
|         glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, NULL); | ||||
| 
 | ||||
|     if (!pixmap_priv->image) | ||||
|         return NULL; | ||||
| 
 | ||||
|  | @ -753,6 +760,8 @@ glamor_egl_destroy_pixmap(PixmapPtr pixmap) | |||
|         struct glamor_pixmap_private *pixmap_priv = | ||||
|             glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|         BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|         if (pixmap_priv->image) | ||||
|             eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); | ||||
|     } | ||||
|  | @ -780,8 +789,10 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back) | |||
| 
 | ||||
|     temp_img = back_priv->image; | ||||
|     temp_mod = back_priv->used_modifiers; | ||||
|     BUG_RETURN(!back_priv); | ||||
|     back_priv->image = front_priv->image; | ||||
|     back_priv->used_modifiers = front_priv->used_modifiers; | ||||
|     BUG_RETURN(!front_priv); | ||||
|     front_priv->image = temp_img; | ||||
|     front_priv->used_modifiers = temp_mod; | ||||
| 
 | ||||
|  | @ -800,7 +811,9 @@ glamor_egl_close_screen(ScreenPtr screen) | |||
|     scrn = xf86ScreenToScrn(screen); | ||||
|     glamor_egl = glamor_egl_get_screen_private(scrn); | ||||
|     screen_pixmap = screen->GetScreenPixmap(screen); | ||||
| 
 | ||||
|     pixmap_priv = glamor_get_pixmap_private(screen_pixmap); | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); | ||||
|     pixmap_priv->image = NULL; | ||||
|  |  | |||
|  | @ -25,10 +25,13 @@ | |||
|  *    Zhigang Gong <zhigang.gong@gmail.com> | ||||
|  * | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #include "glamor/glamor_priv.h" | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| void | ||||
| glamor_destroy_fbo(glamor_screen_private *glamor_priv, | ||||
|  | @ -283,6 +286,7 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo) | |||
|     glamor_pixmap_private *pixmap_priv; | ||||
| 
 | ||||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
| 
 | ||||
|     if (pixmap_priv->fbo) | ||||
|         return; | ||||
|  | @ -309,6 +313,7 @@ glamor_pixmap_destroy_fbo(PixmapPtr pixmap) | |||
| 
 | ||||
|     if (glamor_pixmap_priv_is_large(priv)) { | ||||
|         int i; | ||||
|         BUG_RETURN(!priv); | ||||
| 
 | ||||
|         for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++) | ||||
|             glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]); | ||||
|  | @ -331,6 +336,9 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, int flag) | |||
| 
 | ||||
|     glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); | ||||
|     pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     if (pixmap_priv->fbo == NULL) { | ||||
| 
 | ||||
|         fbo = glamor_create_fbo(glamor_priv, pixmap, pixmap->drawable.width, | ||||
|  | @ -363,6 +371,8 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back) | |||
| 
 | ||||
|     front_priv = glamor_get_pixmap_private(front); | ||||
|     back_priv = glamor_get_pixmap_private(back); | ||||
|     BUG_RETURN(!front_priv); | ||||
|     BUG_RETURN(!back_priv); | ||||
|     temp_fbo = front_priv->fbo; | ||||
|     front_priv->fbo = back_priv->fbo; | ||||
|     back_priv->fbo = temp_fbo; | ||||
|  |  | |||
|  | @ -25,6 +25,9 @@ | |||
|  *    Zhigang Gong <zhigang.gong@gmail.com> | ||||
|  * | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include <dixfontstr.h> | ||||
|  | @ -69,6 +72,8 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc, | |||
|     start_x += drawable->x; | ||||
|     y += drawable->y; | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         int x; | ||||
|         int n; | ||||
|  | @ -233,6 +238,8 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap, | |||
| 
 | ||||
|     glamor_put_vbo_space(screen); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         if (!glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE, | ||||
|                                              prog->matrix_uniform, NULL, NULL)) | ||||
|  |  | |||
|  | @ -1,6 +1,11 @@ | |||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> /* For INT16_MAX */ | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| 
 | ||||
| static void | ||||
|  | @ -190,6 +195,7 @@ glamor_compute_clipped_regions_ext(PixmapPtr pixmap, | |||
|         small_box.y2 = block_h; | ||||
|     } | ||||
|     else { | ||||
|         BUG_RETURN_VAL(!pixmap_priv, NULL); | ||||
|         glamor_pixmap_private *priv = __glamor_large(pixmap_priv); | ||||
| 
 | ||||
|         clipped_regions = __glamor_compute_clipped_regions(priv->block_w, | ||||
|  | @ -1171,7 +1177,8 @@ glamor_composite_largepixmap_region(CARD8 op, | |||
|         && glamor_pixmap_priv_is_large(source_pixmap_priv)) { | ||||
|         /* XXX self-copy... */ | ||||
|         need_free_source_pixmap_priv = source_pixmap_priv; | ||||
|         source_pixmap_priv = malloc(sizeof(*source_pixmap_priv)); | ||||
|         source_pixmap_priv = calloc(1, sizeof(*source_pixmap_priv)); | ||||
|         BUG_RETURN_VAL(!source_pixmap_priv, FALSE); | ||||
|         *source_pixmap_priv = *need_free_source_pixmap_priv; | ||||
|         need_free_source_pixmap_priv = source_pixmap_priv; | ||||
|     } | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_program.h" | ||||
|  | @ -100,6 +103,8 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc, | |||
| 
 | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         int nbox = RegionNumRects(gc->pCompositeClip); | ||||
|         BoxPtr box = RegionRects(gc->pCompositeClip); | ||||
|  |  | |||
|  | @ -35,7 +35,9 @@ | |||
|  * back to software (readback is more expensive than the upload we do | ||||
|  * here, and you'd have to re-upload the fallback output anyway). | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
|  | @ -286,6 +288,7 @@ glamor_upload_picture_to_texture(PicturePtr picture) | |||
|     const struct glamor_format *f = glamor_format_for_pixmap(pixmap); | ||||
| 
 | ||||
|     assert(glamor_pixmap_is_memory(pixmap)); | ||||
|     assert(pixmap_priv); | ||||
|     assert(!pixmap_priv->fbo); | ||||
| 
 | ||||
|     glamor_make_current(glamor_priv); | ||||
|  |  | |||
|  | @ -25,6 +25,9 @@ | |||
|  *    Zhigang Gong <zhigang.gong@linux.intel.com> | ||||
|  * | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_transform.h" | ||||
|  | @ -88,6 +91,8 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint | |||
| 
 | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         int nbox = RegionNumRects(gc->pCompositeClip); | ||||
|         BoxPtr box = RegionRects(gc->pCompositeClip); | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_prepare.h" | ||||
|  | @ -41,6 +44,8 @@ glamor_prep_drawable_box(DrawablePtr drawable, glamor_access_t access, BoxPtr bo | |||
|     RegionRec                   region; | ||||
|     int                         off_x, off_y; | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
| 
 | ||||
|     if (priv->type == GLAMOR_DRM_ONLY) | ||||
|         return FALSE; | ||||
| 
 | ||||
|  | @ -159,6 +164,8 @@ glamor_finish_access(DrawablePtr drawable) | |||
|     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) | ||||
|         return; | ||||
| 
 | ||||
|     BUG_RETURN(!priv); | ||||
| 
 | ||||
|     if (!priv->prepared) | ||||
|         return; | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,6 +31,8 @@ | |||
| 
 | ||||
| #include <X11/Xfuncproto.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor.h" | ||||
| #include "xvdix.h" | ||||
| 
 | ||||
|  | @ -463,7 +465,7 @@ static inline Bool | |||
| glamor_pixmap_drm_only(PixmapPtr pixmap) | ||||
| { | ||||
|     glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
|     return priv->type == GLAMOR_DRM_ONLY; | ||||
| } | ||||
| 
 | ||||
|  | @ -474,7 +476,7 @@ static inline Bool | |||
| glamor_pixmap_is_memory(PixmapPtr pixmap) | ||||
| { | ||||
|     glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
|     return priv->type == GLAMOR_MEMORY; | ||||
| } | ||||
| 
 | ||||
|  | @ -484,12 +486,14 @@ glamor_pixmap_is_memory(PixmapPtr pixmap) | |||
| static inline Bool | ||||
| glamor_pixmap_priv_is_large(glamor_pixmap_private *priv) | ||||
| { | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
|     return priv->block_wcnt > 1 || priv->block_hcnt > 1; | ||||
| } | ||||
| 
 | ||||
| static inline Bool | ||||
| glamor_pixmap_priv_is_small(glamor_pixmap_private *priv) | ||||
| { | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
|     return priv->block_wcnt <= 1 && priv->block_hcnt <= 1; | ||||
| } | ||||
| 
 | ||||
|  | @ -507,7 +511,7 @@ static inline Bool | |||
| glamor_pixmap_has_fbo(PixmapPtr pixmap) | ||||
| { | ||||
|     glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!priv, FALSE); | ||||
|     return priv->gl_fbo == GLAMOR_FBO_NORMAL; | ||||
| } | ||||
| 
 | ||||
|  | @ -515,6 +519,7 @@ static inline void | |||
| glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx) | ||||
| { | ||||
|     if (glamor_pixmap_priv_is_large(priv)) { | ||||
|         BUG_RETURN(!priv); | ||||
|         priv->fbo = priv->fbo_array[idx]; | ||||
|         priv->box = priv->box_array[idx]; | ||||
|     } | ||||
|  | @ -523,6 +528,7 @@ glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx) | |||
| static inline glamor_pixmap_fbo * | ||||
| glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int box) | ||||
| { | ||||
|     assert(priv); | ||||
|     assert(box < priv->block_wcnt * priv->block_hcnt); | ||||
|     return priv->fbo_array[box]; | ||||
| } | ||||
|  | @ -530,6 +536,7 @@ glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int box) | |||
| static inline BoxPtr | ||||
| glamor_pixmap_box_at(glamor_pixmap_private *priv, int box) | ||||
| { | ||||
|     assert(priv); | ||||
|     assert(box < priv->block_wcnt * priv->block_hcnt); | ||||
|     return &priv->box_array[box]; | ||||
| } | ||||
|  | @ -537,12 +544,14 @@ glamor_pixmap_box_at(glamor_pixmap_private *priv, int box) | |||
| static inline int | ||||
| glamor_pixmap_wcnt(glamor_pixmap_private *priv) | ||||
| { | ||||
|     BUG_RETURN_VAL(!priv, 0); | ||||
|     return priv->block_wcnt; | ||||
| } | ||||
| 
 | ||||
| static inline int | ||||
| glamor_pixmap_hcnt(glamor_pixmap_private *priv) | ||||
| { | ||||
|     BUG_RETURN_VAL(!priv, 0); | ||||
|     return priv->block_hcnt; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_program.h" | ||||
|  | @ -126,6 +129,8 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable, | |||
| 
 | ||||
|     glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|     BUG_RETURN_VAL(!pixmap_priv, FALSE); | ||||
| 
 | ||||
|     glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|         int nbox = RegionNumRects(gc->pCompositeClip); | ||||
|         BoxPtr box = RegionRects(gc->pCompositeClip); | ||||
|  |  | |||
|  | @ -31,9 +31,13 @@ | |||
|  * | ||||
|  * Render acceleration implementation | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| 
 | ||||
| #include "mipict.h" | ||||
| #include "fbpict.h" | ||||
| #if 0 | ||||
|  | @ -581,6 +585,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, | |||
|                              glamor_pixmap_private *dest_priv) | ||||
| { | ||||
|     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
|     glamor_pixmap_fbo *fbo = pixmap_priv->fbo; | ||||
|     float wh[4]; | ||||
|     int repeat_type; | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include <dixfontstr.h> | ||||
|  | @ -188,6 +191,8 @@ glamor_text(DrawablePtr drawable, GCPtr gc, | |||
| 
 | ||||
|         glEnable(GL_SCISSOR_TEST); | ||||
| 
 | ||||
|         BUG_RETURN_VAL(!pixmap_priv, 0); | ||||
| 
 | ||||
|         glamor_pixmap_loop(pixmap_priv, box_index) { | ||||
|             BoxPtr box = RegionRects(gc->pCompositeClip); | ||||
|             int nbox = RegionNumRects(gc->pCompositeClip); | ||||
|  |  | |||
|  | @ -19,6 +19,11 @@ | |||
|  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||||
|  * OF THIS SOFTWARE. | ||||
|  */ | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_transfer.h" | ||||
|  | @ -51,6 +56,8 @@ glamor_upload_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox, | |||
|     if (glamor_priv->has_unpack_subimage) | ||||
|         glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel); | ||||
| 
 | ||||
|     BUG_RETURN(!priv); | ||||
| 
 | ||||
|     glamor_pixmap_loop(priv, box_index) { | ||||
|         BoxPtr                  box = glamor_pixmap_box_at(priv, box_index); | ||||
|         glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_index); | ||||
|  | @ -154,6 +161,8 @@ glamor_download_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox, | |||
|     if (glamor_priv->has_pack_subimage) | ||||
|         glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel); | ||||
| 
 | ||||
|     BUG_RETURN(!priv); | ||||
| 
 | ||||
|     glamor_pixmap_loop(priv, box_index) { | ||||
|         BoxPtr                  box = glamor_pixmap_box_at(priv, box_index); | ||||
|         glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_index); | ||||
|  |  | |||
|  | @ -31,9 +31,12 @@ | |||
|  * | ||||
|  * Xv acceleration implementation | ||||
|  */ | ||||
| 
 | ||||
| #include <dix-config.h> | ||||
| 
 | ||||
| #include <assert.h> | ||||
| 
 | ||||
| #include "os/bug_priv.h" | ||||
| 
 | ||||
| #include "glamor_priv.h" | ||||
| #include "glamor_transform.h" | ||||
| #include "glamor_transfer.h" | ||||
|  | @ -580,6 +583,7 @@ glamor_xv_render(glamor_port_private *port_priv, int id) | |||
|     glamor_put_vbo_space(screen); | ||||
| 
 | ||||
|     /* Now draw our big triangle, clipped to each of the clip boxes. */ | ||||
|     BUG_RETURN(!pixmap_priv); | ||||
|     glamor_pixmap_loop(pixmap_priv, dst_box_index) { | ||||
|         int dst_off_x, dst_off_y; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue