glamor: Drop unused PBO code in temporary picture uploading.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Eric Anholt 2016-02-01 13:58:12 -08:00 committed by Adam Jackson
parent 6112fecc3a
commit 094b1bea8b

View File

@ -246,7 +246,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
GLenum format, GLenum format,
GLenum type, GLenum type,
int x, int y, int w, int h, int x, int y, int w, int h,
void *bits, int pbo) void *bits)
{ {
glamor_screen_private *glamor_priv = glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen); glamor_get_screen_private(pixmap->drawable.pScreen);
@ -269,11 +269,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
assert(pbo || bits != 0);
if (bits == NULL) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
}
glamor_priv->suppress_gl_out_of_memory_logging = true; glamor_priv->suppress_gl_out_of_memory_logging = true;
if (non_sub) if (non_sub)
glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits); glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
@ -288,9 +283,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
return FALSE; return FALSE;
} }
if (bits == NULL)
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
return TRUE; return TRUE;
} }
@ -298,7 +290,7 @@ static Bool
_glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
GLenum type, int no_alpha, int revert, GLenum type, int no_alpha, int revert,
int swap_rb, int x, int y, int w, int h, int swap_rb, int x, int y, int w, int h,
int stride, void *bits, int pbo) int stride, void *bits)
{ {
ScreenPtr screen = pixmap->drawable.pScreen; ScreenPtr screen = pixmap->drawable.pScreen;
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
@ -308,9 +300,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
GLuint tex = 0; GLuint tex = 0;
pixman_image_t *converted_image = NULL; pixman_image_t *converted_image = NULL;
if (bits == NULL)
goto ready_to_upload;
if (revert == REVERT_UPLOADING_A1) { if (revert == REVERT_UPLOADING_A1) {
converted_image = glamor_get_converted_image(PICT_a8, converted_image = glamor_get_converted_image(PICT_a8,
PICT_a1, PICT_a1,
@ -323,8 +312,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
bits = pixman_image_get_data(converted_image); bits = pixman_image_get_data(converted_image);
} }
ready_to_upload:
/* Try fast path firstly, upload the pixmap to the texture attached /* Try fast path firstly, upload the pixmap to the texture attached
* to the fbo directly. */ * to the fbo directly. */
if (no_alpha == 0 if (no_alpha == 0
@ -345,7 +332,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
format, type, format, type,
x + fbo_x_off, y + fbo_y_off, x + fbo_x_off, y + fbo_y_off,
w, h, w, h,
bits, pbo)) { bits)) {
if (converted_image) if (converted_image)
pixman_image_unref(bits); pixman_image_unref(bits);
return FALSE; return FALSE;
@ -371,8 +358,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
glamor_make_current(glamor_priv); glamor_make_current(glamor_priv);
if (!__glamor_upload_pixmap_to_texture(pixmap, &tex, if (!__glamor_upload_pixmap_to_texture(pixmap, &tex,
format, type, 0, 0, w, h, bits, format, type, 0, 0, w, h, bits)) {
pbo)) {
if (converted_image) if (converted_image)
pixman_image_unref(bits); pixman_image_unref(bits);
return FALSE; return FALSE;
@ -556,11 +542,10 @@ glamor_upload_picture_to_texture(PicturePtr picture)
boxes[j].x1, boxes[j].y1, boxes[j].x1, boxes[j].y1,
boxes[j].x2 - boxes[j].x1, boxes[j].x2 - boxes[j].x1,
boxes[j].y2 - boxes[j].y1, temp_stride); boxes[j].y2 - boxes[j].y1, temp_stride);
if (_glamor_upload_bits_to_pixmap_texture if (!_glamor_upload_bits_to_pixmap_texture
(pixmap, format, type, no_alpha, revert, swap_rb, (pixmap, format, type, no_alpha, revert, swap_rb,
boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1, boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1,
boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits, boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits)) {
0) == FALSE) {
RegionUninit(&region); RegionUninit(&region);
free(sub_bits); free(sub_bits);
assert(0); assert(0);
@ -580,6 +565,5 @@ glamor_upload_picture_to_texture(PicturePtr picture)
0, 0, 0, 0,
pixmap->drawable.width, pixmap->drawable.width,
pixmap->drawable.height, pixmap->drawable.height,
stride, bits, stride, bits);
0);
} }