[Intel-gfx] [PATCH] i965: Support render acceleration with pixmaps in BOs.
Jesse Barnes
jbarnes at virtuousgeek.org
Thu Nov 6 18:27:09 CET 2008
On Wednesday, November 5, 2008 2:45 pm Eric Anholt wrote:
> + struct brw_surface_state_padded *ss;
> struct brw_surface_state local_ss;
> + dri_bo *pixmap_bo = i830_get_pixmap_bo(pPixmap);
> +
> + ss = (struct brw_surface_state_padded *)ss_bo->virtual + ss_index;
>
> /* Since ss is a pointer to WC memory, do all of our bit operations
> * into a local temporary first.
> @@ -892,7 +896,10 @@ i965_set_picture_surface_state(struct
> brw_surface_state *ss, local_ss.ss0.vert_line_stride_ofs = 0;
> local_ss.ss0.mipmap_layout_mode = 0;
> local_ss.ss0.render_cache_read_mode = 0;
> - local_ss.ss1.base_addr = intel_get_pixmap_offset(pPixmap);
> + if (pixmap_bo != NULL)
> + local_ss.ss1.base_addr = pixmap_bo->offset;
> + else
> + local_ss.ss1.base_addr = intel_get_pixmap_offset(pPixmap);
Can we make intel_get_pixmap_offset get the bo offset so we don't have the
branch here and the local pixmap_bo definition?
>
> local_ss.ss2.mip_count = 0;
> local_ss.ss2.render_target_rotation = 0;
> @@ -903,6 +910,14 @@ i965_set_picture_surface_state(struct
> brw_surface_state *ss, local_ss.ss3.tiled_surface =
> i830_pixmap_tiled(pPixmap) ? 1 : 0;
>
> memcpy(ss, &local_ss, sizeof(local_ss));
> +
> + if (pixmap_bo != NULL) {
> + dri_bo_emit_reloc(ss_bo, I915_GEM_DOMAIN_SAMPLER, 0,
> + 0,
> + ss_index * sizeof(*ss) +
> + offsetof(struct brw_surface_state, ss1),
> + pixmap_bo);
> + }
> }
I guess you'd still have to check for the bo here though, unless you wrapped
dri_bo_emit_reloc into something that checked...
The only other thing I saw that made me look twice was the ss_index arg.
Passing an array index into the surface state setup routine exposes the
implementation a bit, and I didn't see any bounds checking. But I don't have
any ideas offhand on how to make things clearer...
Jesse
More information about the Intel-gfx
mailing list