glamor: Check glamor_set_destination_drawable() return value
Check the value returned by glamor_set_destination_drawable() and use the fallback code path where possible. Bugzilla: https://bugzilla.redhat.com/1417575 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
parent
04b4bad7c0
commit
455051a0f1
|
@ -344,6 +344,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
||||||
glamor_program *prog;
|
glamor_program *prog;
|
||||||
const glamor_facet *copy_facet;
|
const glamor_facet *copy_facet;
|
||||||
int n;
|
int n;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
|
@ -410,9 +411,10 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
||||||
goto bail_ctx;
|
goto bail_ctx;
|
||||||
|
|
||||||
glamor_pixmap_loop(dst_priv, dst_box_index) {
|
glamor_pixmap_loop(dst_priv, dst_box_index) {
|
||||||
glamor_set_destination_drawable(dst, dst_box_index, FALSE, FALSE,
|
if (!glamor_set_destination_drawable(dst, dst_box_index, FALSE, FALSE,
|
||||||
prog->matrix_uniform,
|
prog->matrix_uniform,
|
||||||
&dst_off_x, &dst_off_y);
|
&dst_off_x, &dst_off_y))
|
||||||
|
goto bail_ctx;
|
||||||
|
|
||||||
glScissor(dst_off_x - args.dx,
|
glScissor(dst_off_x - args.dx,
|
||||||
dst_off_y - args.dy,
|
dst_off_y - args.dy,
|
||||||
|
@ -422,13 +424,14 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
||||||
glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
|
glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail_ctx:
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
|
|
||||||
bail_ctx:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,6 +49,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
glamor_program *prog;
|
glamor_program *prog;
|
||||||
RegionPtr clip = gc->pCompositeClip;
|
RegionPtr clip = gc->pCompositeClip;
|
||||||
int box_index;
|
int box_index;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -75,8 +76,9 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
int off_x, off_y;
|
int off_x, off_y;
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
|
if (!glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
max_points = 500;
|
max_points = 500;
|
||||||
num_points = 0;
|
num_points = 0;
|
||||||
|
@ -138,11 +140,12 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail:
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
bail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -174,6 +177,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
||||||
int num_points;
|
int num_points;
|
||||||
INT16 *points = NULL;
|
INT16 *points = NULL;
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
if (w * h > MAXINT / (2 * sizeof(float)))
|
if (w * h > MAXINT / (2 * sizeof(float)))
|
||||||
goto bail;
|
goto bail;
|
||||||
|
@ -221,17 +225,19 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
||||||
glamor_put_vbo_space(screen);
|
glamor_put_vbo_space(screen);
|
||||||
|
|
||||||
glamor_pixmap_loop(pixmap_priv, box_index) {
|
glamor_pixmap_loop(pixmap_priv, box_index) {
|
||||||
glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
|
if (!glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
|
||||||
prog->matrix_uniform, NULL, NULL);
|
prog->matrix_uniform, NULL, NULL))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
glDrawArrays(GL_POINTS, 0, num_points);
|
glDrawArrays(GL_POINTS, 0, num_points);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
ret = TRUE;
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
return FALSE;
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -46,6 +46,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
int box_index;
|
int box_index;
|
||||||
int add_last;
|
int add_last;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -103,8 +104,9 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
int nbox = RegionNumRects(gc->pCompositeClip);
|
int nbox = RegionNumRects(gc->pCompositeClip);
|
||||||
BoxPtr box = RegionRects(gc->pCompositeClip);
|
BoxPtr box = RegionRects(gc->pCompositeClip);
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
while (nbox--) {
|
while (nbox--) {
|
||||||
glScissor(box->x1 + off_x,
|
glScissor(box->x1 + off_x,
|
||||||
|
@ -116,12 +118,13 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail:
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
bail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
|
|
@ -47,6 +47,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
||||||
GLshort *vbo_ppt;
|
GLshort *vbo_ppt;
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
int box_index;
|
int box_index;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -90,8 +91,9 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
||||||
int nbox = RegionNumRects(gc->pCompositeClip);
|
int nbox = RegionNumRects(gc->pCompositeClip);
|
||||||
BoxPtr box = RegionRects(gc->pCompositeClip);
|
BoxPtr box = RegionRects(gc->pCompositeClip);
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
while (nbox--) {
|
while (nbox--) {
|
||||||
glScissor(box->x1 + off_x,
|
glScissor(box->x1 + off_x,
|
||||||
|
@ -103,13 +105,13 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail:
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
|
|
||||||
bail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -52,6 +52,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
||||||
GLshort *v;
|
GLshort *v;
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
int box_index;
|
int box_index;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -115,8 +116,9 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
||||||
int nbox = RegionNumRects(gc->pCompositeClip);
|
int nbox = RegionNumRects(gc->pCompositeClip);
|
||||||
BoxPtr box = RegionRects(gc->pCompositeClip);
|
BoxPtr box = RegionRects(gc->pCompositeClip);
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
|
if (!glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
while (nbox--) {
|
while (nbox--) {
|
||||||
glScissor(box->x1 + off_x,
|
glScissor(box->x1 + off_x,
|
||||||
|
@ -132,14 +134,15 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail:
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
if (glamor_priv->glsl_version >= 130)
|
if (glamor_priv->glsl_version >= 130)
|
||||||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
bail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -46,6 +46,7 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
int box_index;
|
int box_index;
|
||||||
int add_last;
|
int add_last;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -62,7 +63,7 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
&glamor_facet_poly_segment);
|
&glamor_facet_poly_segment);
|
||||||
|
|
||||||
if (!prog)
|
if (!prog)
|
||||||
goto bail_ctx;
|
goto bail;
|
||||||
|
|
||||||
/* Set up the vertex buffers for the points */
|
/* Set up the vertex buffers for the points */
|
||||||
|
|
||||||
|
@ -95,8 +96,9 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
int nbox = RegionNumRects(gc->pCompositeClip);
|
int nbox = RegionNumRects(gc->pCompositeClip);
|
||||||
BoxPtr box = RegionRects(gc->pCompositeClip);
|
BoxPtr box = RegionRects(gc->pCompositeClip);
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
if (!glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
while (nbox--) {
|
while (nbox--) {
|
||||||
glScissor(box->x1 + off_x,
|
glScissor(box->x1 + off_x,
|
||||||
|
@ -108,13 +110,13 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
bail_ctx:
|
|
||||||
bail:
|
bail:
|
||||||
return FALSE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
|
|
@ -56,6 +56,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
||||||
char *vbo_offset;
|
char *vbo_offset;
|
||||||
int c;
|
int c;
|
||||||
int box_index;
|
int box_index;
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -123,8 +124,9 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
||||||
int nbox = RegionNumRects(gc->pCompositeClip);
|
int nbox = RegionNumRects(gc->pCompositeClip);
|
||||||
BoxPtr box = RegionRects(gc->pCompositeClip);
|
BoxPtr box = RegionRects(gc->pCompositeClip);
|
||||||
|
|
||||||
glamor_set_destination_drawable(drawable, box_index, FALSE, FALSE,
|
if (!glamor_set_destination_drawable(drawable, box_index, FALSE, FALSE,
|
||||||
prog->matrix_uniform, &off_x, &off_y);
|
prog->matrix_uniform, &off_x, &off_y))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
while (nbox--) {
|
while (nbox--) {
|
||||||
glScissor(box->x1 + off_x,
|
glScissor(box->x1 + off_x,
|
||||||
|
@ -140,14 +142,15 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
bail:
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
if (glamor_priv->glsl_version >= 130)
|
if (glamor_priv->glsl_version >= 130)
|
||||||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
bail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue