drm/stm: drv: Improve data transfers
Subsystems (4)
PATCH 1/1 drm/stm: drv: Improve data transfers
To optimize data transfers, align pitch on 128 bytes & height on 4 bytes. This optimization is not applicable without MMU.
Signed-off-by Yannick Fertre <[email protected]>
Signed-off-by Vincent Abriou <[email protected]>
Signed-off-by Philippe Cornu <[email protected]>
--- drivers/gpu/drm/stm/drv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/stm/drv.c +21 -0
@@ -31,6 +31,23 @@ static const struct drm_mode_config_funcs drv_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; +#ifdef CONFIG_MMU +static int stm_dumb_create (struct drm_file *file,struct drm_device *dev, +struct drm_mode_create_dumb *args) +{ +unsigned int min_pitch =DIV_ROUND_UP (args->width * args->bpp,8 ); + +/* +* in order to optimize data transfer, pitch is aligned on +* 128 bytes, height is aligned on 4 bytes +*/ + args->pitch =roundup (min_pitch,128 ); + args->height =roundup (args->height,4 ); + +return drm_gem_cma_dumb_create_internal (file, dev, args); +} +#endif +DEFINE_DRM_GEM_CMA_FOPS (drv_driver_fops);static struct drm_driver drv_driver = {
@@ -44,7 +61,11 @@ static struct drm_driver drv_driver = { .minor = 0, .patchlevel = 0, .fops = &drv_driver_fops, +#ifdef CONFIG_MMU + .dumb_create = stm_dumb_create, +#else .dumb_create = drm_gem_cma_dumb_create, +#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_free_object_unlocked = drm_gem_cma_free_object,
Signature · 6 lines
2.15.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
2018-01-22 11:33 GMT+01:00 Philippe Cornu <[email protected]>:
Quoted 24 lines
To optimize data transfers, align pitch on 128 bytes & height on 4 bytes. This optimization is not applicable without MMU.
Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Vincent Abriou <[email protected]>Signed-off-by Philippe Cornu <[email protected]>--- drivers/gpu/drm/stm/drv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/stm/drv.c +6
-0@@ -31,6 +31,23 @@ static const struct drm_mode_config_funcs drv_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; +#ifdef CONFIG_MMU +static int stm_dumb_create (struct drm_file *file,struct drm_device *dev, +struct drm_mode_create_dumb *args) +{ +unsigned int min_pitch =DIV_ROUND_UP (args->width * args->bpp,8 ); +
drivers/gpu/drm/stm/drv.c static const struct drm_mode_config_funcs drv_mode_config_funcs = { · line 49
Quoted 10 lines
drivers/gpu/drm/stm/drv.c +10
-0+/* +* in order to optimize data transfer, pitch is aligned on +* 128 bytes, height is aligned on 4 bytes +*/ + args->pitch =roundup (min_pitch,128 ); + args->height =roundup (args->height,4 ); + + return drm_gem_cma_dumb_create_internal(file, dev, args); +} +#endif
I would prefer to always call stm_dumb_create (maybe renamed stm_gem_cma_dumb_create)
and change the parameters inside if the we have MMU.
Quoted 17 lines
drivers/gpu/drm/stm/drv.c +5
-1+DEFINE_DRM_GEM_CMA_FOPS (drv_driver_fops);static struct drm_driver drv_driver = {@@ -44,7 +61,11 @@ static struct drm_driver drv_driver = { .minor = 0, .patchlevel = 0, .fops = &drv_driver_fops, +#ifdef CONFIG_MMU + .dumb_create = stm_dumb_create, +#else .dumb_create = drm_gem_cma_dumb_create, +#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_free_object_unlocked = drm_gem_cma_free_object, --
Quoted 2 lines
2.15.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel