Re: [PATCH 62/72] drm/i915: split image_caches array into struct for better readability
Chris Wilson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Dec 29, 2015 at 10:17:40AM +0100, Enrico Weigelt, metux IT consult wrote: > Instead of using an array with unnamed index numbers, move to an > struct with named fields for the individual image cache instances. > > Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> > --- > src/drm/cairo-drm-i915-private.h | 5 ++++- > src/drm/cairo-drm-i915-surface.c | 8 ++++---- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/src/drm/cairo-drm-i915-private.h b/src/drm/cairo-drm-i915-private.h > index fa53539..73f5730 100644 > --- a/src/drm/cairo-drm-i915-private.h > +++ b/src/drm/cairo-drm-i915-private.h > @@ -704,7 +704,10 @@ struct i915_device { > uint32_t last_source_fragment; > uint32_t clear_alpha; > > - cairo_list_t image_caches[2]; Or you could use named indices. Anyway image_caches[] is a dead end. Having a cache for in-flight images is useful, but the high level decision of what to cache for long periods of time is best left to the client. And the closest we have to a clean texture atlas interface are glyphs. > + struct { > + cairo_list_t argb32; > + cairo_list_t a8; > + } image_caches; > > uint32_t batch_header[13]; > uint32_t batch_base[I915_BATCH_SIZE / sizeof (uint32_t)]; > diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c > index 42962b2..60a2a91 100644 > --- a/src/drm/cairo-drm-i915-surface.c > +++ b/src/drm/cairo-drm-i915-surface.c > @@ -2657,13 +2657,13 @@ i915_surface_create_from_cacheable_image_internal (i915_device_t *device, > case CAIRO_FORMAT_RGB24: > case CAIRO_FORMAT_RGB16_565: > case CAIRO_FORMAT_RGB30: > - caches = &device->image_caches[0]; > + caches = &(device->image_caches.argb32); > format = CAIRO_FORMAT_ARGB32; > bpp = 4; > break; > case CAIRO_FORMAT_A8: > case CAIRO_FORMAT_A1: > - caches = &device->image_caches[1]; > + caches = &(device->image_caches.a8); Please reduce the number of random brackets in the patches. -Chris -- Chris Wilson, Intel Open Source Technology Centre -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo