Fix glTexSubImage on swizzled surfaces on <=NV40
PATCH 1/1 Fix glTexSubImage on swizzled surfaces on <=NV40
Currently in nvXX_transfer_new a temporary as large as the surface is created. If the subrectangle is not the whole texture we would need to read back the whole texture, but we aren't.
Thus, everything but the subrectangle specified is loaded as garbage. This can be seen in progs/demos/ray.
This patch fixes the problem by creating a temporary that covers only the desired subrectangle.
This causes us to hit an alignment assert in nv04_surface_2d.c,. This is fixed by specifying the start of the surface as the surface offset, and using the _POINT registers to program the (x, y) coordinates.
This also allows us to avoid computing swizzled addresses on the CPU.
This fixes progs/demos/ray and doesn't seem to introduce problems.
Patch is for all <=NV40 cards, but tested on NV40 only.
src/gallium/drivers/nv04/nv04_surface_2d.c +6 -6
@@ -167,19 +167,19 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,for (x =0 ; x < w; x += sub_w) { sub_w =MIN2 (sub_w, w - x); -assert (!((dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format)) &63 )); +assert (!(dst->offset &63 ));BEGIN_RING (chan, swzsurf,NV04_SWIZZLED_SURFACE_OFFSET ,1 ); -OUT_RELOCl (chan, dst_bo, dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format), +OUT_RELOCl (chan, dst_bo, dst->offset,NOUVEAU_BO_GART |NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );BEGIN_RING (chan, sifm,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION ,9 );OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE );OUT_RING (chan,nv04_scaled_image_format (src->format));OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY ); -OUT_RING (chan,0 ); +OUT_RING (chan, (dx + x) | ((dy + y) <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w); -OUT_RING (chan,0 ); +OUT_RING (chan, (dx + x) | ((dy + y) <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);OUT_RING (chan,1 <<20 );OUT_RING (chan,1 <<20 );
@@ -190,9 +189,9 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,OUT_RING (chan, src_pitch |NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE ); -OUT_RELOCl (chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) *util_format_get_blocksize (src->texture->format), +OUT_RELOCl (chan, src_bo, src->offset,NOUVEAU_BO_GART |NOUVEAU_BO_VRAM |NOUVEAU_BO_RD ); -OUT_RING (chan,0 ); +OUT_RING (chan, (sx + x) | ((sy + y) <<NV04_SCALED_IMAGE_FROM_MEMORY_POINT_Y_SHIFT )); } }
src/gallium/drivers/nv40/nv40_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv40_transfer { };static void -nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv40_compatible_transfer_tex (pt, level, &tx_tex_template); +nv40_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv40_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv40_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv30/nv30_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv30_transfer { };static void -nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv30_compatible_transfer_tex (pt, level, &tx_tex_template); +nv30_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv30_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv30_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv20/nv20_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv20_transfer { };static void -nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv20_compatible_transfer_tex (pt, level, &tx_tex_template); +nv20_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv20_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv20_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv10/nv10_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv10_transfer { };static void -nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv10_compatible_transfer_tex (pt, level, &tx_tex_template); +nv10_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv10_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv10_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv04/nv04_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv04_transfer { };static void -nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv04_compatible_transfer_tex (pt, level, &tx_tex_template); +nv04_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv04_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv04_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): ff13bc9a0912291608r63d36612r747b364462e5bf4d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Ignore that patch. It's broken because we must set the offset for the up to 1024x1024 chunk we are copying instead of the whole image. The corrected patch is attached.
src/gallium/drivers/nv04/nv04_surface_2d.c +6 -7
@@ -167,20 +167,19 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,for (x =0 ; x < w; x += sub_w) { sub_w =MIN2 (sub_w, w - x); -/* Must be 64-byte aligned */ -assert (!((dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format)) &63 )); +assert (!(dst->offset &63 ));BEGIN_RING (chan, swzsurf,NV04_SWIZZLED_SURFACE_OFFSET ,1 ); -OUT_RELOCl (chan, dst_bo, dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format), +OUT_RELOCl (chan, dst_bo, dst->offset +nv04_swizzle_bits (x, y, dst->width, dst->height) *util_format_get_blocksize (dst->texture->format),NOUVEAU_BO_GART |NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );BEGIN_RING (chan, sifm,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION ,9 );OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE );OUT_RING (chan,nv04_scaled_image_format (src->format));OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY ); -OUT_RING (chan,0 ); +OUT_RING (chan, dx | (dy <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w); -OUT_RING (chan,0 ); +OUT_RING (chan, dx | (dy <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);OUT_RING (chan,1 <<20 );OUT_RING (chan,1 <<20 );
@@ -190,9 +189,9 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,OUT_RING (chan, src_pitch |NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE ); -OUT_RELOCl (chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) *util_format_get_blocksize (src->texture->format), +-OUT_RELOCl (chan, src_bo, src->offset + y * src_pitch + x *util_format_get_blocksize (src->texture->format),NOUVEAU_BO_GART |NOUVEAU_BO_VRAM |NOUVEAU_BO_RD ); -OUT_RING (chan,0 ); +OUT_RING (chan, sx | (sy <<NV04_SCALED_IMAGE_FROM_MEMORY_POINT_Y_SHIFT )); } }
src/gallium/drivers/nv40/nv40_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv40_transfer { };static void -nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv40_compatible_transfer_tex (pt, level, &tx_tex_template); +nv40_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv40_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv40_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv30/nv30_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv30_transfer { };static void -nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv30_compatible_transfer_tex (pt, level, &tx_tex_template); +nv30_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv30_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv30_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv20/nv20_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv20_transfer { };static void -nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv20_compatible_transfer_tex (pt, level, &tx_tex_template); +nv20_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv20_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv20_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv10/nv10_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv10_transfer { };static void -nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv10_compatible_transfer_tex (pt, level, &tx_tex_template); +nv10_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv10_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv10_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv04/nv04_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv04_transfer { };static void -nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv04_compatible_transfer_tex (pt, level, &tx_tex_template); +nv04_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv04_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv04_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): ff13bc9a0912291644p6dc7228bjd927737180155f0d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Third attempt, as the second one was logically wrong.
The problem in the first patch was actually that the source point register has a 1024 limit.
This one leaves the way the source is set up alone, and sets the whole surface as the destination like in the first version, using the point registers (which do not seem to have a 1024 limit, but only on the destination).
Needs testing on <NV40.
src/gallium/drivers/nv04/nv04_surface_2d.c +4 -5
@@ -167,20 +190,19 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,for (x =0 ; x < w; x += sub_w) { sub_w =MIN2 (sub_w, w - x); -/* Must be 64-byte aligned */ -assert (!((dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format)) &63 )); +assert (!(dst->offset &63 ));BEGIN_RING (chan, swzsurf,NV04_SWIZZLED_SURFACE_OFFSET ,1 ); -OUT_RELOCl (chan, dst_bo, dst->offset +nv04_swizzle_bits (dx+x, dy+y, w, h) *util_format_get_blocksize (dst->texture->format), +OUT_RELOCl (chan, dst_bo, dst->offset,NOUVEAU_BO_GART |NOUVEAU_BO_VRAM |NOUVEAU_BO_WR );BEGIN_RING (chan, sifm,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION ,9 );OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE );OUT_RING (chan,nv04_scaled_image_format (src->format));OUT_RING (chan,NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY ); -OUT_RING (chan,0 ); +OUT_RING (chan, (x + dx) | ((y + dy) <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w); -OUT_RING (chan,0 ); +OUT_RING (chan, (x + dx) | ((y + dy) <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT ));OUT_RING (chan, sub_h <<NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);OUT_RING (chan,1 <<20 );OUT_RING (chan,1 <<20 );
src/gallium/drivers/nv40/nv40_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv40_transfer { };static void -nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv40_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv40_compatible_transfer_tex (pt, level, &tx_tex_template); +nv40_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv40_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv40_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv30/nv30_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv30_transfer { };static void -nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv30_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv30_compatible_transfer_tex (pt, level, &tx_tex_template); +nv30_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv30_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv30_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv20/nv20_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv20_transfer { };static void -nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv20_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv20_compatible_transfer_tex (pt, level, &tx_tex_template); +nv20_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv20_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv20_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv10/nv10_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv10_transfer { };static void -nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv10_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv10_compatible_transfer_tex (pt, level, &tx_tex_template); +nv10_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv10_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv10_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
src/gallium/drivers/nv04/nv04_transfer.c +14 -10
@@ -16,14 +16,14 @@ struct nv04_transfer { };static void -nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned level, +nv04_compatible_transfer_tex (struct pipe_texture *pt,unsigned width,unsigned height,struct pipe_texture *template) {memset (template,0 ,sizeof (struct pipe_texture )); template->target = pt->target; template->format = pt->format; - template->width0 =u_minify (pt->width0, level); - template->height0 =u_minify (pt->height0, level); + template->width0 = width; + template->height0 = height; template->depth0 =1 ; template->last_level =0 ; template->nr_samples = pt->nr_samples;
@@ -71,7 +71,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = false; -nv04_compatible_transfer_tex (pt, level, &tx_tex_template); +nv04_compatible_transfer_tex (pt, w, h, &tx_tex_template); tx_tex = pscreen->texture_create (pscreen, &tx_tex_template);if (!tx_tex)
@@ -80,6 +80,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,return NULL ; } + tx->base.stride = ((struct nv04_miptree *)tx_tex)->level[0 ].pitch; + tx->surface = pscreen->get_tex_surface (pscreen, tx_tex,0 ,0 ,0 ,pipe_transfer_buffer_flags (&tx->base));
@@ -105,8 +107,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,/* TODO: Check if SIFM can un-swizzle */ nvscreen->eng2d->copy (nvscreen->eng2d, tx->surface,0 ,0 , - src,0 ,0 , - src->width, src->height); + src, x, y, + w, h);pipe_surface_reference (&src,NULL ); }
@@ -130,9 +132,9 @@ nv04_transfer_del(struct pipe_transfer *ptx)/* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ nvscreen->eng2d->copy (nvscreen->eng2d, - dst,0 ,0 , + dst, tx->base.x, tx->base.y, tx->surface,0 ,0 , - dst->width, dst->height); + tx->base.width, tx->base.height);pipe_surface_reference (&dst,NULL ); }
@@ -151,8 +153,10 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)void *map =pipe_buffer_map (pscreen, mt->buffer,pipe_transfer_buffer_flags (ptx)); -return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); +if (!tx->direct) +return map + ns->base.offset; +else +return map + ns->base.offset + ptx->y * ns->pitch + ptx->x *util_format_get_blocksize (ptx->texture->format); } static void
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau