Quoting Kenneth Graunke (2017-07-19 23:36:58)
> On Wednesday, July 19, 2017 3:09:16 AM PDT Chris Wilson wrote:
> >  #define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x))
> > @@ -117,21 +125,12 @@ add_exec_bo(struct intel_batchbuffer *batch, struct 
> > brw_bo *bo)
> >                   batch->exec_array_size * sizeof(batch->exec_objects[0]));
> >     }
> >  
> > -   struct drm_i915_gem_exec_object2 *validation_entry =
> > -      &batch->exec_objects[batch->exec_count];
> > -   validation_entry->handle = bo->gem_handle;
> > -   if (bo == batch->bo) {
> > -      validation_entry->relocation_count = batch->reloc_count;
> > -      validation_entry->relocs_ptr = (uintptr_t) batch->relocs;
> > -   } else {
> > -      validation_entry->relocation_count = 0;
> > -      validation_entry->relocs_ptr = 0;
> > -   }
> > -   validation_entry->alignment = bo->align;
> > -   validation_entry->offset = bo->offset64;
> > -   validation_entry->flags = bo->kflags;
> > -   validation_entry->rsvd1 = 0;
> > -   validation_entry->rsvd2 = 0;
> > +   struct drm_i915_gem_exec_object2 *exec =
> > +      memset(&batch->exec_objects[batch->exec_count], 0, sizeof(*exec));
> > +   exec->handle = bo->gem_handle;
> > +   exec->alignment = bo->align;
> > +   exec->offset = bo->offset64;
> > +   exec->flags = bo->kflags;
> 
> I liked the name "validation_entry" given that we call this the "validation
> list"...exec matches the struct name better, but I think validation_entry
> helps distinguish the two lists...

Hmm, how about

-   struct drm_i915_gem_exec_object2 *exec =
-      memset(&batch->exec_objects[batch->exec_count], 0, sizeof(*exec));
-   exec->handle = bo->gem_handle;
-   exec->alignment = bo->align;
-   exec->offset = bo->offset64;
-   exec->flags = bo->kflags;
+   batch->exec_objects[batch->exec_count] = (struct drm_i915_gem_exec_object2){
+          .handle = bo->gem_handle,
+          .alignment = bo->align,
+          .offset = bo->offset64,
+          .flags = bo->kflags,
+   };

and skip the impossible problem of naming?

But we still end up with a couple of 
        struct drm_i915_gem_exec_object2 *
                validation_entry = &batch->exec_objects[index];
Could I just call those exec_object?
-Chris
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to