Re: [PATCH] drm/amdgpu: Always align dumb buffer at PAGE_SIZE

2022-09-23 Thread lepton
On Thu, Sep 22, 2022 at 10:14 PM Christian König
 wrote:
>
> Am 23.09.22 um 01:04 schrieb Lepton Wu:
> > Since size has been aligned to PAGE_SIZE already, just align it
> > to PAGE_SIZE so later the buffer can be used as a texture in mesa
> > after https://cgit.freedesktop.org/mesa/mesa/commit/?id=f7a4051b8
> > Otherwise, si_texture_create_object will fail at line
> > "buf->alignment < tex->surface.alignment"
>
> I don't think that those Mesa checks are a good idea in the first place.
>
> The alignment value is often specified as zero when it doesn't matter
> because the minimum alignment can never be less than the page size.
Are you suggesting to change those mesa checks? While that can be
done, I still think a kernel side "fix" is still
useful since it doesn't hurt while can fix issues for some versions of mesa.
>
> Christian.
>
> >
> > Signed-off-by: Lepton Wu 
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > index 8ef31d687ef3b..8dca0c920d3ce 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > @@ -928,7 +928,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
> >   args->size = ALIGN(args->size, PAGE_SIZE);
> >   domain = amdgpu_bo_get_preferred_domain(adev,
> >   amdgpu_display_supported_domains(adev, 
> > flags));
> > - r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
> > + r = amdgpu_gem_object_create(adev, args->size, PAGE_SIZE, domain, 
> > flags,
> >ttm_bo_type_device, NULL, );
> >   if (r)
> >   return -ENOMEM;
>


[PATCH] drm/amdgpu: Always align dumb buffer at PAGE_SIZE

2022-09-23 Thread Lepton Wu
Since size has been aligned to PAGE_SIZE already, just align it
to PAGE_SIZE so later the buffer can be used as a texture in mesa
after https://cgit.freedesktop.org/mesa/mesa/commit/?id=f7a4051b8
Otherwise, si_texture_create_object will fail at line
"buf->alignment < tex->surface.alignment"

Signed-off-by: Lepton Wu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 8ef31d687ef3b..8dca0c920d3ce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -928,7 +928,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
args->size = ALIGN(args->size, PAGE_SIZE);
domain = amdgpu_bo_get_preferred_domain(adev,
amdgpu_display_supported_domains(adev, flags));
-   r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
+   r = amdgpu_gem_object_create(adev, args->size, PAGE_SIZE, domain, flags,
 ttm_bo_type_device, NULL, );
if (r)
return -ENOMEM;
-- 
2.37.3.998.g577e59143f-goog



Re: [PATCH v2] drm/amdgpu: fix null pointer reference to adev.

2020-07-07 Thread lepton
On Tue, Jul 7, 2020 at 11:22 AM Alex Deucher  wrote:
>
> On Tue, Jul 7, 2020 at 2:15 PM Lepton Wu  wrote:
> >
> > I hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail
> > to load firmwares since GPU was initialized before rootfs is ready.
> > Just gracefully fail in such cases.
> >
> > v2: Check return code of amdgpu_driver_load_kms
> >
> > Signed-off-by: Lepton Wu 
>
> Already fixed:
> https://cgit.freedesktop.org/drm/drm/commit/?id=7504d3bbec7da70516a13e34415b92bf5203399a
Nice, next time I will check drm tree instead of Linus tree for drm
related stuff.
>
> Alex
>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 126e74758a34..75bcd1789185 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -,7 +,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> >
> > pci_set_drvdata(pdev, dev);
> >
> > -   amdgpu_driver_load_kms(dev, ent->driver_data);
> > +   ret = amdgpu_driver_load_kms(dev, ent->driver_data);
> > +   if (ret)
> > +   goto err_pci;
> >
> >  retry_init:
> > ret = drm_dev_register(dev, ent->driver_data);
> > --
> > 2.27.0.212.ge8ba1cc988-goog
> >
> > ___
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH v2] drm/amdgpu: fix null pointer reference to adev.

2020-07-07 Thread Lepton Wu
I hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail
to load firmwares since GPU was initialized before rootfs is ready.
Just gracefully fail in such cases.

v2: Check return code of amdgpu_driver_load_kms

Signed-off-by: Lepton Wu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 126e74758a34..75bcd1789185 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -,7 +,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
pci_set_drvdata(pdev, dev);
 
-   amdgpu_driver_load_kms(dev, ent->driver_data);
+   ret = amdgpu_driver_load_kms(dev, ent->driver_data);
+   if (ret)
+   goto err_pci;
 
 retry_init:
ret = drm_dev_register(dev, ent->driver_data);
-- 
2.27.0.212.ge8ba1cc988-goog

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amdgpu: fix null pointer reference to adev.

2020-07-07 Thread Lepton Wu
I hit this when compiling amdgpu in kernel. amdgpu_driver_load_kms fail
to load firmwares since GPU was initialized before rootfs is ready.
Just gracefully fail in such cases.

Signed-off-by: Lepton Wu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 126e74758a34..f9d277f8ddd4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1124,7 +1124,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
goto err_pci;
 
adev = dev->dev_private;
-   ret = amdgpu_debugfs_init(adev);
+   if (adev)
+   ret = amdgpu_debugfs_init(adev);
if (ret)
DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index d7e17e34fee1..99a6ec49ead5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -978,6 +978,8 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
struct amdgpu_fpriv *fpriv;
int r, pasid;
 
+   if (!adev)
+   return -ENODEV;
/* Ensure IB tests are run on ring */
flush_delayed_work(>delayed_init_work);
 
-- 
2.27.0.212.ge8ba1cc988-goog

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx