Re: [PATCH 1/2] drm/virtio: Defer the host dumb buffer creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 23, 2024 at 05:35:39PM GMT, Jocelyn Falempe wrote:
> On 23/08/2024 09:04, Gerd Hoffmann wrote:
> > > +static void virtio_gpu_deferred_create(struct virtio_gpu_object *bo,
> > > +				       struct virtio_gpu_device *vgdev,
> > > +				       const struct drm_mode_fb_cmd2 *mode_cmd)
> > > +{
> > > +	struct virtio_gpu_object_params params = { 0 };
> > > +
> > > +	params.format = virtio_gpu_translate_format(mode_cmd->pixel_format);
> > > +	params.width = mode_cmd->width;
> > > +	params.height = mode_cmd->height;
> > > +	params.size = params.height * params.width * 4;
> > > +	params.size = ALIGN(params.size, PAGE_SIZE);
> > > +	params.dumb = true;
> > 
> > I'd suggest to simply store the complete virtio_gpu_object_params struct
> > in virtio_gpu_object instead of re-creating it here.
> 
> The struct params is much bigger than the struct virtio_gpu_object, so I
> though it would waste too much memory. Using a pointer would add an
> alloc/free pair, and a potential source of memleak. And as we have the
> required parameters in struct drm_mode_fb_cmd2, I found it better this way.

You have to sanity-check the size then.

take care,
  Gerd




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux