[Intel-gfx] [PATCH 15/18] drm/i915: Add a new "remapped" gtt_view
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Jul 19 20:16:20 UTC 2018
On Thu, Jul 19, 2018 at 08:46:54PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjälä (2018-07-19 20:33:57)
> > On Thu, Jul 19, 2018 at 07:59:33PM +0100, Chris Wilson wrote:
> > > Quoting Ville Syrjala (2018-07-19 19:22:11)
> > > > +static struct scatterlist *
> > > > +remap_pages(const dma_addr_t *in, unsigned int offset,
> > > > + unsigned int width, unsigned int height,
> > > > + unsigned int stride,
> > > > + struct sg_table *st, struct scatterlist *sg)
> > > > +{
> > > > + unsigned int column, row;
> > > > +
> > > > + for (row = 0; row < height; row++) {
> > > > + for (column = 0; column < width; column++) {
> > > > + st->nents++;
> > > > + /* We don't need the pages, but need to initialize
> > > > + * the entries so the sg list can be happily traversed.
> > > > + * The only thing we need are DMA addresses.
> > > > + */
> > > > + sg_set_page(sg, NULL, PAGE_SIZE, 0);
> > > > + sg_dma_address(sg) = in[offset + column];
> > > > + sg_dma_len(sg) = PAGE_SIZE;
> > > > + sg = sg_next(sg);
> > >
> > > Ok. But should be I915_GTT_PAGE_SIZE?
> >
> > I suppose. And now I wonder what would happen on gen2 with its
> > 2KiB gtt pages. Probably nothing good.
>
> Pffifle. We call it 4KiB. It's just about the semantics, and here we
> should be splitting the dma addresses by GTT_PAGE_SIZE rather than
> system page size.
>
> > > > +struct intel_remapped_info {
> > > > + struct intel_remapped_plane_info {
> > > > + /* tiles */
> > > > + unsigned int width, height, stride, offset;
> > > > + } plane[2];
> > > > + unsigned int unused;
> > >
> > > Tag it as mbz, since we do use it inside the compare. Hmm, I wonder if
> > > it actually is better if it doesn't exist if it isn't used, then it
> > > should be zero.. Hmm, not sure if that's defined at all, might have to
> > > say memset and don't rely on {} zeroing?
> > >
> > > Should work fine as a memcmp key for the rbtree.
> >
> > This whole thing is a bit questionale the way I did it. When populating
> > the gtt_view I just poke at view->rotated and rely on matching layout
> > for view->remapped. To make it less magic maybe I should embed one
> > inside the other?
>
> Hmm. If it's intentionally the same layout, then we should just use the
> same struct for both. remapped/remap_info is generic enough to cover
> rotation as well.
>
> > > > +} __packed;
> > > > +
> > > > +static inline void assert_intel_remapped_info_is_packed(void)
> > > > +{
> > > > + BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 10*sizeof(unsigned int));
Hmm. These assert inlines don't seem to be doing their job. Clearly
my struct size was 9 ints not 10.
--
Ville Syrjälä
Intel
More information about the Intel-gfx
mailing list