Re: [Mesa-dev] [PATCH 1/2] isl: Return surface creation success from aux helpers
On Fri, Feb 17, 2017 at 04:03:48PM -0800, Jason Ekstrand wrote: > The isl_surf_init call that each of these helpers make can, in theory, > fail. We should propagate that up to the caller rather than just > silently ignoring it. Reviewed-by: Topi Pohjolainen> --- > src/intel/isl/isl.c | 72 > +--- > src/intel/isl/isl.h | 4 +-- > src/intel/vulkan/anv_image.c | 5 +-- > 3 files changed, 40 insertions(+), 41 deletions(-) > > diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c > index 82ab68d..1a47da5 100644 > --- a/src/intel/isl/isl.c > +++ b/src/intel/isl/isl.c > @@ -1323,7 +1323,7 @@ isl_surf_get_tile_info(const struct isl_device *dev, > isl_tiling_get_info(dev, surf->tiling, fmtl->bpb, tile_info); > } > > -void > +bool > isl_surf_get_hiz_surf(const struct isl_device *dev, >const struct isl_surf *surf, >struct isl_surf *hiz_surf) > @@ -1391,20 +1391,20 @@ isl_surf_get_hiz_surf(const struct isl_device *dev, > */ > const unsigned samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples; > > - isl_surf_init(dev, hiz_surf, > - .dim = surf->dim, > - .format = ISL_FORMAT_HIZ, > - .width = surf->logical_level0_px.width, > - .height = surf->logical_level0_px.height, > - .depth = surf->logical_level0_px.depth, > - .levels = surf->levels, > - .array_len = surf->logical_level0_px.array_len, > - .samples = samples, > - .usage = ISL_SURF_USAGE_HIZ_BIT, > - .tiling_flags = ISL_TILING_HIZ_BIT); > + return isl_surf_init(dev, hiz_surf, > +.dim = surf->dim, > +.format = ISL_FORMAT_HIZ, > +.width = surf->logical_level0_px.width, > +.height = surf->logical_level0_px.height, > +.depth = surf->logical_level0_px.depth, > +.levels = surf->levels, > +.array_len = surf->logical_level0_px.array_len, > +.samples = samples, > +.usage = ISL_SURF_USAGE_HIZ_BIT, > +.tiling_flags = ISL_TILING_HIZ_BIT); > } > > -void > +bool > isl_surf_get_mcs_surf(const struct isl_device *dev, >const struct isl_surf *surf, >struct isl_surf *mcs_surf) > @@ -1427,17 +1427,17 @@ isl_surf_get_mcs_surf(const struct isl_device *dev, >unreachable("Invalid sample count"); > } > > - isl_surf_init(dev, mcs_surf, > - .dim = ISL_SURF_DIM_2D, > - .format = mcs_format, > - .width = surf->logical_level0_px.width, > - .height = surf->logical_level0_px.height, > - .depth = 1, > - .levels = 1, > - .array_len = surf->logical_level0_px.array_len, > - .samples = 1, /* MCS surfaces are really single-sampled */ > - .usage = ISL_SURF_USAGE_MCS_BIT, > - .tiling_flags = ISL_TILING_Y0_BIT); > + return isl_surf_init(dev, mcs_surf, > +.dim = ISL_SURF_DIM_2D, > +.format = mcs_format, > +.width = surf->logical_level0_px.width, > +.height = surf->logical_level0_px.height, > +.depth = 1, > +.levels = 1, > +.array_len = surf->logical_level0_px.array_len, > +.samples = 1, /* MCS surfaces are really > single-sampled */ > +.usage = ISL_SURF_USAGE_MCS_BIT, > +.tiling_flags = ISL_TILING_Y0_BIT); > } > > bool > @@ -1491,19 +1491,17 @@ isl_surf_get_ccs_surf(const struct isl_device *dev, >return false; > } > > - isl_surf_init(dev, ccs_surf, > - .dim = surf->dim, > - .format = ccs_format, > - .width = surf->logical_level0_px.width, > - .height = surf->logical_level0_px.height, > - .depth = surf->logical_level0_px.depth, > - .levels = surf->levels, > - .array_len = surf->logical_level0_px.array_len, > - .samples = 1, > - .usage = ISL_SURF_USAGE_CCS_BIT, > - .tiling_flags = ISL_TILING_CCS_BIT); > - > - return true; > + return isl_surf_init(dev, ccs_surf, > +.dim = surf->dim, > +.format = ccs_format, > +.width = surf->logical_level0_px.width, > +.height = surf->logical_level0_px.height, > +.depth = surf->logical_level0_px.depth, > +.levels = surf->levels, > +
[Mesa-dev] [PATCH 1/2] isl: Return surface creation success from aux helpers
The isl_surf_init call that each of these helpers make can, in theory, fail. We should propagate that up to the caller rather than just silently ignoring it. --- src/intel/isl/isl.c | 72 +--- src/intel/isl/isl.h | 4 +-- src/intel/vulkan/anv_image.c | 5 +-- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 82ab68d..1a47da5 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -1323,7 +1323,7 @@ isl_surf_get_tile_info(const struct isl_device *dev, isl_tiling_get_info(dev, surf->tiling, fmtl->bpb, tile_info); } -void +bool isl_surf_get_hiz_surf(const struct isl_device *dev, const struct isl_surf *surf, struct isl_surf *hiz_surf) @@ -1391,20 +1391,20 @@ isl_surf_get_hiz_surf(const struct isl_device *dev, */ const unsigned samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples; - isl_surf_init(dev, hiz_surf, - .dim = surf->dim, - .format = ISL_FORMAT_HIZ, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = surf->logical_level0_px.depth, - .levels = surf->levels, - .array_len = surf->logical_level0_px.array_len, - .samples = samples, - .usage = ISL_SURF_USAGE_HIZ_BIT, - .tiling_flags = ISL_TILING_HIZ_BIT); + return isl_surf_init(dev, hiz_surf, +.dim = surf->dim, +.format = ISL_FORMAT_HIZ, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = surf->logical_level0_px.depth, +.levels = surf->levels, +.array_len = surf->logical_level0_px.array_len, +.samples = samples, +.usage = ISL_SURF_USAGE_HIZ_BIT, +.tiling_flags = ISL_TILING_HIZ_BIT); } -void +bool isl_surf_get_mcs_surf(const struct isl_device *dev, const struct isl_surf *surf, struct isl_surf *mcs_surf) @@ -1427,17 +1427,17 @@ isl_surf_get_mcs_surf(const struct isl_device *dev, unreachable("Invalid sample count"); } - isl_surf_init(dev, mcs_surf, - .dim = ISL_SURF_DIM_2D, - .format = mcs_format, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = 1, - .levels = 1, - .array_len = surf->logical_level0_px.array_len, - .samples = 1, /* MCS surfaces are really single-sampled */ - .usage = ISL_SURF_USAGE_MCS_BIT, - .tiling_flags = ISL_TILING_Y0_BIT); + return isl_surf_init(dev, mcs_surf, +.dim = ISL_SURF_DIM_2D, +.format = mcs_format, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = 1, +.levels = 1, +.array_len = surf->logical_level0_px.array_len, +.samples = 1, /* MCS surfaces are really single-sampled */ +.usage = ISL_SURF_USAGE_MCS_BIT, +.tiling_flags = ISL_TILING_Y0_BIT); } bool @@ -1491,19 +1491,17 @@ isl_surf_get_ccs_surf(const struct isl_device *dev, return false; } - isl_surf_init(dev, ccs_surf, - .dim = surf->dim, - .format = ccs_format, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = surf->logical_level0_px.depth, - .levels = surf->levels, - .array_len = surf->logical_level0_px.array_len, - .samples = 1, - .usage = ISL_SURF_USAGE_CCS_BIT, - .tiling_flags = ISL_TILING_CCS_BIT); - - return true; + return isl_surf_init(dev, ccs_surf, +.dim = surf->dim, +.format = ccs_format, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = surf->logical_level0_px.depth, +.levels = surf->levels, +.array_len = surf->logical_level0_px.array_len, +.samples = 1, +.usage = ISL_SURF_USAGE_CCS_BIT, +.tiling_flags = ISL_TILING_CCS_BIT); } void diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index c340e6a..3a2991b 100644 --- a/src/intel/isl/isl.h
[Mesa-dev] [PATCH 1/2] isl: Return surface creation success from aux helpers
The isl_surf_init call that each of these helpers make can, in theory, fail. We should propagate that up to the caller rather than just silently ignoring it. --- src/intel/isl/isl.c | 72 +--- src/intel/isl/isl.h | 4 +-- src/intel/vulkan/anv_image.c | 5 +-- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 82ab68d..1a47da5 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -1323,7 +1323,7 @@ isl_surf_get_tile_info(const struct isl_device *dev, isl_tiling_get_info(dev, surf->tiling, fmtl->bpb, tile_info); } -void +bool isl_surf_get_hiz_surf(const struct isl_device *dev, const struct isl_surf *surf, struct isl_surf *hiz_surf) @@ -1391,20 +1391,20 @@ isl_surf_get_hiz_surf(const struct isl_device *dev, */ const unsigned samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples; - isl_surf_init(dev, hiz_surf, - .dim = surf->dim, - .format = ISL_FORMAT_HIZ, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = surf->logical_level0_px.depth, - .levels = surf->levels, - .array_len = surf->logical_level0_px.array_len, - .samples = samples, - .usage = ISL_SURF_USAGE_HIZ_BIT, - .tiling_flags = ISL_TILING_HIZ_BIT); + return isl_surf_init(dev, hiz_surf, +.dim = surf->dim, +.format = ISL_FORMAT_HIZ, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = surf->logical_level0_px.depth, +.levels = surf->levels, +.array_len = surf->logical_level0_px.array_len, +.samples = samples, +.usage = ISL_SURF_USAGE_HIZ_BIT, +.tiling_flags = ISL_TILING_HIZ_BIT); } -void +bool isl_surf_get_mcs_surf(const struct isl_device *dev, const struct isl_surf *surf, struct isl_surf *mcs_surf) @@ -1427,17 +1427,17 @@ isl_surf_get_mcs_surf(const struct isl_device *dev, unreachable("Invalid sample count"); } - isl_surf_init(dev, mcs_surf, - .dim = ISL_SURF_DIM_2D, - .format = mcs_format, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = 1, - .levels = 1, - .array_len = surf->logical_level0_px.array_len, - .samples = 1, /* MCS surfaces are really single-sampled */ - .usage = ISL_SURF_USAGE_MCS_BIT, - .tiling_flags = ISL_TILING_Y0_BIT); + return isl_surf_init(dev, mcs_surf, +.dim = ISL_SURF_DIM_2D, +.format = mcs_format, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = 1, +.levels = 1, +.array_len = surf->logical_level0_px.array_len, +.samples = 1, /* MCS surfaces are really single-sampled */ +.usage = ISL_SURF_USAGE_MCS_BIT, +.tiling_flags = ISL_TILING_Y0_BIT); } bool @@ -1491,19 +1491,17 @@ isl_surf_get_ccs_surf(const struct isl_device *dev, return false; } - isl_surf_init(dev, ccs_surf, - .dim = surf->dim, - .format = ccs_format, - .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, - .depth = surf->logical_level0_px.depth, - .levels = surf->levels, - .array_len = surf->logical_level0_px.array_len, - .samples = 1, - .usage = ISL_SURF_USAGE_CCS_BIT, - .tiling_flags = ISL_TILING_CCS_BIT); - - return true; + return isl_surf_init(dev, ccs_surf, +.dim = surf->dim, +.format = ccs_format, +.width = surf->logical_level0_px.width, +.height = surf->logical_level0_px.height, +.depth = surf->logical_level0_px.depth, +.levels = surf->levels, +.array_len = surf->logical_level0_px.array_len, +.samples = 1, +.usage = ISL_SURF_USAGE_CCS_BIT, +.tiling_flags = ISL_TILING_CCS_BIT); } void diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index c340e6a..3a2991b 100644 --- a/src/intel/isl/isl.h