From: Keith Whitwell Date: Tue, 1 Dec 2009 10:57:37 +0000 (+0000) Subject: Merge commit 'origin/mesa_7_7_branch' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06d3732a9094030fc33120f16f162e0d405f132c;p=mesa.git Merge commit 'origin/mesa_7_7_branch' Conflicts: src/gallium/drivers/svga/svga_screen_texture.c src/gallium/state_trackers/xorg/xorg_composite.c src/gallium/state_trackers/xorg/xorg_exa.c src/gallium/state_trackers/xorg/xorg_renderer.c src/gallium/state_trackers/xorg/xorg_xv.c src/mesa/main/texgetimage.c src/mesa/main/version.h --- 06d3732a9094030fc33120f16f162e0d405f132c diff --cc src/gallium/drivers/svga/svga_screen_texture.c index fb11b80dcf9,e7301aba841..6e10d65a205 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@@ -287,27 -281,31 +281,28 @@@ svga_texture_create(struct pipe_screen if(templat->last_level >= SVGA_MAX_TEXTURE_LEVELS) goto error2; - width = templat->width[0]; - height = templat->height[0]; - depth = templat->depth[0]; + width = templat->width0; + height = templat->height0; + depth = templat->depth0; for(level = 0; level <= templat->last_level; ++level) { - tex->base.width[level] = width; - tex->base.height[level] = height; - tex->base.depth[level] = depth; tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width); tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height); - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } - size.width = templat->width0; - size.height = templat->height0; - size.depth = templat->depth0; + tex->key.flags = 0; - tex->key.size.width = templat->width[0]; - tex->key.size.height = templat->height[0]; - tex->key.size.depth = templat->depth[0]; ++ tex->key.size.width = templat->width0; ++ tex->key.size.height = templat->height0; ++ tex->key.size.depth = templat->depth0; if(templat->target == PIPE_TEXTURE_CUBE) { - flags |= SVGA3D_SURFACE_CUBEMAP; - numFaces = 6; + tex->key.flags |= SVGA3D_SURFACE_CUBEMAP; + tex->key.numFaces = 6; } else { - numFaces = 1; + tex->key.numFaces = 1; } if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) @@@ -531,27 -535,35 +532,35 @@@ svga_texture_view_surface(struct pipe_c "svga: Create surface view: face %d zslice %d mips %d..%d\n", face_pick, zslice_pick, start_mip, start_mip+num_mip-1); - size.width = u_minify(tex->base.width0, start_mip); - size.height = u_minify(tex->base.height0, start_mip); - size.depth = zslice_pick < 0 ? u_minify(tex->base.depth0, start_mip) : 1; - assert(size.depth == 1); + key->flags = 0; + key->format = format; + key->numMipLevels = num_mip; - key->size.width = tex->base.width[start_mip]; - key->size.height = tex->base.height[start_mip]; - key->size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1; ++ key->size.width = u_minify(tex->base.width0, start_mip); ++ key->size.height = u_minify(tex->base.height0, start_mip); ++ key->size.depth = zslice_pick < 0 ? u_minify(tex->base.depth0, start_mip) : 1; + key->cachable = 1; + assert(key->size.depth == 1); if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) { - flags |= SVGA3D_SURFACE_CUBEMAP; - numFaces = 6; + key->flags |= SVGA3D_SURFACE_CUBEMAP; + key->numFaces = 6; } else { - numFaces = 1; + key->numFaces = 1; } - if(format == SVGA3D_FORMAT_INVALID) + if(key->format == SVGA3D_FORMAT_INVALID) { + key->cachable = 0; return NULL; + } - handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels); - - if (!handle) + SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n"); + handle = svga_screen_surface_create(ss, key); + if (!handle) { + key->cachable = 0; return NULL; + } - SVGA_DBG(DEBUG_DMA, "create sid %p (texture view)\n", handle); + SVGA_DBG(DEBUG_DMA, " --> got sid %p (texture view)\n", handle); if (face_pick < 0) face_pick = 0; @@@ -559,15 -571,20 +568,23 @@@ if (zslice_pick >= 0) z_offset = zslice_pick; - for (i = 0; i < num_mip; i++) { - for (j = 0; j < numFaces; j++) { + for (i = 0; i < key->numMipLevels; i++) { + for (j = 0; j < key->numFaces; j++) { if(tex->defined[j + face_pick][i + start_mip]) { - unsigned depth = zslice_pick < 0 ? u_minify(tex->base.depth0, i + start_mip) : 1; - svga_texture_copy_handle(svga_context(pipe), ss, - tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick, - unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1; ++ unsigned depth = (zslice_pick < 0 ? ++ u_minify(tex->base.depth0, i + start_mip) : ++ 1); ++ + svga_texture_copy_handle(svga_context(pipe), + ss, + tex->handle, + 0, 0, z_offset, + i + start_mip, + j + face_pick, handle, 0, 0, 0, i, j, - tex->base.width[i + start_mip], - tex->base.height[i + start_mip], + u_minify(tex->base.width0, i + start_mip), - u_minify(tex->base.height0, i + start_mip), depth); ++ u_minify(tex->base.height0, i + start_mip), + depth); } } } @@@ -590,19 -606,18 +606,18 @@@ svga_get_tex_surface(struct pipe_scree SVGA3dSurfaceFormat format; s = CALLOC_STRUCT(svga_surface); - ps = &s->base; - if (!ps) + if (!s) return NULL; - pipe_reference_init(&ps->reference, 1); - pipe_texture_reference(&ps->texture, pt); - ps->format = pt->format; - ps->width = u_minify(pt->width0, level); - ps->height = u_minify(pt->height0, level); - ps->usage = flags; - ps->level = level; - ps->face = face; - ps->zslice = zslice; + pipe_reference_init(&s->base.reference, 1); + pipe_texture_reference(&s->base.texture, pt); + s->base.format = pt->format; - s->base.width = pt->width[level]; - s->base.height = pt->height[level]; ++ s->base.width = u_minify(pt->width0, level); ++ s->base.height = u_minify(pt->height0, level); + s->base.usage = flags; + s->base.level = level; + s->base.face = face; + s->base.zslice = zslice; if (!render) format = svga_translate_format(pt->format); @@@ -952,10 -971,11 +972,11 @@@ svga_get_tex_sampler_view(struct pipe_c "svga: Sampler view: no %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n", pt, min_lod, max_lod, max_lod - min_lod + 1, - pt->width[0], - pt->height[0], - pt->depth[0], + pt->width0, + pt->height0, + pt->depth0, pt->last_level); + sv->key.cachable = 0; sws->surface_reference(sws, &sv->handle, tex->handle); return sv; } diff --cc src/gallium/state_trackers/xorg/xorg_composite.c index 69a83b15234,a5975aad515..1c248a629e6 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@@ -411,41 -421,10 +421,8 @@@ bind_samplers(struct exa_context *exa, exa->bound_textures); } - static void - setup_vs_constant_buffer(struct exa_context *exa, - int width, int height) - { - const int param_bytes = 8 * sizeof(float); - float vs_consts[8] = { - 2.f/width, 2.f/height, 1, 1, - -1, -1, 0, 0 - }; - renderer_set_constants(exa->renderer, PIPE_SHADER_VERTEX, - vs_consts, param_bytes); - } - - - static void - setup_fs_constant_buffer(struct exa_context *exa) - { - const int param_bytes = 4 * sizeof(float); - const float fs_consts[8] = { - 0, 0, 0, 1, - }; - renderer_set_constants(exa->renderer, PIPE_SHADER_FRAGMENT, - fs_consts, param_bytes); - } - - static void - setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst) - { - int width = pDst->tex->width0; - int height = pDst->tex->height0; - setup_vs_constant_buffer(exa, width, height); - setup_fs_constant_buffer(exa); - } - - static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix) { if (!trans) diff --cc src/gallium/state_trackers/xorg/xorg_exa.c index a68a626fa48,32485add94e..16e683019c1 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@@ -278,13 -274,18 +274,22 @@@ ExaPrepareAccess(PixmapPtr pPix, int in PIPE_REFERENCED_FOR_WRITE) exa->pipe->flush(exa->pipe, 0, NULL); - assert(pPix->drawable.width <= priv->tex->width[0]); - assert(pPix->drawable.height <= priv->tex->height[0]); ++ assert(pPix->drawable.width <= priv->tex->width0); ++ assert(pPix->drawable.height <= priv->tex->height0); + priv->map_transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, ++<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_exa.c + 0, 0, priv->tex->width0, priv->tex->height0); ++======= + 0, 0, + pPix->drawable.width, + pPix->drawable.height ); ++>>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_exa.c if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; @@@ -458,11 -509,48 +513,48 @@@ ExaCopy(PixmapPtr pDstPixmap, int srcX debug_assert(priv == exa->copy.dst); - renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, - exa->copy.src, srcX, srcY, - width, height); + if (exa->copy.use_surface_copy) { + /* XXX: consider exposing >1 box in surface_copy interface. + */ + exa->pipe->surface_copy( exa->pipe, + exa->copy.dst_surface, + dstX, dstY, + exa->copy.src_surface, + srcX, srcY, + width, height ); + } + else { + renderer_copy_pixmap(exa->renderer, + dstX, dstY, + srcX, srcY, + width, height, - exa->copy.src_texture->width[0], - exa->copy.src_texture->height[0]); ++ exa->copy.src_texture->width0, ++ exa->copy.src_texture->height0); + } } + static void + ExaDoneCopy(PixmapPtr pPixmap) + { + ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; + + if (!priv) + return; + + renderer_draw_flush(exa->renderer); + + exa->copy.src = NULL; + exa->copy.dst = NULL; + pipe_surface_reference(&exa->copy.src_surface, NULL); + pipe_surface_reference(&exa->copy.dst_surface, NULL); + pipe_texture_reference(&exa->copy.src_texture, NULL); + } + + + static Bool picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) { @@@ -731,6 -855,17 +859,17 @@@ ExaModifyPixmapHeader(PixmapPtr pPixmap if (!priv || pPixData) return FALSE; + if (0) { + debug_printf("%s pixmap %p sz %dx%dx%d devKind %d\n", + __FUNCTION__, pPixmap, width, height, bitsPerPixel, devKind); + + if (priv->tex) + debug_printf(" ==> old texture %dx%d\n", - priv->tex->width[0], - priv->tex->height[0]); ++ priv->tex->width0, ++ priv->tex->height0); + } + + if (depth <= 0) depth = pPixmap->drawable.depth; @@@ -752,9 -890,9 +894,9 @@@ /* Deal with screen resize */ if ((exa->accel || priv->flags) && (!priv->tex || - (priv->tex->width0 != width || - priv->tex->height0 != height || - priv->tex_flags != priv->flags))) { - !size_match(width, priv->tex->width[0]) || - !size_match(height, priv->tex->height[0]) || ++ !size_match(width, priv->tex->width0) || ++ !size_match(height, priv->tex->height0) || + priv->tex_flags != priv->flags)) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@@ -762,9 -900,16 +904,16 @@@ template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); - template.width0 = width; - template.height0 = height; + if (ROUND_UP_TEXTURES && priv->flags == 0) { - template.width[0] = util_next_power_of_two(width); - template.height[0] = util_next_power_of_two(height); ++ template.width0 = util_next_power_of_two(width); ++ template.height0 = util_next_power_of_two(height); + } + else { - template.width[0] = width; - template.height[0] = height; ++ template.width0 = width; ++ template.height0 = height; + } + - template.depth[0] = 1; + template.depth0 = 1; template.last_level = 0; template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; priv->tex_flags = priv->flags; @@@ -777,15 -922,15 +926,15 @@@ dst_surf = exa->scrn->get_tex_surface( exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); src_surf = xorg_gpu_surface(exa->pipe->screen, priv); - if (exa->pipe->surface_copy) { - exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width0), - min(height, texture->height0)); - } else { - util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width0), - min(height, texture->height0)); - } + if (exa->pipe->surface_copy) { + exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); ++ 0, 0, min(width, texture->width0), ++ min(height, texture->height0)); + } else { + util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); ++ 0, 0, min(width, texture->width0), ++ min(height, texture->height0)); + } exa->scrn->tex_surface_destroy(dst_surf); exa->scrn->tex_surface_destroy(src_surf); } diff --cc src/gallium/state_trackers/xorg/xorg_renderer.c index 418a8dd88bd,cbb84a8c0da..8f73ec5fe11 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@@ -771,79 -550,40 +550,104 @@@ renderer_clone_texture(struct xorg_rend void renderer_copy_pixmap(struct xorg_renderer *r, - struct exa_pixmap_priv *dst_priv, int dx, int dy, - struct exa_pixmap_priv *src_priv, int sx, int sy, - int width, int height) + int dx, int dy, + int sx, int sy, + int width, int height, + float src_width, + float src_height) { - float dst_loc[4], src_loc[4]; - float dst_bounds[4], src_bounds[4]; - float src_shift[4], dst_shift[4], shift[4]; - struct pipe_texture *dst = dst_priv->tex; - struct pipe_texture *src = src_priv->tex; + float s0, t0, s1, t1; + float x0, y0, x1, y1; ++<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_renderer.c + if (r->pipe->is_texture_referenced(r->pipe, src, 0, 0) & + PIPE_REFERENCED_FOR_WRITE) + r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + dst_loc[0] = dx; + dst_loc[1] = dy; + dst_loc[2] = width; + dst_loc[3] = height; + dst_bounds[0] = 0.f; + dst_bounds[1] = 0.f; + dst_bounds[2] = dst->width0; + dst_bounds[3] = dst->height0; + + src_loc[0] = sx; + src_loc[1] = sy; + src_loc[2] = width; + src_loc[3] = height; + src_bounds[0] = 0.f; + src_bounds[1] = 0.f; + src_bounds[2] = src->width0; + src_bounds[3] = src->height0; + + bound_rect(src_loc, src_bounds, src_shift); + bound_rect(dst_loc, dst_bounds, dst_shift); + shift[0] = src_shift[0] - dst_shift[0]; + shift[1] = src_shift[1] - dst_shift[1]; + + if (shift[0] < 0) + shift_rectx(src_loc, src_bounds, -shift[0]); + else + shift_rectx(dst_loc, dst_bounds, shift[0]); + + if (shift[1] < 0) + shift_recty(src_loc, src_bounds, -shift[1]); + else + shift_recty(dst_loc, dst_bounds, shift[1]); + + sync_size(src_loc, dst_loc); + + if (src_loc[2] >= 0 && src_loc[3] >= 0 && + dst_loc[2] >= 0 && dst_loc[3] >= 0) { + struct pipe_texture *temp_src = src; + + if (src == dst) + temp_src = create_sampler_texture(r, src); + + renderer_copy_texture(r, + temp_src, + src_loc[0], + src_loc[1], + src_loc[0] + src_loc[2], + src_loc[1] + src_loc[3], + dst, + dst_loc[0], + dst_loc[1], + dst_loc[0] + dst_loc[2], + dst_loc[1] + dst_loc[3]); + + if (src == dst) + pipe_texture_reference(&temp_src, NULL); + } ++======= + + /* XXX: could put the texcoord scaling calculation into the vertex + * shader. + */ + s0 = sx / src_width; + s1 = (sx + width) / src_width; + t0 = sy / src_height; + t1 = (sy + height) / src_height; + + x0 = dx; + x1 = dx + width; + y0 = dy; + y1 = dy + height; + + /* draw quad */ + renderer_draw_conditional(r, 4*8); + add_vertex_1tex(r, x0, y0, s0, t0); + add_vertex_1tex(r, x1, y0, s1, t0); + add_vertex_1tex(r, x1, y1, s1, t1); + add_vertex_1tex(r, x0, y1, s0, t1); ++>>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_renderer.c } + + + void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h,