On Tue, Jun 13, 2017 at 04:22:01PM -0700, Jason Ekstrand wrote: > On Tue, Jun 13, 2017 at 7:53 AM, Topi Pohjolainen < > topi.pohjolai...@gmail.com> wrote: > > > Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> (v1) > > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > > --- > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 64 > > +++++++++++++++++---------- > > 1 file changed, 41 insertions(+), 23 deletions(-) > > > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > index 4dbf853eee..0a86d3401d 100644 > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > @@ -1648,6 +1648,41 @@ intel_mcs_miptree_buf_create(struct brw_context > > *brw, > > return buf; > > } > > > > +static struct intel_miptree_aux_buffer * > > +intel_alloc_aux_buffer(struct brw_context *brw, > > + const char *name, > > + const struct isl_surf *main_surf, > > > > main_surf is unused in this function.
Ah, good call. It is a leftover from time when I had assertion here against the main surface (I think...). > > > > + const struct isl_surf *aux_surf, > > + uint32_t alloc_flags, > > + struct intel_mipmap_tree *mt) > > +{ > > + struct intel_miptree_aux_buffer *buf = calloc(sizeof(*buf), 1); > > + if (!buf) > > + return false; > > + > > + buf->size = aux_surf->size; > > + buf->pitch = aux_surf->row_pitch; > > + buf->qpitch = isl_surf_get_array_pitch_sa_rows(aux_surf); > > + > > + unsigned pitch = aux_surf->row_pitch; > > + > > + /* ISL has stricter set of alignment rules then the drm allocator. > > + * Therefore one can pass the ISL dimensions in terms of bytes instead > > of > > + * trying to recalculate based on different format block sizes. > > + */ > > + buf->bo = brw_bo_alloc_tiled(brw->bufmgr, name, > > + buf->pitch, buf->size / buf->pitch, > > + 1, I915_TILING_Y, &pitch, alloc_flags); > > + if (!buf->bo) { > > + free(buf); > > + return NULL; > > + } > > + > > + assert(pitch == buf->pitch); > > + > > + return buf; > > +} > > + > > static bool > > intel_miptree_alloc_mcs(struct brw_context *brw, > > struct intel_mipmap_tree *mt, > > @@ -1733,20 +1768,10 @@ intel_miptree_alloc_non_msrt_mcs(struct > > brw_context *brw, > > assert(temp_ccs_surf.size && > > (temp_ccs_surf.size % temp_ccs_surf.row_pitch == 0)); > > > > - struct intel_miptree_aux_buffer *buf = calloc(sizeof(*buf), 1); > > - if (!buf) > > - return false; > > - > > enum isl_aux_state **aux_state = > > create_aux_state_map(mt, ISL_AUX_STATE_PASS_THROUGH); > > - if (!aux_state) { > > - free(buf); > > + if (!aux_state) > > return false; > > - } > > - > > - buf->size = temp_ccs_surf.size; > > - buf->pitch = temp_ccs_surf.row_pitch; > > - buf->qpitch = isl_surf_get_array_pitch_sa_rows(&temp_ccs_surf); > > > > /* In case of compression mcs buffer needs to be initialised requiring > > the > > * buffer to be immediately mapped to cpu space for writing. Therefore > > do > > @@ -1755,21 +1780,14 @@ intel_miptree_alloc_non_msrt_mcs(struct > > brw_context *brw, > > */ > > const uint32_t alloc_flags = > > is_lossless_compressed ? 0 : BO_ALLOC_FOR_RENDER; > > - > > - /* ISL has stricter set of alignment rules then the drm allocator. > > - * Therefore one can pass the ISL dimensions in terms of bytes instead > > of > > - * trying to recalculate based on different format block sizes. > > - */ > > - buf->bo = brw_bo_alloc_tiled(brw->bufmgr, "ccs-miptree", > > - buf->pitch, buf->size / buf->pitch, > > - 1, I915_TILING_Y, &buf->pitch, > > alloc_flags); > > - if (!buf->bo) { > > - free(buf); > > + mt->mcs_buf = intel_alloc_aux_buffer(brw, "ccs-miptree", > > + &temp_main_surf, &temp_ccs_surf, > > + alloc_flags, mt); > > + if (!mt->mcs_buf) { > > free(aux_state); > > return false; > > } > > - > > - mt->mcs_buf = buf; > > + > > mt->aux_state = aux_state; > > > > /* From Gen9 onwards single-sampled (non-msrt) auxiliary buffers are > > -- > > 2.11.0 > > > > _______________________________________________ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev