[PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional

Noralf Trønnes noralf at tronnes.org
Mon Nov 6 12:40:07 UTC 2017


Den 06.11.2017 09.54, skrev Daniel Vetter:
> On Sat, Nov 04, 2017 at 02:03:55PM +0100, Noralf Trønnes wrote:
>> Make the drm_framebuffer_funcs argument optional for drivers that
>> don't need to set the dirty callback.
>>
>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> Looks like this patch ended up in the wrong patch series? Atm there's not
> much users of this (I guess they're still waiting for acks), and somehow
> I'd expect that there's some drivers which really want this (but I don't
> see any in this patch series). Looks good, but I'm a bit confused.

The purpose of this change is so the driver doesn't have to provide a
fb vtable if it doesn't need to set the dirty calback.

So if I didn't rework the cma helper to get rid of struct drm_fbdev_cma,
I would have followed up with this change:

-static const struct drm_framebuffer_funcs drm_fb_cma_funcs = {
-    .destroy    = drm_gem_fb_destroy,
-    .create_handle    = drm_gem_fb_create_handle,
-};
-
  /**
   * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
   * @dev: DRM device
   * @preferred_bpp: Preferred bits per pixel for the device
   * @max_conn_count: Maximum number of connectors
   *
   * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
   */
  struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
      unsigned int preferred_bpp, unsigned int max_conn_count)
  {
      return drm_fbdev_cma_init_with_funcs(dev, preferred_bpp,
                           max_conn_count,
  -                         &drm_fb_cma_funcs);
  +                         NULL);
  }
  EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);

Noralf.

> -Daniel
>
>> ---
>>   drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> index aa8cb9bfa499..4d682a6e8bcb 100644
>> --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> @@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
>>    * @sizes: fbdev size description
>>    * @pitch_align: Optional pitch alignment
>>    * @obj: GEM object backing the framebuffer
>> - * @funcs: vtable to be used for the new framebuffer object
>> + * @funcs: Optional vtable to be used for the new framebuffer object when the
>> + *         dirty callback is needed.
>>    *
>>    * This function creates a framebuffer from a &drm_fb_helper_surface_size
>>    * description for use in the &drm_fb_helper_funcs.fb_probe callback.
>> @@ -300,6 +301,9 @@ drm_gem_fbdev_fb_create(struct drm_device *dev,
>>   	if (obj->size < mode_cmd.pitches[0] * mode_cmd.height)
>>   		return ERR_PTR(-EINVAL);
>>   
>> +	if (!funcs)
>> +		funcs = &drm_gem_fb_funcs;
>> +
>>   	return drm_gem_fb_alloc(dev, &mode_cmd, &obj, 1, funcs);
>>   }
>>   EXPORT_SYMBOL(drm_gem_fbdev_fb_create);
>> -- 
>> 2.14.2
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel



More information about the dri-devel mailing list