Commit 9bcddff9 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

pending_op: Remove the pending operations handling.

We have disabled this feature for a long time, and previous
testing shows that this(pending fill) will not bring observed
performance gain. Now remove it.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 1761768f
......@@ -49,9 +49,6 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
}
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
if (src_pixmap_priv->pending_op.type == GLAMOR_PENDING_FILL)
return FALSE;
if (gc) {
if (gc->alu != GXcopy) {
glamor_delayed_fallback(screen, "non-copy ALU\n");
......@@ -69,10 +66,8 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
return FALSE;
}
if (glamor_set_destination_pixmap(dst_pixmap)) {
if (glamor_set_destination_pixmap(dst_pixmap))
return FALSE;
}
glamor_validate_pixmap(dst_pixmap);
dispatch = glamor_get_dispatch(glamor_priv);
dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT,
......@@ -199,58 +194,48 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
return FALSE;
}
if (alu != GXcopy) {
glamor_set_destination_pixmap_priv_nc (src_pixmap_priv);
glamor_validate_pixmap(src_pixmap);
}
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
glamor_validate_pixmap(dst_pixmap);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 2 * sizeof(float),
vertices);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off,
&src_y_off);
dx += src_x_off;
dy += src_y_off;
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,
&src_yscale);
dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D,
src_pixmap_priv->fbo->tex);
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off,
&src_y_off);
dx += src_x_off;
dy += src_y_off;
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,
&src_yscale);
dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D,
src_pixmap_priv->fbo->tex);
#ifndef GLAMOR_GLES2
dispatch->glEnable(GL_TEXTURE_2D);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_BORDER);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_BORDER);
dispatch->glEnable(GL_TEXTURE_2D);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_BORDER);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_BORDER);
#endif
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
GL_FLOAT, GL_FALSE,
2 * sizeof(float),
texcoords);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
dispatch->glUseProgram(glamor_priv->finish_access_prog[0]);
dispatch->glUniform1i(glamor_priv->finish_access_revert[0],
REVERT_NONE);
dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[0],
SWAP_NONE_UPLOADING);
} else {
GLAMOR_CHECK_PENDING_FILL(dispatch, glamor_priv,
src_pixmap_priv);
}
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
GL_FLOAT, GL_FALSE,
2 * sizeof(float),
texcoords);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
dispatch->glUseProgram(glamor_priv->finish_access_prog[0]);
dispatch->glUniform1i(glamor_priv->finish_access_revert[0],
REVERT_NONE);
dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[0],
SWAP_NONE_UPLOADING);
for (i = 0; i < nbox; i++) {
......@@ -262,26 +247,22 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glamor_priv->yInverted,
vertices);
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv))
glamor_set_normalize_tcoords(src_xscale,
src_yscale,
box[i].x1 + dx,
box[i].y1 + dy,
box[i].x2 + dx,
box[i].y2 + dy,
glamor_priv->yInverted,
texcoords);
glamor_set_normalize_tcoords(src_xscale,
src_yscale,
box[i].x1 + dx,
box[i].y1 + dy,
box[i].x2 + dx,
box[i].y2 + dy,
glamor_priv->yInverted,
texcoords);
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
#ifndef GLAMOR_GLES2
dispatch->glDisable(GL_TEXTURE_2D);
dispatch->glDisable(GL_TEXTURE_2D);
#endif
}
dispatch->glUseProgram(0);
/* The source texture is bound to a fbo, we have to flush it here. */
if (flush_needed)
......
......@@ -538,12 +538,6 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
pixmap_priv = glamor_get_pixmap_private(pixmap);
return TRUE;
}
/*
* XXX how to handle those pending OPs.
* By default, pending OP is disabled. Maybe we will give up the pending
* OP latter.
*
* */
_X_EXPORT void
glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
......
......@@ -213,20 +213,8 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
&color[1],
&color[2],
&color[3], format_for_pixmap(pixmap));
#ifdef GLAMOR_DELAYED_FILLING
if (x == 0 && y == 0
&& width == pixmap->drawable.width
&& height == pixmap->drawable.height
&& pixmap_priv->fb != glamor_priv->screen_fbo) {
pixmap_priv->pending_op.type = GLAMOR_PENDING_FILL;
memcpy(&pixmap_priv->pending_op.fill.color4fv,
color, 4 * sizeof(GLfloat));
pixmap_priv->pending_op.fill.colori = fg_pixel;
return TRUE;
}
#endif
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
dispatch = glamor_get_dispatch(glamor_priv);
if (!glamor_set_alu(dispatch, alu)) {
......
......@@ -23,47 +23,10 @@ glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
}
static void
_glamor_pixmap_validate_filling(glamor_screen_private * glamor_priv,
glamor_pixmap_private * pixmap_priv)
{
glamor_gl_dispatch *dispatch = glamor_get_dispatch(glamor_priv);
GLfloat vertices[8];
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 2 * sizeof(float),
vertices);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
dispatch->glUseProgram(glamor_priv->solid_prog);
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location,
1, pixmap_priv->pending_op.fill.color4fv);
vertices[0] = -1;
vertices[1] = -1;
vertices[2] = 1;
vertices[3] = -1;
vertices[4] = 1;
vertices[5] = 1;
vertices[6] = -1;
vertices[7] = 1;
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
dispatch->glUseProgram(0);
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
glamor_put_dispatch(glamor_priv);
}
glamor_pixmap_validate_function_t pixmap_validate_funcs[] = {
NULL,
_glamor_pixmap_validate_filling
};
void
glamor_pixmap_init(ScreenPtr screen)
{
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
glamor_priv->pixmap_validate_funcs = pixmap_validate_funcs;
}
void
......@@ -71,23 +34,6 @@ glamor_pixmap_fini(ScreenPtr screen)
{
}
void
glamor_validate_pixmap(PixmapPtr pixmap)
{
glamor_pixmap_validate_function_t validate_op;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
validate_op =
glamor_priv->pixmap_validate_funcs[pixmap_priv->
pending_op.type];
if (validate_op) {
(*validate_op) (glamor_priv, pixmap_priv);
}
}
void
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo * fbo)
{
......@@ -865,9 +811,6 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
}
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
/* XXX we may don't need to validate it on GPU here,
* we can just validate it on CPU. */
glamor_validate_pixmap(pixmap);
need_post_conversion = (revert > REVERT_NORMAL);
if (need_post_conversion) {
......
......@@ -132,11 +132,6 @@ enum gradient_shader_type {
struct glamor_screen_private;
struct glamor_pixmap_private;
typedef void (*glamor_pixmap_validate_function_t) (struct
glamor_screen_private *,
struct
glamor_pixmap_private
*);
enum glamor_gl_flavor {
GLAMOR_GL_DESKTOP, // OPENGL API
......@@ -246,7 +241,6 @@ typedef struct glamor_screen_private {
struct glamor_saved_procs saved_procs;
char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1];
int delayed_fallback_pending;
glamor_pixmap_validate_function_t *pixmap_validate_funcs;
int flags;
ScreenPtr screen;
} glamor_screen_private;
......@@ -257,22 +251,6 @@ typedef enum glamor_access {
GLAMOR_ACCESS_WO,
} glamor_access_t;
enum _glamor_pending_op_type {
GLAMOR_PENDING_NONE,
GLAMOR_PENDING_FILL
};
typedef struct _glamor_pending_fill {
unsigned int type;
GLfloat color4fv[4];
CARD32 colori;
} glamor_pending_fill;
typedef union _glamor_pending_op {
unsigned int type;
glamor_pending_fill fill;
} glamor_pending_op;
#define GLAMOR_FBO_NORMAL 1
#define GLAMOR_FBO_DOWNLOADED 2
/* glamor_pixmap_fbo:
......@@ -315,7 +293,6 @@ typedef struct glamor_pixmap_fbo {
* @gl_tex: The pixmap is in a gl texture originally.
* @is_picture: The drawable is attached to a picture.
* @pict_format: the corresponding picture's format.
* #pending_op: currently only support pending filling.
* @container: The corresponding pixmap's pointer.
**/
typedef struct glamor_pixmap_private {
......@@ -325,7 +302,6 @@ typedef struct glamor_pixmap_private {
glamor_pixmap_type_t type;
glamor_pixmap_fbo *fbo;
PictFormatShort pict_format;
glamor_pending_op pending_op;
PixmapPtr container;
int drm_stride;
glamor_screen_private *glamor_priv;
......@@ -682,8 +658,6 @@ Bool glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, GLenu
**/
void glamor_destroy_upload_pixmap(PixmapPtr pixmap);
void glamor_validate_pixmap(PixmapPtr pixmap);
int glamor_create_picture(PicturePtr picture);
Bool
......@@ -754,7 +728,7 @@ glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
* this will increase performance obviously. */
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
//#define GLAMOR_DELAYED_FILLING
#define GLAMOR_DELAYED_FILLING
//#define GLAMOR_GRADIENT_SHADER
......
......@@ -997,12 +997,6 @@ glamor_composite_with_shader(CARD8 op,
glamor_fallback("no texture in source\n");
goto fail;
#endif
} else if (source_pixmap_priv->pending_op.type ==
GLAMOR_PENDING_FILL) {
key.source = SHADER_SOURCE_SOLID;
memcpy(source_solid_color,
source_pixmap_priv->pending_op.
fill.color4fv, 4 * sizeof(float));
}
}
if (key.mask == SHADER_MASK_TEXTURE ||
......@@ -1020,12 +1014,6 @@ glamor_composite_with_shader(CARD8 op,
glamor_fallback("no texture in mask\n");
goto fail;
#endif
} else if (mask_pixmap_priv->pending_op.type ==
GLAMOR_PENDING_FILL) {
key.mask = SHADER_MASK_SOLID;
memcpy(mask_solid_color,
mask_pixmap_priv->pending_op.fill.color4fv,
4 * sizeof(float));
}
}
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
......@@ -1103,7 +1091,6 @@ glamor_composite_with_shader(CARD8 op,
}
#endif
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
glamor_validate_pixmap(dest_pixmap);
if (!glamor_set_composite_op(screen, op, dest, mask)) {
goto fail;
......
......@@ -152,13 +152,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
goto fail;
}
if (alu != GXcopy) {
glamor_set_destination_pixmap_priv_nc(src_pixmap_priv);
glamor_validate_pixmap(tile);
}
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
glamor_validate_pixmap(pixmap);
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
dispatch = glamor_get_dispatch(glamor_priv);
......@@ -167,45 +161,40 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
goto fail;
}
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,
&src_yscale);
dispatch->glUseProgram(glamor_priv->tile_prog);
wh[0] = (float)src_pixmap_priv->fbo->width / tile->drawable.width;
wh[1] = (float)src_pixmap_priv->fbo->height / tile->drawable.height;
dispatch->glUniform2fv(glamor_priv->tile_wh, 1, wh);
dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D,
src_pixmap_priv->fbo->tex);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
GL_REPEAT);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,
&src_yscale);
dispatch->glUseProgram(glamor_priv->tile_prog);
wh[0] = (float)src_pixmap_priv->fbo->width / tile->drawable.width;
wh[1] = (float)src_pixmap_priv->fbo->height / tile->drawable.height;
dispatch->glUniform2fv(glamor_priv->tile_wh, 1, wh);
dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D,
src_pixmap_priv->fbo->tex);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
GL_REPEAT);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
#ifndef GLAMOR_GLES2
dispatch->glEnable(GL_TEXTURE_2D);
dispatch->glEnable(GL_TEXTURE_2D);
#endif
glamor_set_normalize_tcoords(src_xscale, src_yscale,
tile_x1, tile_y1,
tile_x2, tile_y2,
glamor_priv->yInverted,
source_texcoords);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
GL_FLOAT, GL_FALSE,
2 * sizeof(float),
source_texcoords);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
} else {
GLAMOR_CHECK_PENDING_FILL(dispatch, glamor_priv,
src_pixmap_priv);
}
glamor_set_normalize_tcoords(src_xscale, src_yscale,
tile_x1, tile_y1,
tile_x2, tile_y2,
glamor_priv->yInverted,
source_texcoords);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
GL_FLOAT, GL_FALSE,
2 * sizeof(float),
source_texcoords);
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glamor_set_normalize_vcoords(dst_xscale, dst_yscale,
x1, y1, x2, y2,
......@@ -217,12 +206,10 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
#ifndef GLAMOR_GLES2
dispatch->glDisable(GL_TEXTURE_2D);
#endif
}
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
dispatch->glUseProgram(0);
glamor_set_alu(dispatch, GXcopy);
......
......@@ -207,23 +207,6 @@ glamor_transform_boxes(BoxPtr boxes, int nbox, int dx, int dy)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED))
#define GLAMOR_PIXMAP_PRIV_NEED_VALIDATE(pixmap_priv) \
(GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) \
&& (pixmap_priv->pending_op.type != GLAMOR_PENDING_NONE))
#define GLAMOR_PIXMAP_PRIV_NO_PENDING(pixmap_priv) \
(pixmap_priv->pending_op.type == GLAMOR_PENDING_NONE)
#define GLAMOR_CHECK_PENDING_FILL(_dispatch_, _glamor_priv_, _pixmap_priv_) do \
{ \
if (_pixmap_priv_->pending_op.type == GLAMOR_PENDING_FILL) { \
_dispatch_->glUseProgram(_glamor_priv_->solid_prog); \
_dispatch_->glUniform4fv(_glamor_priv_->solid_color_uniform_location, 1, \
_pixmap_priv_->pending_op.fill.color4fv); \
} \
} while(0)
/**
* Borrow from uxa.
*/
......
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