Message ID | 20191115095200.777-1-ramalingam.c@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/fbdev: FB allocation from LMEM, if supported | expand |
On Fri, 15 Nov 2019 at 09:52, Ramalingam C <ramalingam.c@intel.com> wrote: > > FB for fbdev is allocated from LMEM if the platform supports LMEM. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > cc: Matthew Auld <matthew.auld@intel.com> Sounds reasonable I think. Do we also need to adjust intelfb_create as part of this? pin_iomap, gmadr etc?
Quoting Matthew Auld (2019-11-15 12:25:41) > On Fri, 15 Nov 2019 at 09:52, Ramalingam C <ramalingam.c@intel.com> wrote: > > > > FB for fbdev is allocated from LMEM if the platform supports LMEM. > > > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > > cc: Matthew Auld <matthew.auld@intel.com> > > Sounds reasonable I think. Do we also need to adjust intelfb_create as > part of this? pin_iomap, gmadr etc? I had a vague idea of doing an intel_fb_vma to abstract the different map handling. What can't be solved with one more layer of indirection? -Chris
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c index 48c960ca12fb..82efc0ca83d9 100644 --- a/drivers/gpu/drm/i915/display/intel_fbdev.c +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c @@ -42,6 +42,7 @@ #include <drm/drm_fourcc.h> #include <drm/i915_drm.h> +#include "gem/i915_gem_lmem.h" #include "i915_drv.h" #include "intel_display_types.h" #include "intel_fbdev.h" @@ -137,15 +138,22 @@ static int intelfb_alloc(struct drm_fb_helper *helper, size = mode_cmd.pitches[0] * mode_cmd.height; size = PAGE_ALIGN(size); - - /* If the FB is too big, just don't use it since fbdev is not very - * important and we should probably use that space with FBC or other - * features. */ obj = ERR_PTR(-ENODEV); - if (size * 2 < dev_priv->stolen_usable_size) - obj = i915_gem_object_create_stolen(dev_priv, size); - if (IS_ERR(obj)) - obj = i915_gem_object_create_shmem(dev_priv, size); + + if (HAS_LMEM(dev_priv)) { + obj = i915_gem_object_create_lmem(dev_priv, size, + I915_BO_ALLOC_CONTIGUOUS); + } else { + /* + * If the FB is too big, just don't use it since fbdev is not + * very important and we should probably use that space with + * FBC or other features. + */ + if (size * 2 < dev_priv->stolen_usable_size) + obj = i915_gem_object_create_stolen(dev_priv, size); + if (IS_ERR(obj)) + obj = i915_gem_object_create_shmem(dev_priv, size); + } if (IS_ERR(obj)) { DRM_ERROR("failed to allocate framebuffer\n"); return PTR_ERR(obj);
FB for fbdev is allocated from LMEM if the platform supports LMEM. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> cc: Matthew Auld <matthew.auld@intel.com> --- drivers/gpu/drm/i915/display/intel_fbdev.c | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)