aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glamor/glamor_putimage.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-02-07 23:28:38 +0100
committermarha <marha@users.sourceforge.net>2014-02-07 23:38:15 +0100
commit982ac918afe6a1c02d5cf735d7b6c56443a048cc (patch)
treee737eb3f7bb18d933e14f0967c1c1aa5ce5e06f6 /xorg-server/glamor/glamor_putimage.c
parent30af30b78075159fce477ae99cc72540133714d0 (diff)
downloadvcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.tar.gz
vcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.tar.bz2
vcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.zip
xkbcomp xkeyboard-config libxcb libxtrans fontconfig libX11 libxcb mesa xserver git update 7 Feb 2014
Update to openssl1.0.1f xserver commit 83e38eb73fd8c852513aac2da2975b4c01070ec2 libxcb commit d7eb0bdf3b5b11ee9f40ee5e73df8fc0bdfa59f3 xkeyboard-config commit 7596672b96315465df8d8d691e3a567a52f70743 libX11 commit aacf95dacc7c598e7297894580d4d655593813b2 xkbcomp commit 31b90ee4ffc774e0da540277907fc5540c0b012c libxtrans commit 3f0de269abe59353acbd7a5587d68ce0da91db67 fontconfig commit e310d2fac2d874d5aa76c609df70cc7b871c0b6d mesa commit dd2229d4c68ed78a50104637aef904f8ab6d7dd3
Diffstat (limited to 'xorg-server/glamor/glamor_putimage.c')
-rw-r--r--xorg-server/glamor/glamor_putimage.c559
1 files changed, 280 insertions, 279 deletions
diff --git a/xorg-server/glamor/glamor_putimage.c b/xorg-server/glamor/glamor_putimage.c
index 99f7ac6f5..6b25bec84 100644
--- a/xorg-server/glamor/glamor_putimage.c
+++ b/xorg-server/glamor/glamor_putimage.c
@@ -26,7 +26,6 @@
*
*/
-
/** @file glamor_putaimge.c
*
* XPutImage implementation
@@ -37,54 +36,61 @@ void
glamor_init_putimage_shaders(ScreenPtr screen)
{
#if 0
- glamor_screen_private *glamor_priv =
- glamor_get_screen_private(screen);
- const char *xybitmap_vs =
- "uniform float x_bias;\n" "uniform float x_scale;\n"
- "uniform float y_bias;\n" "uniform float y_scale;\n"
- "varying vec2 bitmap_coords;\n" "void main()\n" "{\n"
- " gl_Position = vec4((gl_Vertex.x + x_bias) * x_scale,\n"
- " (gl_Vertex.y + y_bias) * y_scale,\n"
- " 0,\n"
- " 1);\n"
- " bitmap_coords = gl_MultiTexCoord0.xy;\n" "}\n";
- const char *xybitmap_fs =
- "uniform vec4 fg, bg;\n" "varying vec2 bitmap_coords;\n"
- "uniform sampler2D bitmap_sampler;\n" "void main()\n" "{\n"
- " float bitmap_value = texture2D(bitmap_sampler,\n"
- " bitmap_coords).x;\n"
- " gl_FragColor = mix(bg, fg, bitmap_value);\n" "}\n";
- GLint fs_prog, vs_prog, prog;
- GLint sampler_uniform_location;
-
- if (!GLEW_ARB_fragment_shader)
- return;
-
- prog = dispatch->glCreateProgram();
- vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xybitmap_vs);
- fs_prog =
- glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xybitmap_fs);
- dispatch->glAttachShader(prog, vs_prog);
- dispatch->glAttachShader(prog, fs_prog);
- glamor_link_glsl_prog(prog);
-
- dispatch->glUseProgram(prog);
- sampler_uniform_location =
- dispatch->glGetUniformLocation(prog, "bitmap_sampler");
- dispatch->glUniform1i(sampler_uniform_location, 0);
-
- glamor_priv->put_image_xybitmap_fg_uniform_location =
- dispatch->glGetUniformLocation(prog, "fg");
- glamor_priv->put_image_xybitmap_bg_uniform_location =
- dispatch->glGetUniformLocation(prog, "bg");
- glamor_get_transform_uniform_locations(prog,
- &glamor_priv->put_image_xybitmap_transform);
- glamor_priv->put_image_xybitmap_prog = prog;
- dispatch->glUseProgram(0);
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ const char *xybitmap_vs =
+ "uniform float x_bias;\n"
+ "uniform float x_scale;\n"
+ "uniform float y_bias;\n"
+ "uniform float y_scale;\n"
+ "varying vec2 bitmap_coords;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = vec4((gl_Vertex.x + x_bias) * x_scale,\n"
+ " (gl_Vertex.y + y_bias) * y_scale,\n"
+ " 0,\n"
+ " 1);\n"
+ " bitmap_coords = gl_MultiTexCoord0.xy;\n"
+ "}\n";
+ const char *xybitmap_fs =
+ "uniform vec4 fg, bg;\n"
+ "varying vec2 bitmap_coords;\n"
+ "uniform sampler2D bitmap_sampler;\n"
+ "void main()\n"
+ "{\n"
+ " float bitmap_value = texture2D(bitmap_sampler,\n"
+ " bitmap_coords).x;\n"
+ " gl_FragColor = mix(bg, fg, bitmap_value);\n"
+ "}\n";
+ GLint fs_prog, vs_prog, prog;
+ GLint sampler_uniform_location;
+
+ if (!GLEW_ARB_fragment_shader)
+ return;
+
+ prog = dispatch->glCreateProgram();
+ vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xybitmap_vs);
+ fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xybitmap_fs);
+ dispatch->glAttachShader(prog, vs_prog);
+ dispatch->glAttachShader(prog, fs_prog);
+ glamor_link_glsl_prog(prog);
+
+ dispatch->glUseProgram(prog);
+ sampler_uniform_location =
+ dispatch->glGetUniformLocation(prog, "bitmap_sampler");
+ dispatch->glUniform1i(sampler_uniform_location, 0);
+
+ glamor_priv->put_image_xybitmap_fg_uniform_location =
+ dispatch->glGetUniformLocation(prog, "fg");
+ glamor_priv->put_image_xybitmap_bg_uniform_location =
+ dispatch->glGetUniformLocation(prog, "bg");
+ glamor_get_transform_uniform_locations(prog,
+ &glamor_priv->
+ put_image_xybitmap_transform);
+ glamor_priv->put_image_xybitmap_prog = prog;
+ dispatch->glUseProgram(0);
#endif
}
-
/* Do an XYBitmap putimage. The bits are byte-aligned rows of bitmap
* data (where each row starts at a bit index of left_pad), and the
* destination gets filled with the gc's fg color where the bitmap is set
@@ -101,141 +107,136 @@ glamor_init_putimage_shaders(ScreenPtr screen)
static int
y_flip(PixmapPtr pixmap, int y)
{
- ScreenPtr screen = pixmap->drawable.pScreen;
- PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
- if (pixmap == screen_pixmap)
- return (pixmap->drawable.height - 1) - y;
- else
- return y;
+ if (pixmap == screen_pixmap)
+ return (pixmap->drawable.height - 1) - y;
+ else
+ return y;
}
-
static void
glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
- int x, int y, int w, int h, int left_pad,
- int image_format, char *bits)
+ int x, int y, int w, int h, int left_pad,
+ int image_format, char *bits)
{
- ScreenPtr screen = drawable->pScreen;
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_screen_private *glamor_priv =
- glamor_get_screen_private(screen);
- float fg[4], bg[4];
- GLuint tex;
- unsigned int stride = PixmapBytePad(1, w + left_pad);
- RegionPtr clip;
- BoxPtr box;
- int nbox;
- float dest_coords[8];
- const float bitmap_coords[8] = {
- 0.0, 0.0,
- 1.0, 0.0,
- 1.0, 1.0,
- 0.0, 1.0,
- };
- GLfloat xscale, yscale;
- glamor_pixmap_private *pixmap_priv;
-
- pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- pixmap_priv_get_scale(pixmap_priv, &xscale, &yscale);
-
- glamor_set_normalize_vcoords(xscale, yscale,
- x, y,
- x + w, y + h,
- glamor_priv->yInverted, dest_coords);
-
- glamor_fallback("glamor_put_image_xybitmap: disabled\n");
- goto fail;
-
- if (glamor_priv->put_image_xybitmap_prog == 0) {
- ErrorF("no program for xybitmap putimage\n");
- goto fail;
- }
-
- glamor_set_alu(gc->alu);
- if (!glamor_set_planemask(pixmap, gc->planemask))
- goto fail;
-
- dispatch->glUseProgram(glamor_priv->put_image_xybitmap_prog);
-
- glamor_get_color_4f_from_pixel(pixmap, gc->fgPixel, fg);
- dispatch->glUniform4fv
- (glamor_priv->put_image_xybitmap_fg_uniform_location, 1, fg);
- glamor_get_color_4f_from_pixel(pixmap, gc->bgPixel, bg);
- dispatch->glUniform4fv
- (glamor_priv->put_image_xybitmap_bg_uniform_location, 1, bg);
-
- dispatch->glGenTextures(1, &tex);
- dispatch->glActiveTexture(GL_TEXTURE0);
- dispatch->glEnable(GL_TEXTURE_2D);
- dispatch->glBindTexture(GL_TEXTURE_2D, tex);
- dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST);
- dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
- GL_NEAREST);
- dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8);
- dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, left_pad);
- dispatch->glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA,
- w, h, 0, GL_COLOR_INDEX, GL_BITMAP, bits);
- dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
-
- /* Now that we've set up our bitmap texture and the shader, shove
- * the destination rectangle through the cliprects and run the
- * shader on the resulting fragments.
- */
- dispatch->glVertexPointer(2, GL_FLOAT, 0, dest_coords);
- dispatch->glEnableClientState(GL_VERTEX_ARRAY);
- dispatch->glClientActiveTexture(GL_TEXTURE0);
- dispatch->glTexCoordPointer(2, GL_FLOAT, 0, bitmap_coords);
- dispatch->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- dispatch->glEnable(GL_SCISSOR_TEST);
- clip = fbGetCompositeClip(gc);
- for (nbox = REGION_NUM_RECTS(clip),
- box = REGION_RECTS(clip); nbox--; box++) {
- int x1 = x;
- int y1 = y;
- int x2 = x + w;
- int y2 = y + h;
-
- if (x1 < box->x1)
- x1 = box->x1;
- if (y1 < box->y1)
- y1 = box->y1;
- if (x2 > box->x2)
- x2 = box->x2;
- if (y2 > box->y2)
- y2 = box->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
-
- dispatch->glScissor(box->x1,
- y_flip(pixmap, box->y1),
- box->x2 - box->x1, box->y2 - box->y1);
- dispatch->glDrawArrays(GL_QUADS, 0, 4);
- }
-
- dispatch->glDisable(GL_SCISSOR_TEST);
- glamor_set_alu(GXcopy);
- glamor_set_planemask(pixmap, ~0);
- dispatch->glDeleteTextures(1, &tex);
- dispatch->glDisable(GL_TEXTURE_2D);
- dispatch->glDisableClientState(GL_VERTEX_ARRAY);
- dispatch->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- return;
- glamor_set_alu(GXcopy);
- glamor_set_planemask(pixmap, ~0);
- glamor_fallback(": to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
-fail:
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap,
- bits);
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
- }
+ ScreenPtr screen = drawable->pScreen;
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ float fg[4], bg[4];
+ GLuint tex;
+ unsigned int stride = PixmapBytePad(1, w + left_pad);
+ RegionPtr clip;
+ BoxPtr box;
+ int nbox;
+ float dest_coords[8];
+
+ const float bitmap_coords[8] = {
+ 0.0, 0.0,
+ 1.0, 0.0,
+ 1.0, 1.0,
+ 0.0, 1.0,
+ };
+ GLfloat xscale, yscale;
+ glamor_pixmap_private *pixmap_priv;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+ pixmap_priv_get_scale(pixmap_priv, &xscale, &yscale);
+
+ glamor_set_normalize_vcoords(xscale, yscale,
+ x, y,
+ x + w, y + h,
+ glamor_priv->yInverted, dest_coords);
+
+ glamor_fallback("glamor_put_image_xybitmap: disabled\n");
+ goto fail;
+
+ if (glamor_priv->put_image_xybitmap_prog == 0) {
+ ErrorF("no program for xybitmap putimage\n");
+ goto fail;
+ }
+
+ glamor_set_alu(gc->alu);
+ if (!glamor_set_planemask(pixmap, gc->planemask))
+ goto fail;
+
+ dispatch->glUseProgram(glamor_priv->put_image_xybitmap_prog);
+
+ glamor_get_color_4f_from_pixel(pixmap, gc->fgPixel, fg);
+ dispatch->glUniform4fv
+ (glamor_priv->put_image_xybitmap_fg_uniform_location, 1, fg);
+ glamor_get_color_4f_from_pixel(pixmap, gc->bgPixel, bg);
+ dispatch->glUniform4fv
+ (glamor_priv->put_image_xybitmap_bg_uniform_location, 1, bg);
+
+ dispatch->glGenTextures(1, &tex);
+ dispatch->glActiveTexture(GL_TEXTURE0);
+ dispatch->glEnable(GL_TEXTURE_2D);
+ dispatch->glBindTexture(GL_TEXTURE_2D, tex);
+ dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8);
+ dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, left_pad);
+ dispatch->glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA,
+ w, h, 0, GL_COLOR_INDEX, GL_BITMAP, bits);
+ dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+
+ /* Now that we've set up our bitmap texture and the shader, shove
+ * the destination rectangle through the cliprects and run the
+ * shader on the resulting fragments.
+ */
+ dispatch->glVertexPointer(2, GL_FLOAT, 0, dest_coords);
+ dispatch->glEnableClientState(GL_VERTEX_ARRAY);
+ dispatch->glClientActiveTexture(GL_TEXTURE0);
+ dispatch->glTexCoordPointer(2, GL_FLOAT, 0, bitmap_coords);
+ dispatch->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ dispatch->glEnable(GL_SCISSOR_TEST);
+ clip = fbGetCompositeClip(gc);
+ for (nbox = REGION_NUM_RECTS(clip), box = REGION_RECTS(clip); nbox--; box++) {
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + w;
+ int y2 = y + h;
+
+ if (x1 < box->x1)
+ x1 = box->x1;
+ if (y1 < box->y1)
+ y1 = box->y1;
+ if (x2 > box->x2)
+ x2 = box->x2;
+ if (y2 > box->y2)
+ y2 = box->y2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
+
+ dispatch->glScissor(box->x1,
+ y_flip(pixmap, box->y1),
+ box->x2 - box->x1, box->y2 - box->y1);
+ dispatch->glDrawArrays(GL_QUADS, 0, 4);
+ }
+
+ dispatch->glDisable(GL_SCISSOR_TEST);
+ glamor_set_alu(GXcopy);
+ glamor_set_planemask(pixmap, ~0);
+ dispatch->glDeleteTextures(1, &tex);
+ dispatch->glDisable(GL_TEXTURE_2D);
+ dispatch->glDisableClientState(GL_VERTEX_ARRAY);
+ dispatch->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ return;
+ glamor_set_alu(GXcopy);
+ glamor_set_planemask(pixmap, ~0);
+ glamor_fallback(": to %p (%c)\n",
+ drawable, glamor_get_drawable_location(drawable));
+ fail:
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
+ fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap, bits);
+ glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
+ }
}
#endif
@@ -244,120 +245,120 @@ glamor_fini_putimage_shaders(ScreenPtr screen)
{
}
-
-static Bool
+static Bool
_glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits, Bool fallback)
+ int w, int h, int left_pad, int image_format, char *bits,
+ Bool fallback)
{
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_pixmap_private *pixmap_priv =
- glamor_get_pixmap_private(pixmap);
- RegionPtr clip;
- int x_off, y_off;
- Bool ret = FALSE;
- PixmapPtr temp_pixmap, sub_pixmap;
- glamor_pixmap_private *temp_pixmap_priv;
- BoxRec box;
-
- glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
- clip = fbGetCompositeClip(gc);
- if (image_format == XYBitmap) {
- assert(depth == 1);
- goto fail;
- }
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
- glamor_fallback("has no fbo.\n");
- goto fail;
- }
-
- if (image_format != ZPixmap) {
- glamor_fallback("non-ZPixmap\n");
- goto fail;
- }
-
- if (!glamor_set_planemask(pixmap, gc->planemask)) {
- goto fail;
- }
- /* create a temporary pixmap and upload the bits to that
- * pixmap, then apply clip copy it to the destination pixmap.*/
- box.x1 = x + drawable->x;
- box.y1 = y + drawable->y;
- box.x2 = x + w + drawable->x;
- box.y2 = y + h + drawable->y;
-
- if ((clip != NULL && RegionContainsRect(clip, &box) != rgnIN)
- || gc->alu != GXcopy) {
- temp_pixmap = glamor_create_pixmap(drawable->pScreen, w, h, depth, 0);
- if (temp_pixmap == NULL)
- goto fail;
-
- temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
-
- if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) {
- temp_pixmap_priv->base.picture = pixmap_priv->base.picture;
- temp_pixmap_priv->base.is_picture = pixmap_priv->base.is_picture;
- }
-
- glamor_upload_sub_pixmap_to_texture(temp_pixmap, 0, 0, w, h,
- pixmap->devKind, bits, 0);
-
- glamor_copy_area(&temp_pixmap->drawable, drawable, gc, 0, 0, w, h, x, y);
- glamor_destroy_pixmap(temp_pixmap);
- } else
- glamor_upload_sub_pixmap_to_texture(pixmap, x + drawable->x + x_off, y + drawable->y + y_off,
- w, h, PixmapBytePad(w, depth), bits, 0);
- ret = TRUE;
- goto done;
-
-fail:
- glamor_set_planemask(pixmap, ~0);
-
- if (!fallback
- && glamor_ddx_fallback_check_pixmap(&pixmap->drawable))
- goto done;
-
- glamor_fallback("to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
-
- sub_pixmap = glamor_get_sub_pixmap(pixmap, x + x_off + drawable->x,
- y + y_off + drawable->y, w, h,
- GLAMOR_ACCESS_RW);
- if (sub_pixmap) {
- if (clip != NULL)
- pixman_region_translate (clip, -x - drawable->x, -y - drawable->y);
-
- fbPutImage(&sub_pixmap->drawable, gc, depth, 0, 0, w, h,
- left_pad, image_format, bits);
-
- glamor_put_sub_pixmap(sub_pixmap, pixmap,
- x + x_off + drawable->x,
- y + y_off + drawable->y,
- w, h, GLAMOR_ACCESS_RW);
- if (clip != NULL)
- pixman_region_translate (clip, x + drawable->x, y + drawable->y);
- } else
- fbPutImage(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits);
- ret = TRUE;
-
-done:
- return ret;
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+ RegionPtr clip;
+ int x_off, y_off;
+ Bool ret = FALSE;
+ PixmapPtr temp_pixmap, sub_pixmap;
+ glamor_pixmap_private *temp_pixmap_priv;
+ BoxRec box;
+
+ glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
+ clip = fbGetCompositeClip(gc);
+ if (image_format == XYBitmap) {
+ assert(depth == 1);
+ goto fail;
+ }
+
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
+ glamor_fallback("has no fbo.\n");
+ goto fail;
+ }
+
+ if (image_format != ZPixmap) {
+ glamor_fallback("non-ZPixmap\n");
+ goto fail;
+ }
+
+ if (!glamor_set_planemask(pixmap, gc->planemask)) {
+ goto fail;
+ }
+ /* create a temporary pixmap and upload the bits to that
+ * pixmap, then apply clip copy it to the destination pixmap.*/
+ box.x1 = x + drawable->x;
+ box.y1 = y + drawable->y;
+ box.x2 = x + w + drawable->x;
+ box.y2 = y + h + drawable->y;
+
+ if ((clip != NULL && RegionContainsRect(clip, &box) != rgnIN)
+ || gc->alu != GXcopy) {
+ temp_pixmap = glamor_create_pixmap(drawable->pScreen, w, h, depth, 0);
+ if (temp_pixmap == NULL)
+ goto fail;
+
+ temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
+
+ if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) {
+ temp_pixmap_priv->base.picture = pixmap_priv->base.picture;
+ temp_pixmap_priv->base.is_picture = pixmap_priv->base.is_picture;
+ }
+
+ glamor_upload_sub_pixmap_to_texture(temp_pixmap, 0, 0, w, h,
+ pixmap->devKind, bits, 0);
+
+ glamor_copy_area(&temp_pixmap->drawable, drawable, gc, 0, 0, w, h, x,
+ y);
+ glamor_destroy_pixmap(temp_pixmap);
+ }
+ else
+ glamor_upload_sub_pixmap_to_texture(pixmap, x + drawable->x + x_off,
+ y + drawable->y + y_off, w, h,
+ PixmapBytePad(w, depth), bits, 0);
+ ret = TRUE;
+ goto done;
+
+ fail:
+ glamor_set_planemask(pixmap, ~0);
+
+ if (!fallback && glamor_ddx_fallback_check_pixmap(&pixmap->drawable))
+ goto done;
+
+ glamor_fallback("to %p (%c)\n",
+ drawable, glamor_get_drawable_location(drawable));
+
+ sub_pixmap = glamor_get_sub_pixmap(pixmap, x + x_off + drawable->x,
+ y + y_off + drawable->y, w, h,
+ GLAMOR_ACCESS_RW);
+ if (sub_pixmap) {
+ if (clip != NULL)
+ pixman_region_translate(clip, -x - drawable->x, -y - drawable->y);
+
+ fbPutImage(&sub_pixmap->drawable, gc, depth, 0, 0, w, h,
+ left_pad, image_format, bits);
+
+ glamor_put_sub_pixmap(sub_pixmap, pixmap,
+ x + x_off + drawable->x,
+ y + y_off + drawable->y, w, h, GLAMOR_ACCESS_RW);
+ if (clip != NULL)
+ pixman_region_translate(clip, x + drawable->x, y + drawable->y);
+ }
+ else
+ fbPutImage(drawable, gc, depth, x, y, w, h,
+ left_pad, image_format, bits);
+ ret = TRUE;
+
+ done:
+ return ret;
}
void
glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits)
+ int w, int h, int left_pad, int image_format, char *bits)
{
- _glamor_put_image(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits, TRUE);
+ _glamor_put_image(drawable, gc, depth, x, y, w, h,
+ left_pad, image_format, bits, TRUE);
}
Bool
glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits)
+ int w, int h, int left_pad, int image_format, char *bits)
{
- return _glamor_put_image(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits, FALSE);
+ return _glamor_put_image(drawable, gc, depth, x, y, w, h,
+ left_pad, image_format, bits, FALSE);
}
-