Message ID | 20180330141138.28987-16-daniels@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Daniel, 2018년 03월 30일 23:11에 Daniel Stone 이(가) 쓴 글: > Since drm_framebuffer can now store GEM objects directly, place them > there rather than in our own subclass. As this makes the framebuffer > create_handle and destroy functions the same as the GEM framebuffer > helper, we can reuse those. Looks good and I will apply it including other two patches - 17 and 18 - after test. Thanks, Inki Dae > > Signed-off-by: Daniel Stone <daniels@collabora.com> > Cc: Inki Dae <inki.dae@samsung.com> > Cc: Joonyoung Shim <jy0922.shim@samsung.com> > Cc: Seung-Woo Kim <sw0312.kim@samsung.com> > Cc: Kyungmin Park <kyungmin.park@samsung.com> > --- > drivers/gpu/drm/exynos/exynos_drm_fb.c | 39 ++++------------------------------ > 1 file changed, 4 insertions(+), 35 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c > index 2379d732da67..d874c2d50ab6 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c > @@ -18,6 +18,7 @@ > #include <drm/drm_fb_helper.h> > #include <drm/drm_atomic.h> > #include <drm/drm_atomic_helper.h> > +#include <drm/drm_gem_framebuffer_helper.h> > #include <uapi/drm/exynos_drm.h> > > #include "exynos_drm_drv.h" > @@ -36,7 +37,6 @@ > */ > struct exynos_drm_fb { > struct drm_framebuffer fb; > - struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER]; > dma_addr_t dma_addr[MAX_FB_BUFFER]; > }; > > @@ -66,40 +66,9 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, > return 0; > } > > -static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) > -{ > - struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); > - unsigned int i; > - > - drm_framebuffer_cleanup(fb); > - > - for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem); i++) { > - struct drm_gem_object *obj; > - > - if (exynos_fb->exynos_gem[i] == NULL) > - continue; > - > - obj = &exynos_fb->exynos_gem[i]->base; > - drm_gem_object_unreference_unlocked(obj); > - } > - > - kfree(exynos_fb); > - exynos_fb = NULL; > -} > - > -static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb, > - struct drm_file *file_priv, > - unsigned int *handle) > -{ > - struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); > - > - return drm_gem_handle_create(file_priv, > - &exynos_fb->exynos_gem[0]->base, handle); > -} > - > static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = { > - .destroy = exynos_drm_fb_destroy, > - .create_handle = exynos_drm_fb_create_handle, > + .destroy = drm_gem_fb_destroy, > + .create_handle = drm_gem_fb_create_handle, > }; > > struct drm_framebuffer * > @@ -121,7 +90,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev, > if (ret < 0) > goto err; > > - exynos_fb->exynos_gem[i] = exynos_gem[i]; > + exynos_fb->fb.obj[i] = &exynos_gem[i]->base; > exynos_fb->dma_addr[i] = exynos_gem[i]->dma_addr > + mode_cmd->offsets[i]; > } >
Hi Inki, On 13 April 2018 at 10:55, Inki Dae <inki.dae@samsung.com> wrote: > 2018년 03월 30일 23:11에 Daniel Stone 이(가) 쓴 글: >> Since drm_framebuffer can now store GEM objects directly, place them >> there rather than in our own subclass. As this makes the framebuffer >> create_handle and destroy functions the same as the GEM framebuffer >> helper, we can reuse those. > > Looks good and I will apply it including other two patches - 17 and 18 - after test. Great news, thankyou. :) Cheers, Daniel
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 2379d732da67..d874c2d50ab6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -18,6 +18,7 @@ #include <drm/drm_fb_helper.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <uapi/drm/exynos_drm.h> #include "exynos_drm_drv.h" @@ -36,7 +37,6 @@ */ struct exynos_drm_fb { struct drm_framebuffer fb; - struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER]; dma_addr_t dma_addr[MAX_FB_BUFFER]; }; @@ -66,40 +66,9 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, return 0; } -static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) -{ - struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); - unsigned int i; - - drm_framebuffer_cleanup(fb); - - for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem); i++) { - struct drm_gem_object *obj; - - if (exynos_fb->exynos_gem[i] == NULL) - continue; - - obj = &exynos_fb->exynos_gem[i]->base; - drm_gem_object_unreference_unlocked(obj); - } - - kfree(exynos_fb); - exynos_fb = NULL; -} - -static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb, - struct drm_file *file_priv, - unsigned int *handle) -{ - struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); - - return drm_gem_handle_create(file_priv, - &exynos_fb->exynos_gem[0]->base, handle); -} - static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = { - .destroy = exynos_drm_fb_destroy, - .create_handle = exynos_drm_fb_create_handle, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, }; struct drm_framebuffer * @@ -121,7 +90,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev, if (ret < 0) goto err; - exynos_fb->exynos_gem[i] = exynos_gem[i]; + exynos_fb->fb.obj[i] = &exynos_gem[i]->base; exynos_fb->dma_addr[i] = exynos_gem[i]->dma_addr + mode_cmd->offsets[i]; }
Since drm_framebuffer can now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffer create_handle and destroy functions the same as the GEM framebuffer helper, we can reuse those. Signed-off-by: Daniel Stone <daniels@collabora.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Joonyoung Shim <jy0922.shim@samsung.com> Cc: Seung-Woo Kim <sw0312.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_fb.c | 39 ++++------------------------------ 1 file changed, 4 insertions(+), 35 deletions(-)