drm/malidp: Use struct drm_gem_object_funcs.get_sg_table internally
Subsystems (3)
Thomas Zimmermann
maintainerPATCH 1/1 drm/malidp: Use struct drm_gem_object_funcs.get_sg_table internally
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_planes.c +1 -1
@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);if (!sgt)return false;
Signature · 6 lines
2.28.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Thomas Zimmermann
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/arm/malidp_planes.c +0
-0
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 5 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);
Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ... -Daniel
Quoted 6 lines
drivers/gpu/drm/arm/malidp_planes.c +0
-0if (!sgt)return false;Signature · 1 line
2.28.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
Best regards
Thomas
Quoted 9 lines
-Daniel
Quoted 6 lines
drivers/gpu/drm/arm/malidp_planes.c +0
-0if (!sgt)return false;Signature · 1 line
2.28.0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 32 lines · Thomas Zimmermann
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Also the entire code is fairly suspect, getting at the sgt from plane_check is a bit iffy. But that's a different kind of problem. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 37 lines · Thomas Zimmermann
Quoted 36 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
Quoted 8 lines
Quoted 2 lines
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.
I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Best regards
Thomas
Quoted 2 lines
-Daniel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 46 lines · Thomas Zimmermann
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 43 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the cma_obj->sgt.
So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous dma_addr_t range when you take it all together. The code in drm_gem_cma_prime_import_sg_table() gets this more right.
So maybe right fix is to just ditch this all, and use cma helpers fully? -Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerAm 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 63 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 43 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.
Quoted 8 lines
So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
The driver already does use CMA, includingdrm_gem_cma_prime_import_sg_table().
The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
Best regards
Thomas
Quoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 75 lines · Thomas Zimmermann
Am 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 63 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 43 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.Quoted 8 lines
So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
Quoted 7 lines
The driver already does use CMA, including
drm_gem_cma_prime_import_sg_table().The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
Hm ok, no idea either.
But then we can just assume that cma_obj->sgt is always set, and we don't have to call anything. If a driver uses cma helpers, and cma doesn't set ->sgt over the lifetime of the buffer, that breaks a cma helper assumption since cma doens't support swap-out.
So converting the if to a WARN_ON and failing with an error, and then remove the else should work.
-Daniel
Quoted 34 lines
Best regards
ThomasQuoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix ImendörfferSignature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 13.08.20 um 12:31 schrieb Daniel Vetter:
Quoted 84 lines · Thomas Zimmermann
Quoted 75 lines
Am 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 63 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 43 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.Quoted 8 lines
So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
Quoted 7 lines
The driver already does use CMA, including
drm_gem_cma_prime_import_sg_table().The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
Quoted 6 lines
Hm ok, no idea either.
But then we can just assume that
cma_obj->sgtis always set, and we don't have to call anything. If a driver uses cma helpers, and cma doesn't set ->sgt over the lifetime of the buffer, that breaks a cma helper assumption since cma doens't support swap-out.
Really? I just looked at drm_gem_cma_helper.c and ->sgt is only ever set on imports, and only freed for imported memory. I'm confused now...
Best regards
Thomas
Quoted 43 lines
So converting the if to a
WARN_ONand failing with an error, and then remove the else should work.
-DanielQuoted 34 lines
Best regards
ThomasQuoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix ImendörfferSignature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
Reviewed-byQuoted 90 lines · Thomas Zimmermann
Hi
Am 13.08.20 um 12:31 schrieb Daniel Vetter:
Quoted 86 lines · Thomas Zimmermann
Quoted 75 lines
Am 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 63 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 43 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 10 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.Quoted 8 lines
So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
Quoted 7 lines
The driver already does use CMA, including
drm_gem_cma_prime_import_sg_table().The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
Hm ok, no idea either.
Quoted 7 lines
Quoted 4 lines
But then we can just assume that
cma_obj->sgtis always set, and we don't have to call anything. If a driver uses cma helpers, and cma doesn't set ->sgt over the lifetime of the buffer, that breaks a cma helper assumption since cma doens't support swap-out.Really? I just looked at
drm_gem_cma_helper.cand ->sgt is only ever set on imports, and only freed for imported memory. I'm confused now...
Hm right this works differently than I thought, for native cma objects we just store padd/vaddr and that's it. Still feels wrong that malidp digs around in an internal helper that's meant for exporting as a dma-buf.
Oh well I guess this is just a very special special case.
Quoted 56 lines
Best regards
ThomasQuoted 43 lines
So converting the if to a
WARN_ONand failing with an error, and then remove the else should work.
-DanielQuoted 34 lines
Best regards
ThomasQuoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Thomas Zimmermann
Hi
Am 13.08.20 um 12:31 schrieb Daniel Vetter:
Quoted 41 lines · Thomas Zimmermann
Quoted 40 lines
Am 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 37 lines · Thomas Zimmermann
Quoted 36 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 33 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 27 lines · Thomas Zimmermann
Quoted 18 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/arm/malidp_planes.c +0
-0drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 5 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
Hi,
Sorry for the silence, I was on holiday.
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Quoted 4 lines
Quoted 4 lines
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The driver already does use CMA, including
drm_gem_cma_prime_import_sg_table().The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
That's right, this piece of code has nothing to do with importing dma-buf or checking if things are contiguous. Mali DP hardware has a prefetcher block that can generate some fake requests during vblank to get the MMU pagetables cached so that reads from the buffers can be done without waiting for page walks. The block supports two modes, a full page or partial page request (to cater for the ends of the buffer that might not be a full page).
The patch proposed looks good to me, so:
I will push the patch into drm-misc-next if Daniel has no other comments.
Best regards,
Liviu
Quoted 82 lines
Quoted 10 lines
Quoted 7 lines
Hm ok, no idea either.
But then we can just assume that
cma_obj->sgtis always set, and we don't have to call anything. If a driver uses cma helpers, and cma doesn't set ->sgt over the lifetime of the buffer, that breaks a cma helper assumption since cma doens't support swap-out.Really? I just looked at
drm_gem_cma_helper.cand ->sgt is only ever set on imports, and only freed for imported memory. I'm confused now...Hm right this works differently than I thought, for native cma objects we just store padd/vaddr and that's it. Still feels wrong that malidp digs around in an internal helper that's meant for exporting as a dma-buf.
Oh well I guess this is just a very special special case.
Reviewed-by Daniel Vetter <[email protected]>Quoted 56 lines
Best regards
ThomasQuoted 43 lines
So converting the if to a
WARN_ONand failing with an error, and then remove the else should work.
-DanielQuoted 34 lines
Best regards
ThomasQuoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix ImendörfferSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develThomas Zimmermann
maintainerHi
Am 18.08.20 um 19:15 schrieb Liviu Dudau:
Quoted 102 lines · Daniel Vetter
Quoted 46 lines · Thomas Zimmermann
Quoted 45 lines
Hi
Am 13.08.20 um 12:31 schrieb Daniel Vetter:
Quoted 41 lines · Thomas Zimmermann
Quoted 40 lines
Am 13.08.20 um 11:48 schrieb Daniel Vetter:
Quoted 37 lines · Thomas Zimmermann
Quoted 36 lines
Hi
Am 07.08.20 um 18:10 schrieb Daniel Vetter:
Quoted 33 lines · Thomas Zimmermann
Quoted 32 lines
Hi
Am 07.08.20 um 15:12 schrieb Daniel Vetter:
Quoted 27 lines · Thomas Zimmermann
Quoted 18 lines
The malidp driver uses GEM object functions for callbacks. Fix it to use them internally as well.
Signed-off-by Thomas Zimmermann <[email protected]>Fixes ecdd6474644f ("drm/malidp: Use GEM CMA object functions")Cc Thomas Zimmermann <[email protected]>Cc Emil Velikov <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>--- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/arm/malidp_planes.c +0
-0drivers/gpu/drm/arm/malidp_planes.c static bool malidp_check_pages_threshold(struct malidp_plane_state *ms, · line 349
Quoted 5 lines
drivers/gpu/drm/arm/malidp_planes.c +1
-1@@ -346,7 +346,7 @@ static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,if (cma_obj->sgt) sgt = cma_obj->sgt;else - sgt = obj->dev->driver->gem_prime_get_sg_table (obj); + sgt = obj->funcs->get_sg_table (obj);Uh if there's not a switch somewhere I'd just call the right function directly. Or call the right wrapper for this, this feels a bit fishy ...
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
The driver initializes the pointer via CMA helper macro to an CMA-internal default. Calling the actual function here is fragile if the CMA-internal default ever changes.
But I have no strong feelings. I'll go with whatever the driver's maintainer prefers.
Hi,
Sorry for the silence, I was on holiday.
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Quoted 4 lines
Quoted 4 lines
What I meant is: There should be an exported helper to get at the sgt. Drivers using helpers shouldn't need to do this kind of stuff here.
Quoted 8 lines
Quoted 2 lines
Also the entire code is fairly suspect, getting at the sgt from
plane_checkis a bit iffy. But that's a different kind of problem.I tried to somehow move the code to CMA, but it's not easy. There's no good place to put the look-up code of sgt. And sgt is later being freed iff it came from the callback (and not freed if it was stored in the object). AFIACT the best options are to either keep the code here or move the entire function to CMA helpers.
Ok I read some code ... I'm confused. From the control flow it looks like malidp is using cma helpers. Otherwise why does the upcasting not blow up sometimes.
But cma helpers already check at import time that any imported dma-buf is contiguous, and they guarantee to fill out the
cma_obj->sgt.So really no idea what this code is doing here.
It's also not correct, since it doesn't coalesce sgt entries, since a range might be split up, but still mapped into a contiguous
dma_addr_trange when you take it all together. The code indrm_gem_cma_prime_import_sg_table()gets this more right.So maybe right fix is to just ditch this all, and use cma helpers fully?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The driver already does use CMA, including
drm_gem_cma_prime_import_sg_table().The patched code is not about importing/exporting sg tables. It configures the MMU's prefetching pattern by looking at some of the page sizes. I don't feel confident enough with this code to alter it. I'd expect to break the heuristics.
That's right, this piece of code has nothing to do with importing dma-buf or checking if things are contiguous. Mali DP hardware has a prefetcher block that can generate some fake requests during vblank to get the MMU pagetables cached so that reads from the buffers can be done without waiting for page walks. The block supports two modes, a full page or partial page request (to cater for the ends of the buffer that might not be a full page).
Quoted 5 lines
The patch proposed looks good to me, so:
Acked-by Liviu Dudau <[email protected]>I will push the patch into drm-misc-next if Daniel has no other comments.
Thanks for explaining. The patch has already been merged.
Best regards
Thomas
Quoted 87 lines
Best regards,
LiviuQuoted 82 lines
Quoted 10 lines
Quoted 7 lines
Hm ok, no idea either.
But then we can just assume that
cma_obj->sgtis always set, and we don't have to call anything. If a driver uses cma helpers, and cma doesn't set ->sgt over the lifetime of the buffer, that breaks a cma helper assumption since cma doens't support swap-out.Really? I just looked at
drm_gem_cma_helper.cand ->sgt is only ever set on imports, and only freed for imported memory. I'm confused now...Hm right this works differently than I thought, for native cma objects we just store padd/vaddr and that's it. Still feels wrong that malidp digs around in an internal helper that's meant for exporting as a dma-buf.
Oh well I guess this is just a very special special case.
Reviewed-by Daniel Vetter <[email protected]>Quoted 56 lines
Best regards
ThomasQuoted 43 lines
So converting the if to a
WARN_ONand failing with an error, and then remove the else should work.
-DanielQuoted 34 lines
Best regards
ThomasQuoted 21 lines
-Daniel
Quoted 15 lines
Best regards
ThomasQuoted 2 lines
-Daniel
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix ImendörfferSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel