drm_framebuffer boilerplate removal
Subsystems (19)
cover drm_framebuffer boilerplate removal
Hi,
I've been working on a getfb2[0] ioctl, which amongst other things supports multi-planar framebuffers as well as modifiers. getfb currently calls the framebuffer's handle_create hook, which doesn't support multiple planes.
Thanks to Noralf's recent work, drivers can just store GEM objects directly in drm_framebuffer. I use this directly in getfb2: we need direct access to the GEM objects and not a vfunc in order to not hand out duplicate GEM names for the same object.
This series converts all drivers except for nouveau, which was a little too non-trivial for my comfort, to storing GEM objects directly in drm_framebuffer. For those drivers whose driver_framebuffer struct was nothing but drm_framebuffer + BO, it deletes the driver-specific struct. It also makes use of Noralf's generic framebuffer helpers for create_handle and destroy where possible.
I don't have the hardware for most of these drivers, so have had to settle for just staring really hard at the diff.
I intend to remove create_handle when all drivers are converted over to placing BOs directly inside drm_framebuffer. For most drivers there's a relatively easy conversion to using the helpers for basically all framebuffer handling and fbdev emulation as well, though that's a bit further than I was willing to go without hardware to test on ...
Cheers,
Daniel
[0]: https://lists.freedesktop.org/archives/dri-devel/2018-March/170512.html
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/24 drm/cirrus: Place GEM BOs in drm_framebuffer
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.
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 1 - drivers/gpu/drm/cirrus/cirrus_fbdev.c | 8 ++++---- drivers/gpu/drm/cirrus/cirrus_main.c | 25 ++++--------------------- drivers/gpu/drm/cirrus/cirrus_mode.c | 4 ++-- 4 files changed, 10 insertions(+), 28 deletions(-)
drivers/gpu/drm/cirrus/cirrus_drv.h +0 -1
@@ -119,7 +119,6 @@ struct cirrus_connector {struct cirrus_framebuffer {struct drm_framebuffer base; -struct drm_gem_object *obj; };struct cirrus_mc {
drivers/gpu/drm/cirrus/cirrus_fbdev.c +4 -4
@@ -29,7 +29,7 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev,int x2, y2;unsigned long flags; - obj = afbdev->gfb.obj; + obj = afbdev->gfb.base.obj[0 ]; bo =gem_to_cirrus_bo (obj);/*
@@ -250,9 +250,9 @@ static int cirrus_fbdev_destroy(struct drm_device *dev,drm_fb_helper_unregister_fbi (&gfbdev->helper); -if (gfb->obj) { -drm_gem_object_put_unlocked (gfb->obj); - gfb->obj =NULL ; +if (gfb->base.obj[0 ]) { +drm_gem_object_put_unlocked (gfb->base.obj[0 ]); + gfb->base.obj[0 ] =NULL ; }vfree (gfbdev->sysram);
drivers/gpu/drm/cirrus/cirrus_main.c +4 -21
@@ -10,30 +10,13 @@*/ #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "cirrus_drv.h" -static int cirrus_create_handle (struct drm_framebuffer *fb, -struct drm_file * file_priv, -unsigned int * handle) -{ -struct cirrus_framebuffer *cirrus_fb =to_cirrus_framebuffer (fb); - -return drm_gem_handle_create (file_priv, cirrus_fb->obj, handle); -} - -static void cirrus_user_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct cirrus_framebuffer *cirrus_fb =to_cirrus_framebuffer (fb); - -drm_gem_object_put_unlocked (cirrus_fb->obj); -drm_framebuffer_cleanup (fb); -kfree (fb); -} -static const struct drm_framebuffer_funcs cirrus_fb_funcs = { - .create_handle = cirrus_create_handle, - .destroy = cirrus_user_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; int cirrus_framebuffer_init(struct drm_device *dev,
@@ -44,7 +27,7 @@ int cirrus_framebuffer_init(struct drm_device *dev,int ret;drm_helper_mode_fill_fb_struct (dev, &gfb->base, mode_cmd); - gfb->obj = obj; + gfb->base.obj[0 ] = obj; ret =drm_framebuffer_init (dev, &gfb->base, &cirrus_fb_funcs);if (ret) {DRM_ERROR ("drm_framebuffer_init failed: %d\n" , ret);
drivers/gpu/drm/cirrus/cirrus_mode.c +2 -2
@@ -110,7 +110,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc,/* push the previous fb to system ram */ if (!atomic && fb) { cirrus_fb =to_cirrus_framebuffer (fb); - obj = cirrus_fb->obj; + obj = cirrus_fb->base.obj[0 ]; bo =gem_to_cirrus_bo (obj); ret =cirrus_bo_reserve (bo, false);if (ret)
@@ -120,7 +120,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc, } cirrus_fb =to_cirrus_framebuffer (crtc->primary->fb); - obj = cirrus_fb->obj; + obj = cirrus_fb->base.obj[0 ]; bo =gem_to_cirrus_bo (obj); ret =cirrus_bo_reserve (bo, false);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/24 drm/cirrus: cirrus_framebuffer -> drm_framebuffer
Now cirrus_framebuffer is just an empty wrapper around drm_framebuffer, we can drop it.
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 9 ++------- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_main.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_mode.c | 12 +++--------- 4 files changed, 25 insertions(+), 36 deletions(-)
drivers/gpu/drm/cirrus/cirrus_drv.h +2 -7
@@ -92,7 +92,6 @@#define to_cirrus_crtc (x) container_of(x, struct cirrus_crtc, base)#define to_cirrus_encoder (x) container_of(x, struct cirrus_encoder, base) -#define to_cirrus_framebuffer (x) container_of(x, struct cirrus_framebuffer, base)struct cirrus_crtc {struct drm_crtc base;
@@ -117,10 +116,6 @@ struct cirrus_connector {struct drm_connector base; }; -struct cirrus_framebuffer { -struct drm_framebuffer base; -}; -struct cirrus_mc {resource_size_t vram_size;resource_size_t vram_base;
@@ -151,7 +146,7 @@ struct cirrus_device {struct cirrus_fbdev {struct drm_fb_helper helper; -struct cirrus_framebuffer gfb; +struct drm_framebuffer gfb;void *sysram;int size;int x1, y1, x2, y2;/* dirty rect */
@@ -197,7 +192,7 @@ int cirrus_dumb_create(struct drm_file *file, struct drm_mode_create_dumb *args);int cirrus_framebuffer_init (struct drm_device *dev, -struct cirrus_framebuffer *gfb, +struct drm_framebuffer *gfb,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object *obj);
drivers/gpu/drm/cirrus/cirrus_fbdev.c +10 -10
@@ -22,14 +22,14 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev,struct drm_gem_object *obj;struct cirrus_bo *bo;int src_offset, dst_offset; -int bpp = afbdev->gfb.base.format->cpp[0 ]; +int bpp = afbdev->gfb.format->cpp[0 ];int ret = -EBUSY ;bool unmap = false;bool store_for_later = false;int x2, y2;unsigned long flags; - obj = afbdev->gfb.base.obj[0 ]; + obj = afbdev->gfb.obj[0 ]; bo =gem_to_cirrus_bo (obj);/*
@@ -82,7 +82,7 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, }for (i = y; i < y + height; i++) {/* assume equal stride for now */ - src_offset = dst_offset = i * afbdev->gfb.base.pitches[0 ] + (x * bpp); + src_offset = dst_offset = i * afbdev->gfb.pitches[0 ] + (x * bpp);memcpy_toio (bo->kmap.virtual + src_offset, afbdev->sysram + src_offset, width * bpp); }
@@ -204,7 +204,7 @@ static int cirrusfb_create(struct drm_fb_helper *helper, gfbdev->sysram = sysram; gfbdev->size = size; - fb = &gfbdev->gfb.base; + fb = &gfbdev->gfb;if (!fb) {DRM_INFO ("fb is NULL\n" );return -EINVAL ;
@@ -246,19 +246,19 @@ static int cirrusfb_create(struct drm_fb_helper *helper,static int cirrus_fbdev_destroy (struct drm_device *dev,struct cirrus_fbdev *gfbdev) { -struct cirrus_framebuffer *gfb = &gfbdev->gfb; +struct drm_framebuffer *gfb = &gfbdev->gfb;drm_fb_helper_unregister_fbi (&gfbdev->helper); -if (gfb->base.obj[0 ]) { -drm_gem_object_put_unlocked (gfb->base.obj[0 ]); - gfb->base.obj[0 ] =NULL ; +if (gfb->obj[0 ]) { +drm_gem_object_put_unlocked (gfb->obj[0 ]); + gfb->obj[0 ] =NULL ; }vfree (gfbdev->sysram);drm_fb_helper_fini (&gfbdev->helper); -drm_framebuffer_unregister_private (&gfb->base); -drm_framebuffer_cleanup (&gfb->base); +drm_framebuffer_unregister_private (gfb); +drm_framebuffer_cleanup (gfb);return 0 ; }
drivers/gpu/drm/cirrus/cirrus_main.c +10 -10
@@ -20,15 +20,15 @@ static const struct drm_framebuffer_funcs cirrus_fb_funcs = { };int cirrus_framebuffer_init (struct drm_device *dev, -struct cirrus_framebuffer *gfb, +struct drm_framebuffer *gfb,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object *obj) {int ret; -drm_helper_mode_fill_fb_struct (dev, &gfb->base, mode_cmd); - gfb->base.obj[0 ] = obj; - ret =drm_framebuffer_init (dev, &gfb->base, &cirrus_fb_funcs); +drm_helper_mode_fill_fb_struct (dev, gfb, mode_cmd); + gfb->obj[0 ] = obj; + ret =drm_framebuffer_init (dev, gfb, &cirrus_fb_funcs);if (ret) {DRM_ERROR ("drm_framebuffer_init failed: %d\n" , ret);return ret;
@@ -43,7 +43,7 @@ cirrus_user_framebuffer_create(struct drm_device *dev, {struct cirrus_device *cdev = dev->dev_private;struct drm_gem_object *obj; -struct cirrus_framebuffer *cirrus_fb; +struct drm_framebuffer *fb;u32 bpp;int ret;
@@ -57,19 +57,19 @@ cirrus_user_framebuffer_create(struct drm_device *dev,if (obj ==NULL )return ERR_PTR (-ENOENT ); - cirrus_fb =kzalloc (sizeof (*cirrus_fb),GFP_KERNEL ); -if (!cirrus_fb) { + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb) {drm_gem_object_put_unlocked (obj);return ERR_PTR (-ENOMEM ); } - ret =cirrus_framebuffer_init (dev, cirrus_fb, mode_cmd, obj); + ret =cirrus_framebuffer_init (dev, fb, mode_cmd, obj);if (ret) {drm_gem_object_put_unlocked (obj); -kfree (cirrus_fb); +kfree (fb);return ERR_PTR (ret); } -return &cirrus_fb->base; +return fb; }static const struct drm_mode_config_funcs cirrus_mode_funcs = {
drivers/gpu/drm/cirrus/cirrus_mode.c +3 -9
@@ -101,17 +101,13 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc, int x, int y, int atomic) {struct cirrus_device *cdev = crtc->dev->dev_private; -struct drm_gem_object *obj; -struct cirrus_framebuffer *cirrus_fb;struct cirrus_bo *bo;int ret;u64 gpu_addr;/* push the previous fb to system ram */ if (!atomic && fb) { - cirrus_fb =to_cirrus_framebuffer (fb); - obj = cirrus_fb->base.obj[0 ]; - bo =gem_to_cirrus_bo (obj); + bo =gem_to_cirrus_bo (fb->obj[0 ]); ret =cirrus_bo_reserve (bo, false);if (ret)return ret;
@@ -119,9 +115,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc,cirrus_bo_unreserve (bo); } - cirrus_fb =to_cirrus_framebuffer (crtc->primary->fb); - obj = cirrus_fb->base.obj[0 ]; - bo =gem_to_cirrus_bo (obj); + bo =gem_to_cirrus_bo (crtc->primary->fb->obj[0 ]); ret =cirrus_bo_reserve (bo, false);if (ret)
@@ -133,7 +127,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc,return ret; } -if (&cdev->mode_info.gfbdev->gfb == cirrus_fb) { +if (&cdev->mode_info.gfbdev->gfb == crtc->primary->fb) {/* if pushing console in kmap it */ ret =ttm_bo_kmap (&bo->bo,0 , bo->bo.num_pages, &bo->kmap);if (ret)
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/24] drm/cirrus: cirrus_framebuffer -> drm_framebuffer
Quoted 7 lines · Daniel Stone
Now
cirrus_framebufferis just an empty wrapper arounddrm_framebuffer, we can drop it.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 9 ++------- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_main.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_mode.c | 12 +++--------- 4 files changed, 25 insertions(+), 36 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 02/24] drm/cirrus: cirrus_framebuffer -> drm_framebuffer
In reply to Daniel StoneQuoted 7 lines · Daniel Stone
Now
cirrus_framebufferis just an empty wrapper arounddrm_framebuffer, we can drop it.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 9 ++------- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_main.c | 20 ++++++++++---------- drivers/gpu/drm/cirrus/cirrus_mode.c | 12 +++--------- 4 files changed, 25 insertions(+), 36 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/24 drm/virtio: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 30 +++++------------------------- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 8 ++++---- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 4 files changed, 11 insertions(+), 32 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +5 -25
@@ -28,6 +28,7 @@#include "virtgpu_drv.h" #include <drm/drm_crtc_helper.h> #include <drm/drm_atomic_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #define XRES_MIN 32#define YRES_MIN 32
@@ -48,16 +49,6 @@ static const struct drm_crtc_funcs virtio_gpu_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; -static void virtio_gpu_user_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct virtio_gpu_framebuffer *virtio_gpu_fb - =to_virtio_gpu_framebuffer (fb); - -drm_gem_object_put_unlocked (virtio_gpu_fb->obj); -drm_framebuffer_cleanup (fb); -kfree (virtio_gpu_fb); -} - static int virtio_gpu_framebuffer_surface_dirty(struct drm_framebuffer *fb, struct drm_file *file_priv,
@@ -71,20 +62,9 @@ virtio_gpu_framebuffer_surface_dirty(struct drm_framebuffer *fb,return virtio_gpu_surface_dirty (virtio_gpu_fb, clips, num_clips); } -static int -virtio_gpu_framebuffer_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct virtio_gpu_framebuffer *virtio_gpu_fb = -to_virtio_gpu_framebuffer (fb); - -return drm_gem_handle_create (file_priv, virtio_gpu_fb->obj, handle); -} -static const struct drm_framebuffer_funcs virtio_gpu_fb_funcs = { - .create_handle = virtio_gpu_framebuffer_create_handle, - .destroy = virtio_gpu_user_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, .dirty = virtio_gpu_framebuffer_surface_dirty, };
@@ -97,7 +77,7 @@ virtio_gpu_framebuffer_init(struct drm_device *dev,int ret;struct virtio_gpu_object *bo; - vgfb->obj = obj; + vgfb->base.obj[0 ] = obj; bo =gem_to_virtio_gpu_obj (obj);
@@ -105,7 +85,7 @@ virtio_gpu_framebuffer_init(struct drm_device *dev, ret =drm_framebuffer_init (dev, &vgfb->base, &virtio_gpu_fb_funcs);if (ret) { - vgfb->obj =NULL ; + vgfb->base.obj[0 ] =NULL ;return ret; }
drivers/gpu/drm/virtio/virtgpu_drv.h +0 -1
@@ -124,7 +124,6 @@ struct virtio_gpu_output {struct virtio_gpu_framebuffer {struct drm_framebuffer base; -struct drm_gem_object *obj;int x1, y1, x2, y2;/* dirty rect */ spinlock_t dirty_lock;uint32_t hw_res_handle;
drivers/gpu/drm/virtio/virtgpu_fb.c +4 -4
@@ -46,7 +46,7 @@ static int virtio_gpu_dirty_update(struct virtio_gpu_framebuffer *fb,int bpp = fb->base.format->cpp[0 ];int x2, y2;unsigned long flags; -struct virtio_gpu_object *obj =gem_to_virtio_gpu_obj (fb->obj); +struct virtio_gpu_object *obj =gem_to_virtio_gpu_obj (fb->base.obj[0 ]); if ((width <= 0) || (x + width > fb->base.width) ||
@@ -121,7 +121,7 @@ int virtio_gpu_surface_dirty(struct virtio_gpu_framebuffer *vgfb, unsigned int num_clips) {struct virtio_gpu_device *vgdev = vgfb->base.dev->dev_private; -struct virtio_gpu_object *obj =gem_to_virtio_gpu_obj (vgfb->obj); +struct virtio_gpu_object *obj =gem_to_virtio_gpu_obj (vgfb->base.obj[0 ]);struct drm_clip_rect norect;struct drm_clip_rect *clips_ptr;int left, right, top, bottom;
@@ -305,8 +305,8 @@ static int virtio_gpu_fbdev_destroy(struct drm_device *dev,drm_fb_helper_unregister_fbi (&vgfbdev->helper); -if (vgfb->obj) - vgfb->obj =NULL ; +if (vgfb->base.obj[0 ]) + vgfb->base.obj[0 ] =NULL ;drm_fb_helper_fini (&vgfbdev->helper);drm_framebuffer_cleanup (&vgfb->base);
drivers/gpu/drm/virtio/virtgpu_plane.c +2 -2
@@ -154,7 +154,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,if (plane->state->fb) { vgfb =to_virtio_gpu_framebuffer (plane->state->fb); - bo =gem_to_virtio_gpu_obj (vgfb->obj); + bo =gem_to_virtio_gpu_obj (vgfb->base.obj[0 ]); handle = bo->hw_res_handle;if (bo->dumb) { virtio_gpu_cmd_transfer_to_host_2d
@@ -208,7 +208,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,if (plane->state->fb) { vgfb =to_virtio_gpu_framebuffer (plane->state->fb); - bo =gem_to_virtio_gpu_obj (vgfb->obj); + bo =gem_to_virtio_gpu_obj (vgfb->base.obj[0 ]); handle = bo->hw_res_handle; }else { handle =0 ;
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 03/24] drm/virtio: Place GEM BOs in drm_framebuffer
Quoted 9 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/virtio/virtgpu_display.c | 30 +++++------------------------- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 8 ++++---- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 4 files changed, 11 insertions(+), 32 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 03/24] drm/virtio: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneQuoted 9 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/virtio/virtgpu_display.c | 30 +++++------------------------- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 8 ++++---- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 4 files changed, 11 insertions(+), 32 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/24 drm/rockchip: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 36 +++++------------------------- 1 file changed, 6 insertions(+), 30 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +6 -30
@@ -18,6 +18,7 @@#include <drm/drm_atomic.h> #include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "rockchip_drm_drv.h" #include "rockchip_drm_fb.h"
@@ -28,40 +29,15 @@struct rockchip_drm_fb {struct drm_framebuffer fb; -struct drm_gem_object *obj[ROCKCHIP_MAX_FB_BUFFER ]; };struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb,unsigned int plane) { -struct rockchip_drm_fb *rk_fb =to_rockchip_fb (fb); -if (plane >=ROCKCHIP_MAX_FB_BUFFER )return NULL ; -return rk_fb->obj[plane]; -} - -static void rockchip_drm_fb_destroy (struct drm_framebuffer *fb) -{ -struct rockchip_drm_fb *rockchip_fb =to_rockchip_fb (fb); -int i; - -for (i =0 ; i <ROCKCHIP_MAX_FB_BUFFER ; i++) -drm_gem_object_put_unlocked (rockchip_fb->obj[i]); - -drm_framebuffer_cleanup (fb); -kfree (rockchip_fb); -} - -static int rockchip_drm_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct rockchip_drm_fb *rockchip_fb =to_rockchip_fb (fb); - -return drm_gem_handle_create (file_priv, - rockchip_fb->obj[0 ], handle); +return fb->obj[plane]; } static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb,
@@ -75,9 +51,9 @@ static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb, }static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { - .destroy = rockchip_drm_fb_destroy, - .create_handle = rockchip_drm_fb_create_handle, - .dirty = rockchip_drm_fb_dirty, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .dirty = rockchip_drm_fb_dirty, }; static struct rockchip_drm_fb *
@@ -95,7 +71,7 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmdrm_helper_mode_fill_fb_struct (dev, &rockchip_fb->fb, mode_cmd);for (i =0 ; i < num_planes; i++) - rockchip_fb->obj[i] = obj[i]; + rockchip_fb->fb.obj[i] = obj[i]; ret =drm_framebuffer_init (dev, &rockchip_fb->fb, &rockchip_drm_fb_funcs);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/24] drm/rockchip: Place GEM BOs in drm_framebuffer
Quoted 6 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>
Quoted 89 lines
Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 36 +++++------------------------- 1 file changed, 6 insertions(+), 30 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_fb.c +6
-30@@ -18,6 +18,7 @@#include <drm/drm_atomic.h> #include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "rockchip_drm_drv.h" #include "rockchip_drm_fb.h" @@ -28,40 +29,15 @@struct rockchip_drm_fb {struct drm_framebuffer fb; -struct drm_gem_object *obj[ROCKCHIP_MAX_FB_BUFFER ]; };struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb,unsigned int plane) { -struct rockchip_drm_fb *rk_fb =to_rockchip_fb (fb); -if (plane >=ROCKCHIP_MAX_FB_BUFFER )return NULL ; -return rk_fb->obj[plane]; -} - -static void rockchip_drm_fb_destroy (struct drm_framebuffer *fb) -{ -struct rockchip_drm_fb *rockchip_fb =to_rockchip_fb (fb); -int i; - -for (i =0 ; i <ROCKCHIP_MAX_FB_BUFFER ; i++) -drm_gem_object_put_unlocked (rockchip_fb->obj[i]); - -drm_framebuffer_cleanup (fb); -kfree (rockchip_fb); -} - -static int rockchip_drm_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct rockchip_drm_fb *rockchip_fb =to_rockchip_fb (fb); - -return drm_gem_handle_create (file_priv, - rockchip_fb->obj[0 ], handle); +return fb->obj[plane]; } static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb,@@ -75,9 +51,9 @@ static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb, }static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { - .destroy = rockchip_drm_fb_destroy, - .create_handle = rockchip_drm_fb_create_handle, - .dirty = rockchip_drm_fb_dirty, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .dirty = rockchip_drm_fb_dirty, }; static struct rockchip_drm_fb *@@ -95,7 +71,7 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmdrm_helper_mode_fill_fb_struct (dev, &rockchip_fb->fb, mode_cmd);for (i =0 ; i < num_planes; i++) - rockchip_fb->obj[i] = obj[i]; + rockchip_fb->fb.obj[i] = obj[i]; ret =drm_framebuffer_init (dev, &rockchip_fb->fb, &rockchip_drm_fb_funcs);Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/24] drm/rockchip: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneQuoted 11 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 36 +++++------------------------- 1 file changed, 6 insertions(+), 30 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/24 drm/rockchip: rockchip_drm_fb -> drm_framebuffer
In reply to Daniel StoneNow that rockchip_drm_fb is just a wrapper around drm_framebuffer, we can remove it.
--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 54 ++++++++++------------------- drivers/gpu/drm/rockchip/rockchip_drm_fb.h | 3 -- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +-- 3 files changed, 21 insertions(+), 40 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +19 -35
@@ -25,21 +25,6 @@#include "rockchip_drm_gem.h" #include "rockchip_drm_psr.h" -#define to_rockchip_fb (x) container_of(x, struct rockchip_drm_fb, fb) - -struct rockchip_drm_fb { -struct drm_framebuffer fb; -}; - -struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb, -unsigned int plane) -{ -if (plane >=ROCKCHIP_MAX_FB_BUFFER ) -return NULL ; - -return fb->obj[plane]; -} - static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb, struct drm_file *file, unsigned int flags, unsigned int color,
@@ -56,41 +41,40 @@ static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { .dirty = rockchip_drm_fb_dirty, }; -static struct rockchip_drm_fb * +static struct drm_framebuffer *rockchip_fb_alloc (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **obj,unsigned int num_planes) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;int ret;int i; - rockchip_fb =kzalloc (sizeof (*rockchip_fb),GFP_KERNEL ); -if (!rockchip_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &rockchip_fb->fb, mode_cmd); +drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd);for (i =0 ; i < num_planes; i++) - rockchip_fb->fb.obj[i] = obj[i]; + fb->obj[i] = obj[i]; - ret =drm_framebuffer_init (dev, &rockchip_fb->fb, - &rockchip_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &rockchip_drm_fb_funcs);if (ret) {DRM_DEV_ERROR (dev->dev,"Failed to initialize framebuffer: %d\n" , ret); -kfree (rockchip_fb); +kfree (fb);return ERR_PTR (ret); } -return rockchip_fb; +return fb; }static struct drm_framebuffer *rockchip_user_fb_create (struct drm_device *dev,struct drm_file *file_priv,const struct drm_mode_fb_cmd2 *mode_cmd) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;struct drm_gem_object *objs[ROCKCHIP_MAX_FB_BUFFER ];struct drm_gem_object *obj;unsigned int hsub;
@@ -129,13 +113,13 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, objs[i] = obj; } - rockchip_fb =rockchip_fb_alloc (dev, mode_cmd, objs, i); -if (IS_ERR (rockchip_fb)) { - ret =PTR_ERR (rockchip_fb); + fb =rockchip_fb_alloc (dev, mode_cmd, objs, i); +if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto err_gem_object_unreference; } -return &rockchip_fb->fb; +return fb; err_gem_object_unreference:for (i--; i >=0 ; i--)
@@ -159,13 +143,13 @@ rockchip_drm_framebuffer_init(struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object *obj) { - struct rockchip_drm_fb *rockchip_fb; + struct drm_framebuffer *fb; - rockchip_fb =rockchip_fb_alloc (dev, mode_cmd, &obj,1 ); -if (IS_ERR (rockchip_fb)) -return ERR_CAST (rockchip_fb); + fb =rockchip_fb_alloc (dev, mode_cmd, &obj,1 ); +if (IS_ERR (fb)) +return ERR_CAST (fb); -return &rockchip_fb->fb; +return fb; }void rockchip_drm_mode_config_init (struct drm_device *dev)
drivers/gpu/drm/rockchip/rockchip_drm_fb.h +0 -3
@@ -22,7 +22,4 @@ rockchip_drm_framebuffer_init(struct drm_device *dev,void rockchip_drm_framebuffer_fini (struct drm_framebuffer *fb);void rockchip_drm_mode_config_init (struct drm_device *dev); - -struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb, -unsigned int plane);#endif /* _ROCKCHIP_DRM_FB_H */
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -2
@@ -724,7 +724,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,return ; } - obj =rockchip_fb_get_gem_obj (fb,0 ); + obj = fb->obj[0 ]; rk_obj =to_rockchip_obj (obj); actual_w =drm_rect_width (src) >>16 ;
@@ -754,7 +754,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,int vsub =drm_format_vert_chroma_subsampling (fb->format->format);int bpp = fb->format->cpp[1 ]; - uv_obj =rockchip_fb_get_gem_obj (fb,1 ); + uv_obj = fb->obj[1 ]; rk_uv_obj =to_rockchip_obj (uv_obj); offset = (src->x1 >>16 ) * bpp / hsub;
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/24] drm/rockchip: rockchip_drm_fb -> drm_framebuffer
Quoted 6 lines · Daniel Stone
Now that
rockchip_drm_fbis just a wrapper arounddrm_framebuffer, we can remove it.Signed-off-by Daniel Stone <[email protected]>Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>
Ping?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Heiko Stübner
maintainerRe: [PATCH 05/24] drm/rockchip: rockchip_drm_fb -> drm_framebuffer
Hi Daniel,
Am Donnerstag, 17. Mai 2018, 15:08:15 CEST schrieb Daniel Stone:
Quoted 9 lines · Daniel Stone
Quoted 6 lines
Now that
rockchip_drm_fbis just a wrapper arounddrm_framebuffer, we can remove it.Signed-off-by Daniel Stone <[email protected]>Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>Ping?
I only see the cover-letter (not listing all patches of the series) plus patches 4+5 of the series, nothing else.
Both patches seem to reference other previous patches (1-3?) so could you point me at mboxes [patchwork] for those?
Thanks
Heiko
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/24] drm/rockchip: rockchip_drm_fb -> drm_framebuffer
Hi Heiko,
Quoted 9 lines · Heiko Stübner
Am Donnerstag, 17. Mai 2018, 15:08:15 CEST schrieb Daniel Stone:
Quoted 8 lines · Daniel Stone
Quoted 6 lines
Now that
rockchip_drm_fbis just a wrapper arounddrm_framebuffer, we can remove it.Signed-off-by Daniel Stone <[email protected]>Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>
Quoted 7 lines
Quoted 1 line
Ping?
I only see the cover-letter (not listing all patches of the series) plus patches 4+5 of the series, nothing else.
Both patches seem to reference other previous patches (1-3?) so could you point me at mboxes [patchwork] for those?
The series is available at:
https://patchwork.freedesktop.org/series/40944/
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/24] drm/rockchip: rockchip_drm_fb -> drm_framebuffer
In reply to Daniel StoneQuoted 4 lines · Daniel Stone
Now that
rockchip_drm_fbis just a wrapper arounddrm_framebuffer, we can remove it.Signed-off-by Daniel Stone <[email protected]>
Quoted 164 lines
Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 54 ++++++++++------------------- drivers/gpu/drm/rockchip/rockchip_drm_fb.h | 3 -- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +-- 3 files changed, 21 insertions(+), 40 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_fb.c +19
-35@@ -25,21 +25,6 @@#include "rockchip_drm_gem.h" #include "rockchip_drm_psr.h" -#define to_rockchip_fb (x) container_of(x, struct rockchip_drm_fb, fb) - -struct rockchip_drm_fb { -struct drm_framebuffer fb; -}; - -struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb, -unsigned int plane) -{ -if (plane >=ROCKCHIP_MAX_FB_BUFFER ) -return NULL ; - -return fb->obj[plane]; -} - static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb, struct drm_file *file, unsigned int flags, unsigned int color,@@ -56,41 +41,40 @@ static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { .dirty = rockchip_drm_fb_dirty, }; -static struct rockchip_drm_fb * +static struct drm_framebuffer *rockchip_fb_alloc (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **obj,unsigned int num_planes) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;int ret;int i; - rockchip_fb =kzalloc (sizeof (*rockchip_fb),GFP_KERNEL ); -if (!rockchip_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &rockchip_fb->fb, mode_cmd); +drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd);for (i =0 ; i < num_planes; i++) - rockchip_fb->fb.obj[i] = obj[i]; + fb->obj[i] = obj[i]; - ret =drm_framebuffer_init (dev, &rockchip_fb->fb, - &rockchip_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &rockchip_drm_fb_funcs);if (ret) {DRM_DEV_ERROR (dev->dev,"Failed to initialize framebuffer: %d\n" , ret); -kfree (rockchip_fb); +kfree (fb);return ERR_PTR (ret); } -return rockchip_fb; +return fb; }static struct drm_framebuffer *rockchip_user_fb_create (struct drm_device *dev,struct drm_file *file_priv,const struct drm_mode_fb_cmd2 *mode_cmd) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;struct drm_gem_object *objs[ROCKCHIP_MAX_FB_BUFFER ];struct drm_gem_object *obj;unsigned int hsub;@@ -129,13 +113,13 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, objs[i] = obj; } - rockchip_fb =rockchip_fb_alloc (dev, mode_cmd, objs, i); -if (IS_ERR (rockchip_fb)) { - ret =PTR_ERR (rockchip_fb); + fb =rockchip_fb_alloc (dev, mode_cmd, objs, i); +if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto err_gem_object_unreference; } -return &rockchip_fb->fb; +return fb; err_gem_object_unreference:for (i--; i >=0 ; i--)@@ -159,13 +143,13 @@ rockchip_drm_framebuffer_init(struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object *obj) { - struct rockchip_drm_fb *rockchip_fb; + struct drm_framebuffer *fb; - rockchip_fb =rockchip_fb_alloc (dev, mode_cmd, &obj,1 ); -if (IS_ERR (rockchip_fb)) -return ERR_CAST (rockchip_fb); + fb =rockchip_fb_alloc (dev, mode_cmd, &obj,1 ); +if (IS_ERR (fb)) +return ERR_CAST (fb); -return &rockchip_fb->fb; +return fb; }void rockchip_drm_mode_config_init (struct drm_device *dev)drivers/gpu/drm/rockchip/rockchip_drm_fb.h +0
-3@@ -22,7 +22,4 @@ rockchip_drm_framebuffer_init(struct drm_device *dev,void rockchip_drm_framebuffer_fini (struct drm_framebuffer *fb);void rockchip_drm_mode_config_init (struct drm_device *dev); - -struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb, -unsigned int plane);#endif /* _ROCKCHIP_DRM_FB_H */ drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2
-2@@ -724,7 +724,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,return ; } - obj =rockchip_fb_get_gem_obj (fb,0 ); + obj = fb->obj[0 ]; rk_obj =to_rockchip_obj (obj); actual_w =drm_rect_width (src) >>16 ;@@ -754,7 +754,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,int vsub =drm_format_vert_chroma_subsampling (fb->format->format);int bpp = fb->format->cpp[1 ]; - uv_obj =rockchip_fb_get_gem_obj (fb,1 ); + uv_obj = fb->obj[1 ]; rk_uv_obj =to_rockchip_obj (uv_obj); offset = (src->x1 >>16 ) * bpp / hsub;Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/24] drm/rockchip: rockchip_drm_fb -> drm_framebuffer
In reply to Daniel StoneQuoted 78 lines · Daniel Stone
Now that
rockchip_drm_fbis just a wrapper arounddrm_framebuffer, we can remove it.Signed-off-by Daniel Stone <[email protected]>Cc Sandy Huang <[email protected]>Cc Heiko Stübner <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 54 ++++++++++------------------- drivers/gpu/drm/rockchip/rockchip_drm_fb.h | 3 -- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +-- 3 files changed, 21 insertions(+), 40 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_fb.c +8
-25@@ -25,21 +25,6 @@#include "rockchip_drm_gem.h" #include "rockchip_drm_psr.h" -#define to_rockchip_fb (x) container_of(x, struct rockchip_drm_fb, fb) - -struct rockchip_drm_fb { -struct drm_framebuffer fb; -}; - -struct drm_gem_object *rockchip_fb_get_gem_obj (struct drm_framebuffer *fb, -unsigned int plane) -{ -if (plane >=ROCKCHIP_MAX_FB_BUFFER ) -return NULL ; - -return fb->obj[plane]; -} - static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb, struct drm_file *file, unsigned int flags, unsigned int color,@@ -56,41 +41,40 @@ static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { .dirty = rockchip_drm_fb_dirty, }; -static struct rockchip_drm_fb * +static struct drm_framebuffer *rockchip_fb_alloc (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **obj,unsigned int num_planes) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;int ret;int i; - rockchip_fb =kzalloc (sizeof (*rockchip_fb),GFP_KERNEL ); -if (!rockchip_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &rockchip_fb->fb, mode_cmd); +drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd);for (i =0 ; i < num_planes; i++) - rockchip_fb->fb.obj[i] = obj[i]; + fb->obj[i] = obj[i]; - ret =drm_framebuffer_init (dev, &rockchip_fb->fb, - &rockchip_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &rockchip_drm_fb_funcs);if (ret) {DRM_DEV_ERROR (dev->dev,"Failed to initialize framebuffer: %d\n" , ret); -kfree (rockchip_fb); +kfree (fb);return ERR_PTR (ret); } -return rockchip_fb;
drivers/gpu/drm/rockchip/rockchip_drm_fb.c static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { · line 78
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +2
-1+return fb; }static struct drm_framebuffer *rockchip_user_fb_create (struct drm_device *dev,struct drm_file *file_priv,const struct drm_mode_fb_cmd2 *mode_cmd) { -struct rockchip_drm_fb *rockchip_fb; +struct drm_framebuffer *fb;struct drm_gem_object *objs[ROCKCHIP_MAX_FB_BUFFER ];
The use of the ROCKCHIP_MAX_FB_BUFFER seems somewhat misguided here. What if a given pixel format requires 4 planes? This function will just silently ignore the last plane. Not sure that's a good idea. Currently I don't know of any formats that require 4 planes, so this is probably not an issue, but there's also no reason to limit this to anything less than the 4 planes that's baked into the KMS ABI everywhere.
Anyway, just a random comment and it doesn't have anything to do with this series, so:
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/24 drm/omap: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/omapdrm/omap_fb.c | 60 ++++++++++----------------------------- 1 file changed, 15 insertions(+), 45 deletions(-)
drivers/gpu/drm/omapdrm/omap_fb.c +15 -45
@@ -19,6 +19,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "omap_dmm_tiler.h" #include "omap_drv.h"
@@ -51,7 +52,6 @@ static const u32 formats[] = {/* per-plane info for the fb: */ struct plane { -struct drm_gem_object *bo;u32 pitch;u32 offset;dma_addr_t dma_addr;
@@ -68,36 +68,9 @@ struct omap_framebuffer {struct mutex lock; }; -static int omap_framebuffer_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -return drm_gem_handle_create (file_priv, - omap_fb->planes[0 ].bo, handle); -} - -static void omap_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -int i, n = fb->format->num_planes; - -DBG ("destroy: FB ID: %d (%p)" , fb->base.id, fb); - -drm_framebuffer_cleanup (fb); - -for (i =0 ; i < n; i++) { -struct plane *plane = &omap_fb->planes[i]; - -drm_gem_object_unreference_unlocked (plane->bo); - } - -kfree (omap_fb); -} -static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { - .create_handle = omap_framebuffer_create_handle, - .destroy = omap_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; static u32 get_linear_addr(struct plane *plane,
@@ -114,10 +87,7 @@ static u32 get_linear_addr(struct plane *plane,bool omap_framebuffer_supports_rotation (struct drm_framebuffer *fb) { -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -struct plane *plane = &omap_fb->planes[0 ]; - -return omap_gem_flags (plane->bo) &OMAP_BO_TILED ; +return omap_gem_flags (fb->obj[0 ]) &OMAP_BO_TILED ; }/* Note: DRM rotates counter-clockwise, TILER & DSS rotates clockwise */
@@ -176,7 +146,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, x = state->src_x >>16 ; y = state->src_y >>16 ; -if (omap_gem_flags (plane->bo) &OMAP_BO_TILED ) { +if (omap_gem_flags (fb->obj[0 ]) &OMAP_BO_TILED ) {u32 w = state->src_w >>16 ;u32 h = state->src_h >>16 ;
@@ -201,12 +171,12 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, x += w -1 ;/* Note: x and y are in TILER units, not pixels */ -omap_gem_rotated_dma_addr (plane->bo, orient, x, y, +omap_gem_rotated_dma_addr (fb->obj[0 ], orient, x, y, &info->paddr); info->rotation_type =OMAP_DSS_ROT_TILER ; info->rotation = state->rotation ?:DRM_MODE_ROTATE_0 ;/* Note: stride in TILER units, not pixels */ - info->screen_width =omap_gem_tiled_stride (plane->bo, orient); + info->screen_width =omap_gem_tiled_stride (fb->obj[0 ], orient); }else {switch (state->rotation &DRM_MODE_ROTATE_MASK ) {case 0 :
@@ -234,8 +204,8 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, plane = &omap_fb->planes[1 ];if (info->rotation_type ==OMAP_DSS_ROT_TILER ) { -WARN_ON (!(omap_gem_flags (plane->bo) &OMAP_BO_TILED )); -omap_gem_rotated_dma_addr (plane->bo, orient, x/2 , y/2 , +WARN_ON (!(omap_gem_flags (fb->obj[1 ]) &OMAP_BO_TILED )); +omap_gem_rotated_dma_addr (fb->obj[1 ], orient, x/2 , y/2 , &info->p_uv_addr); }else { info->p_uv_addr =get_linear_addr (plane, format,1 , x, y);
@@ -261,10 +231,10 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb)for (i =0 ; i < n; i++) {struct plane *plane = &omap_fb->planes[i]; - ret =omap_gem_pin (plane->bo, &plane->dma_addr); + ret =omap_gem_pin (fb->obj[i], &plane->dma_addr);if (ret) goto fail; -omap_gem_dma_sync_buffer (plane->bo,DMA_TO_DEVICE ); +omap_gem_dma_sync_buffer (fb->obj[i],DMA_TO_DEVICE ); } omap_fb->pin_count++;
@@ -276,7 +246,7 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb) fail:for (i--; i >=0 ; i--) {struct plane *plane = &omap_fb->planes[i]; -omap_gem_unpin (plane->bo); +omap_gem_unpin (fb->obj[i]); plane->dma_addr =0 ; }
@@ -302,7 +272,7 @@ void omap_framebuffer_unpin(struct drm_framebuffer *fb)for (i =0 ; i < n; i++) {struct plane *plane = &omap_fb->planes[i]; -omap_gem_unpin (plane->bo); +omap_gem_unpin (fb->obj[i]); plane->dma_addr =0 ; }
@@ -349,7 +319,7 @@ void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)struct plane *plane = &omap_fb->planes[i];seq_printf (m," %d: offset=%d pitch=%d, obj: " , i, plane->offset, plane->pitch); - omap_gem_describe(plane->bo, m); + omap_gem_describe(fb->obj[i], m); } }#endif
@@ -454,7 +424,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, goto fail; } - plane->bo = bos[i]; + fb->obj[i] = bos[i]; plane->offset = mode_cmd->offsets[i]; plane->pitch = pitch; plane->dma_addr =0 ;
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 06/24] drm/omap: Move GEM BO to drm_framebuffer
Hi,
Quoted 8 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Tomi Valkeinen <[email protected]>---
-- Sebastian
Quoted 165 lines
drivers/gpu/drm/omapdrm/omap_fb.c | 60 ++++++++++----------------------------- 1 file changed, 15 insertions(+), 45 deletions(-)drivers/gpu/drm/omapdrm/omap_fb.c +15
-45@@ -19,6 +19,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "omap_dmm_tiler.h" #include "omap_drv.h" @@ -51,7 +52,6 @@ static const u32 formats[] = {/* per-plane info for the fb: */ struct plane { -struct drm_gem_object *bo;u32 pitch;u32 offset;dma_addr_t dma_addr;@@ -68,36 +68,9 @@ struct omap_framebuffer {struct mutex lock; }; -static int omap_framebuffer_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -return drm_gem_handle_create (file_priv, - omap_fb->planes[0 ].bo, handle); -} - -static void omap_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -int i, n = fb->format->num_planes; - -DBG ("destroy: FB ID: %d (%p)" , fb->base.id, fb); - -drm_framebuffer_cleanup (fb); - -for (i =0 ; i < n; i++) { -struct plane *plane = &omap_fb->planes[i]; - -drm_gem_object_unreference_unlocked (plane->bo); - } - -kfree (omap_fb); -} -static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { - .create_handle = omap_framebuffer_create_handle, - .destroy = omap_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; static u32 get_linear_addr(struct plane *plane,@@ -114,10 +87,7 @@ static u32 get_linear_addr(struct plane *plane,bool omap_framebuffer_supports_rotation (struct drm_framebuffer *fb) { -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); -struct plane *plane = &omap_fb->planes[0 ]; - -return omap_gem_flags (plane->bo) &OMAP_BO_TILED ; +return omap_gem_flags (fb->obj[0 ]) &OMAP_BO_TILED ; }/* Note: DRM rotates counter-clockwise, TILER & DSS rotates clockwise */ @@ -176,7 +146,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, x = state->src_x >>16 ; y = state->src_y >>16 ; -if (omap_gem_flags (plane->bo) &OMAP_BO_TILED ) { +if (omap_gem_flags (fb->obj[0 ]) &OMAP_BO_TILED ) {u32 w = state->src_w >>16 ;u32 h = state->src_h >>16 ;@@ -201,12 +171,12 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, x += w -1 ;/* Note: x and y are in TILER units, not pixels */ -omap_gem_rotated_dma_addr (plane->bo, orient, x, y, +omap_gem_rotated_dma_addr (fb->obj[0 ], orient, x, y, &info->paddr); info->rotation_type =OMAP_DSS_ROT_TILER ; info->rotation = state->rotation ?:DRM_MODE_ROTATE_0 ;/* Note: stride in TILER units, not pixels */ - info->screen_width =omap_gem_tiled_stride (plane->bo, orient); + info->screen_width =omap_gem_tiled_stride (fb->obj[0 ], orient); }else {switch (state->rotation &DRM_MODE_ROTATE_MASK ) {case 0 :@@ -234,8 +204,8 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, plane = &omap_fb->planes[1 ];if (info->rotation_type ==OMAP_DSS_ROT_TILER ) { -WARN_ON (!(omap_gem_flags (plane->bo) &OMAP_BO_TILED )); -omap_gem_rotated_dma_addr (plane->bo, orient, x/2 , y/2 , +WARN_ON (!(omap_gem_flags (fb->obj[1 ]) &OMAP_BO_TILED )); +omap_gem_rotated_dma_addr (fb->obj[1 ], orient, x/2 , y/2 , &info->p_uv_addr); }else { info->p_uv_addr =get_linear_addr (plane, format,1 , x, y);@@ -261,10 +231,10 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb)for (i =0 ; i < n; i++) {struct plane *plane = &omap_fb->planes[i]; - ret =omap_gem_pin (plane->bo, &plane->dma_addr); + ret =omap_gem_pin (fb->obj[i], &plane->dma_addr);if (ret) goto fail; -omap_gem_dma_sync_buffer (plane->bo,DMA_TO_DEVICE ); +omap_gem_dma_sync_buffer (fb->obj[i],DMA_TO_DEVICE ); } omap_fb->pin_count++;@@ -276,7 +246,7 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb) fail:for (i--; i >=0 ; i--) {struct plane *plane = &omap_fb->planes[i]; -omap_gem_unpin (plane->bo); +omap_gem_unpin (fb->obj[i]); plane->dma_addr =0 ; }@@ -302,7 +272,7 @@ void omap_framebuffer_unpin(struct drm_framebuffer *fb)for (i =0 ; i < n; i++) {struct plane *plane = &omap_fb->planes[i]; -omap_gem_unpin (plane->bo); +omap_gem_unpin (fb->obj[i]); plane->dma_addr =0 ; }@@ -349,7 +319,7 @@ void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)struct plane *plane = &omap_fb->planes[i];seq_printf (m," %d: offset=%d pitch=%d, obj: " , i, plane->offset, plane->pitch); - omap_gem_describe(plane->bo, m); + omap_gem_describe(fb->obj[i], m); } }#endif @@ -454,7 +424,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, goto fail; } - plane->bo = bos[i]; + fb->obj[i] = bos[i]; plane->offset = mode_cmd->offsets[i]; plane->pitch = pitch; plane->dma_addr =0 ;Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 06/24] drm/omap: Move GEM BO to drm_framebuffer
In reply to Daniel StoneQuoted 10 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Tomi Valkeinen <[email protected]>--- drivers/gpu/drm/omapdrm/omap_fb.c | 60 ++++++++++----------------------------- 1 file changed, 15 insertions(+), 45 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/24 drm/omap: Move buffer pitch/offset to drm_framebuffer
In reply to Daniel Stonedrm_framebuffer already holds per-plane pitch and offsets, which is filled out for us when we create the framebuffer. Nuke our local copy in the plane struct.
--- drivers/gpu/drm/omapdrm/omap_fb.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/gpu/drm/omapdrm/omap_fb.c +9 -13
@@ -52,8 +52,6 @@ static const u32 formats[] = {/* per-plane info for the fb: */ struct plane { -u32 pitch; -u32 offset;dma_addr_t dma_addr; };
@@ -73,14 +71,16 @@ static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { .destroy = drm_gem_fb_destroy, }; -static u32 get_linear_addr (struct plane *plane, +static u32 get_linear_addr (struct drm_framebuffer *fb,const struct drm_format_info *format,int n,int x,int y) { +struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); +struct plane *plane = &omap_fb->planes[n];u32 offset; - offset = plane->offset + offset = fb->offsets[n] + (x * format->cpp[n] / (n ==0 ?1 : format->hsub)) - + (y * plane->pitch / (n ==0 ?1 : format->vsub)); + + (y * fb->pitches[n] / (n ==0 ?1 : format->vsub));return plane->dma_addr + offset; }
@@ -191,10 +191,10 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,break ; } - info->paddr =get_linear_addr (plane, format,0 , x, y); + info->paddr =get_linear_addr (fb, format,0 , x, y); info->rotation_type =OMAP_DSS_ROT_NONE ; info->rotation =DRM_MODE_ROTATE_0 ; - info->screen_width = plane->pitch; + info->screen_width = fb->pitches[0 ]; }/* convert to pixels: */
@@ -208,7 +208,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,omap_gem_rotated_dma_addr (fb->obj[1 ], orient, x/2 , y/2 , &info->p_uv_addr); }else { - info->p_uv_addr =get_linear_addr (plane, format,1 , x, y); + info->p_uv_addr =get_linear_addr (fb, format,1 , x, y); } }else { info->p_uv_addr =0 ;
@@ -309,16 +309,14 @@ struct drm_connector *omap_framebuffer_get_next_connector(#ifdef CONFIG_DEBUG_FS void omap_framebuffer_describe (struct drm_framebuffer *fb,struct seq_file *m) { -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb);int i, n = fb->format->num_planes;seq_printf (m,"fb: %dx%d@%4.4s\n" , fb->width, fb->height, (char *)&fb->format->format);for (i =0 ; i < n; i++) { -struct plane *plane = &omap_fb->planes[i];seq_printf (m," %d: offset=%d pitch=%d, obj: " , - i, plane->offset, plane->pitch); + i, fb->offsets[n], fb->pitches[i]);omap_gem_describe (fb->obj[i], m); } }
@@ -425,8 +423,6 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, } fb->obj[i] = bos[i]; - plane->offset = mode_cmd->offsets[i]; - plane->pitch = pitch; plane->dma_addr =0 ; }
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/24] drm/omap: Move buffer pitch/offset to drm_framebuffer
Hi,
Quoted 6 lines · Daniel Stone
drm_framebufferalready holds per-plane pitch and offsets, which is filled out for us when we create the framebuffer. Nuke our local copy in the plane struct.Signed-off-by Daniel Stone <[email protected]>Cc Tomi Valkeinen <[email protected]>
-- Sebastian
Quoted 93 lines
--- drivers/gpu/drm/omapdrm/omap_fb.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)drivers/gpu/drm/omapdrm/omap_fb.c +9
-13@@ -52,8 +52,6 @@ static const u32 formats[] = {/* per-plane info for the fb: */ struct plane { -u32 pitch; -u32 offset;dma_addr_t dma_addr; };@@ -73,14 +71,16 @@ static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { .destroy = drm_gem_fb_destroy, }; -static u32 get_linear_addr (struct plane *plane, +static u32 get_linear_addr (struct drm_framebuffer *fb,const struct drm_format_info *format,int n,int x,int y) { +struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb); +struct plane *plane = &omap_fb->planes[n];u32 offset; - offset = plane->offset + offset = fb->offsets[n] + (x * format->cpp[n] / (n ==0 ?1 : format->hsub)) - + (y * plane->pitch / (n ==0 ?1 : format->vsub)); + + (y * fb->pitches[n] / (n ==0 ?1 : format->vsub));return plane->dma_addr + offset; }@@ -191,10 +191,10 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,break ; } - info->paddr =get_linear_addr (plane, format,0 , x, y); + info->paddr =get_linear_addr (fb, format,0 , x, y); info->rotation_type =OMAP_DSS_ROT_NONE ; info->rotation =DRM_MODE_ROTATE_0 ; - info->screen_width = plane->pitch; + info->screen_width = fb->pitches[0 ]; }/* convert to pixels: */ @@ -208,7 +208,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,omap_gem_rotated_dma_addr (fb->obj[1 ], orient, x/2 , y/2 , &info->p_uv_addr); }else { - info->p_uv_addr =get_linear_addr (plane, format,1 , x, y); + info->p_uv_addr =get_linear_addr (fb, format,1 , x, y); } }else { info->p_uv_addr =0 ;@@ -309,16 +309,14 @@ struct drm_connector *omap_framebuffer_get_next_connector(#ifdef CONFIG_DEBUG_FS void omap_framebuffer_describe (struct drm_framebuffer *fb,struct seq_file *m) { -struct omap_framebuffer *omap_fb =to_omap_framebuffer (fb);int i, n = fb->format->num_planes;seq_printf (m,"fb: %dx%d@%4.4s\n" , fb->width, fb->height, (char *)&fb->format->format);for (i =0 ; i < n; i++) { -struct plane *plane = &omap_fb->planes[i];seq_printf (m," %d: offset=%d pitch=%d, obj: " , - i, plane->offset, plane->pitch); + i, fb->offsets[n], fb->pitches[i]);omap_gem_describe (fb->obj[i], m); } }@@ -425,8 +423,6 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, } fb->obj[i] = bos[i]; - plane->offset = mode_cmd->offsets[i]; - plane->pitch = pitch; plane->dma_addr =0 ; }Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/24] drm/omap: Move buffer pitch/offset to drm_framebuffer
Quoted 9 lines · Sebastian Reichel
Quoted 6 lines · Daniel Stone
drm_framebufferalready holds per-plane pitch and offsets, which is filled out for us when we create the framebuffer. Nuke our local copy in the plane struct.Signed-off-by Daniel Stone <[email protected]>Cc Tomi Valkeinen <[email protected]>Reviewed-by Sebastian Reichel <[email protected]>
Thanks Sebastian! Tomi, are you planning to take this through drm-tip if you're happy with it?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/24] drm/omap: Move buffer pitch/offset to drm_framebuffer
In reply to Daniel StoneQuoted 9 lines · Daniel Stone
drm_framebufferalready holds per-plane pitch and offsets, which is filled out for us when we create the framebuffer. Nuke our local copy in the plane struct.Signed-off-by Daniel Stone <[email protected]>Cc Tomi Valkeinen <[email protected]>--- drivers/gpu/drm/omapdrm/omap_fb.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/24 drm/mtk: Promote impossible internal error to WARN_ON
In reply to Daniel StoneA FB with no object is something we should be shouting very loudly about, not quietly logging as debug.
--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -4
@@ -95,10 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ; -if (!mtk_fb_get_gem_obj (fb)) { -DRM_DEBUG_KMS ("buffer is null\n" ); -return -EFAULT ; - } +WARN_ON (!mtk_fb_get_gem_obj (fb));if (!state->crtc)return 0 ;
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/24] drm/mtk: Promote impossible internal error to WARN_ON
Quoted 15 lines · Daniel Stone
A FB with no object is something we should be shouting very loudly about, not quietly logging as debug.
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0
drivers/gpu/drm/mediatek/mtk_drm_plane.c static int mtk_plane_atomic_check(struct drm_plane *plane, · line 98
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-4@@ -95,10 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ; -if (!mtk_fb_get_gem_obj (fb)) { -DRM_DEBUG_KMS ("buffer is null\n" ); -return -EFAULT ; - } +WARN_ON (!mtk_fb_get_gem_obj (fb));
We should presumably still bail out with an error, no?
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0if (!state->crtc)return 0 ;Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/24] drm/mtk: Promote impossible internal error to WARN_ON
Quoted 19 lines · Sean Paul
Quoted 18 lines · Daniel Stone
A FB with no object is something we should be shouting very loudly about, not quietly logging as debug.
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0@@ -95,10 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ;
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c static int mtk_plane_atomic_check(struct drm_plane *plane, · line 98
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-4-if (!mtk_fb_get_gem_obj (fb)) { -DRM_DEBUG_KMS ("buffer is null\n" ); -return -EFAULT ; - } +WARN_ON (!mtk_fb_get_gem_obj (fb));We should presumably still bail out with an error, no?
I think we should just remove this WARN_ON(). Under what circumstances would this case even happen? If the GEM object for a framebuffer doesn't exist, then mtk_drm_mode_fb_create() will fail and no pointer to struct drm_framebuffer will ever be returned. After that, the GEM object is guaranteed to be there, so the above is effectively dead code.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/24] drm/mtk: Promote impossible internal error to WARN_ON
Quoted 28 lines · Thierry Reding
Quoted 19 lines · Sean Paul
Quoted 18 lines · Daniel Stone
A FB with no object is something we should be shouting very loudly about, not quietly logging as debug.
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_plane.c +0
-0@@ -95,10 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ;Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c static int mtk_plane_atomic_check(struct drm_plane *plane, · line 98
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-4-if (!mtk_fb_get_gem_obj (fb)) { -DRM_DEBUG_KMS ("buffer is null\n" ); -return -EFAULT ; - } +WARN_ON (!mtk_fb_get_gem_obj (fb));We should presumably still bail out with an error, no?
Quoted 7 lines
I think we should just remove this
WARN_ON(). Under what circumstances would this case even happen? If the GEM object for a framebuffer doesn't exist, thenmtk_drm_mode_fb_create()will fail and no pointer to structdrm_framebufferwill ever be returned. After that, the GEM object is guaranteed to be there, so the above is effectively dead code.Thierry
I agree with Thierry. The case should not happen. So just remove this checking.
Regards,
CK
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20180330141138.28987-1-daniels-ZGY8ohtN/[email protected]
PATCH 23/24 drm/radeon: radeon_framebuffer -> drm_framebuffer
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.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 32 ++++++++--------------------- drivers/gpu/drm/radeon/radeon_device.c | 6 +++--- drivers/gpu/drm/radeon/radeon_display.c | 30 ++++++++++++--------------- drivers/gpu/drm/radeon/radeon_fb.c | 20 +++++++++--------- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 11 +++------- drivers/gpu/drm/radeon/radeon_mode.h | 7 +------ 6 files changed, 39 insertions(+), 67 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +9 -23
@@ -1145,7 +1145,6 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private; -struct radeon_framebuffer *radeon_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct radeon_bo *rbo;
@@ -1164,19 +1163,15 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - radeon_fb =to_radeon_framebuffer (fb); +if (atomic) target_fb = fb; - } -else { - radeon_fb =to_radeon_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = radeon_fb->base.obj[0 ]; + obj = target_fb->obj[0 ]; rbo =gem_to_radeon_bo (obj); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -1441,8 +1436,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset,0 );if (!atomic && fb && fb != crtc->primary->fb) { - radeon_fb =to_radeon_framebuffer (fb); - rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); + rbo =gem_to_radeon_bo (fb->obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r;
@@ -1463,7 +1457,6 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private; -struct radeon_framebuffer *radeon_fb;struct drm_gem_object *obj;struct radeon_bo *rbo;struct drm_framebuffer *target_fb;
@@ -1481,16 +1474,12 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - radeon_fb =to_radeon_framebuffer (fb); +if (atomic) target_fb = fb; - } -else { - radeon_fb =to_radeon_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - } - obj = radeon_fb->base.obj[0 ]; + obj = target_fb->obj[0 ]; rbo =gem_to_radeon_bo (obj); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -1641,8 +1630,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset,3 );if (!atomic && fb && fb != crtc->primary->fb) { - radeon_fb =to_radeon_framebuffer (fb); - rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); + rbo =gem_to_radeon_bo (fb->obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r;
@@ -2149,11 +2137,9 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)atombios_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct radeon_framebuffer *radeon_fb;struct radeon_bo *rbo; - radeon_fb =to_radeon_framebuffer (crtc->primary->fb); - rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); + rbo =gem_to_radeon_bo (crtc->primary->fb->obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r))DRM_ERROR ("failed to reserve rbo before unpin\n" );
drivers/gpu/drm/radeon/radeon_device.c +3 -3
@@ -1587,7 +1587,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc); -struct radeon_framebuffer *rfb =to_radeon_framebuffer (crtc->primary->fb); +struct drm_framebuffer *fb = crtc->primary->fb;struct radeon_bo *robj;if (radeon_crtc->cursor_bo) {
@@ -1599,10 +1599,10 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, } } -if (rfb ==NULL || rfb->base.obj[0 ] ==NULL ) { +if (fb ==NULL || fb->obj[0 ] ==NULL ) {continue ; } - robj =gem_to_radeon_bo (rfb->base.obj[0 ]); + robj =gem_to_radeon_bo (fb->obj[0 ]);/* don't unpin kernel fb objects */ if (!radeon_fbdev_robj_is_fb (rdev, robj)) { r =radeon_bo_reserve (robj, false);
drivers/gpu/drm/radeon/radeon_display.c +13 -17
@@ -479,8 +479,6 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc); -struct radeon_framebuffer *old_radeon_fb; -struct radeon_framebuffer *new_radeon_fb;struct drm_gem_object *obj;struct radeon_flip_work *work;struct radeon_bo *new_rbo;
@@ -502,15 +500,13 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, work->async = (page_flip_flags &DRM_MODE_PAGE_FLIP_ASYNC ) !=0 ;/* schedule unpin of the old buffer */ - old_radeon_fb =to_radeon_framebuffer (crtc->primary->fb); - obj = old_radeon_fb->base.obj[0 ]; + obj = crtc->primary->fb->obj[0 ];/* take a reference to the old object */ drm_gem_object_get (obj); work->old_rbo =gem_to_radeon_bo (obj); - new_radeon_fb =to_radeon_framebuffer (fb); - obj = new_radeon_fb->base.obj[0 ]; + obj = fb->obj[0 ]; new_rbo =gem_to_radeon_bo (obj);/* pin the new buffer */
@@ -1293,16 +1289,16 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = {int radeon_framebuffer_init (struct drm_device *dev, -struct radeon_framebuffer *rfb, +struct drm_framebuffer *fb,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object *obj) {int ret; - rfb->base.obj[0 ] = obj; -drm_helper_mode_fill_fb_struct (dev, &rfb->base, mode_cmd); - ret =drm_framebuffer_init (dev, &rfb->base, &radeon_fb_funcs); + fb->obj[0 ] = obj; +drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd); + ret =drm_framebuffer_init (dev, fb, &radeon_fb_funcs);if (ret) { - rfb->base.obj[0 ] =NULL ; + fb->obj[0 ] =NULL ;return ret; }return 0 ;
@@ -1314,7 +1310,7 @@ radeon_user_framebuffer_create(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmd) {struct drm_gem_object *obj; -struct radeon_framebuffer *radeon_fb; +struct drm_framebuffer *fb;int ret; obj =drm_gem_object_lookup (file_priv, mode_cmd->handles[0 ]);
@@ -1330,20 +1326,20 @@ radeon_user_framebuffer_create(struct drm_device *dev,return ERR_PTR (-EINVAL ); } - radeon_fb =kzalloc (sizeof (*radeon_fb),GFP_KERNEL ); -if (radeon_fb ==NULL ) { + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (fb ==NULL ) {drm_gem_object_put_unlocked (obj);return ERR_PTR (-ENOMEM ); } - ret =radeon_framebuffer_init (dev, radeon_fb, mode_cmd, obj); + ret =radeon_framebuffer_init (dev, fb, mode_cmd, obj);if (ret) { -kfree (radeon_fb); +kfree (fb);drm_gem_object_put_unlocked (obj);return ERR_PTR (ret); } -return &radeon_fb->base; +return fb; }static const struct drm_mode_config_funcs radeon_mode_funcs = {
drivers/gpu/drm/radeon/radeon_fb.c +10 -10
@@ -43,7 +43,7 @@*/ struct radeon_fbdev {struct drm_fb_helper helper; -struct radeon_framebuffer rfb; +struct drm_framebuffer fb;struct radeon_device *rdev; };
@@ -246,13 +246,13 @@ static int radeonfb_create(struct drm_fb_helper *helper, info->par = rfbdev; - ret =radeon_framebuffer_init (rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); + ret =radeon_framebuffer_init (rdev->ddev, &rfbdev->fb, &mode_cmd, gobj);if (ret) {DRM_ERROR ("failed to initialize framebuffer %d\n" , ret); goto out; } - fb = &rfbdev->rfb.base; + fb = &rfbdev->fb;/* setup helper */ rfbdev->helper.fb = fb;
@@ -308,15 +308,15 @@ static int radeonfb_create(struct drm_fb_helper *helper,static int radeon_fbdev_destroy (struct drm_device *dev,struct radeon_fbdev *rfbdev) { -struct radeon_framebuffer *rfb = &rfbdev->rfb; +struct drm_framebuffer *fb = &rfbdev->fb;drm_fb_helper_unregister_fbi (&rfbdev->helper); -if (rfb->base.obj[0 ]) { -radeonfb_destroy_pinned_object (rfb->base.obj[0 ]); - rfb->base.obj[0 ] =NULL ; -drm_framebuffer_unregister_private (&rfb->base); -drm_framebuffer_cleanup (&rfb->base); +if (fb->obj[0 ]) { +radeonfb_destroy_pinned_object (fb->obj[0 ]); + fb->obj[0 ] =NULL ; +drm_framebuffer_unregister_private (fb); +drm_framebuffer_cleanup (fb); }drm_fb_helper_fini (&rfbdev->helper);
@@ -400,7 +400,7 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)if (!rdev->mode_info.rfbdev)return false; -if (robj ==gem_to_radeon_bo (rdev->mode_info.rfbdev->rfb.base.obj[0 ])) +if (robj ==gem_to_radeon_bo (rdev->mode_info.rfbdev->fb.obj[0 ]))return true;return false; }
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +3 -8
@@ -374,7 +374,6 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc); -struct radeon_framebuffer *radeon_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct radeon_bo *rbo;
@@ -393,14 +392,10 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - radeon_fb =to_radeon_framebuffer (fb); +if (atomic) target_fb = fb; - } -else { - radeon_fb =to_radeon_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }switch (target_fb->format->cpp[0 ] *8 ) {case 8 :
@@ -423,7 +418,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, }/* Pin framebuffer & get tilling informations */ - obj = radeon_fb->base.obj[0 ]; + obj = target_fb->obj[0 ]; rbo =gem_to_radeon_bo (obj); retry: r =radeon_bo_reserve (rbo, false);
drivers/gpu/drm/radeon/radeon_mode.h +1 -6
@@ -46,7 +46,6 @@ struct radeon_device;#define to_radeon_crtc (x) container_of(x, struct radeon_crtc, base)#define to_radeon_connector (x) container_of(x, struct radeon_connector, base)#define to_radeon_encoder (x) container_of(x, struct radeon_encoder, base) -#define to_radeon_framebuffer (x) container_of(x, struct radeon_framebuffer, base)#define RADEON_MAX_HPD_PINS 7#define RADEON_MAX_CRTCS 6
@@ -574,10 +573,6 @@ struct radeon_connector {int enabled_attribs; }; -struct radeon_framebuffer { -struct drm_framebuffer base; -}; -#define ENCODER_MODE_IS_DP (em) (((em) == ATOM_ENCODER_MODE_DP) || \ ((em) == ATOM_ENCODER_MODE_DP_MST))
@@ -931,7 +926,7 @@ radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);extern void radeon_combios_encoder_dpms_scratch_regs (struct drm_encoder *encoder,bool on);int radeon_framebuffer_init (struct drm_device *dev, -struct radeon_framebuffer *rfb, +struct drm_framebuffer *rfb,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object *obj);
Signature · 6 lines
2.16.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 23/24] drm/radeon: radeon_framebuffer -> drm_framebuffer
Quoted 10 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc David (ChunMing) Zhou <[email protected]>
Quoted 8 lines
--- drivers/gpu/drm/radeon/atombios_crtc.c | 32 ++++++++--------------------- drivers/gpu/drm/radeon/radeon_device.c | 6 +++--- drivers/gpu/drm/radeon/radeon_display.c | 30 ++++++++++++--------------- drivers/gpu/drm/radeon/radeon_fb.c | 20 +++++++++--------- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 11 +++------- drivers/gpu/drm/radeon/radeon_mode.h | 7 +------ 6 files changed, 39 insertions(+), 67 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/24 drm/mtk: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 38 +++++--------------------------- drivers/gpu/drm/mediatek/mtk_drm_fb.h | 1 - drivers/gpu/drm/mediatek/mtk_drm_plane.c | 4 ++-- 3 files changed, 7 insertions(+), 36 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_fb.c +5 -33
@@ -15,6 +15,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <linux/dma-buf.h> #include <linux/reservation.h>
@@ -30,42 +31,13 @@*/ struct mtk_drm_fb {struct drm_framebuffer base; -/* For now we only support a single plane */ -struct drm_gem_object *gem_obj; };#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return mtk_fb->gem_obj; -} - -static int mtk_drm_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return drm_gem_handle_create (file_priv, mtk_fb->gem_obj, handle); -} - -static void mtk_drm_fb_destroy (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -drm_framebuffer_cleanup (fb); - -drm_gem_object_put_unlocked (mtk_fb->gem_obj); - -kfree (mtk_fb); -} -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { - .create_handle = mtk_drm_fb_create_handle, - .destroy = mtk_drm_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
@@ -84,7 +56,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); - mtk_fb->gem_obj = obj; + mtk_fb->base.obj[0 ] = obj; ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs);if (ret) {
@@ -110,7 +82,7 @@ int mtk_fb_wait(struct drm_framebuffer *fb)if (!fb)return 0 ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ];if (!gem || !gem->dma_buf || !gem->dma_buf->resv)return 0 ;
drivers/gpu/drm/mediatek/mtk_drm_fb.h +0 -1
@@ -14,7 +14,6 @@#ifndef MTK_DRM_FB_H #define MTK_DRM_FB_H -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb);int mtk_fb_wait (struct drm_framebuffer *fb); struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, struct drm_file *file,
drivers/gpu/drm/mediatek/mtk_drm_plane.c +2 -2
@@ -95,7 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ; -WARN_ON (!mtk_fb_get_gem_obj (fb)); +WARN_ON (!fb->obj[0 ]);if (!state->crtc)return 0 ;
@@ -124,7 +124,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ]; mtk_gem =to_mtk_gem_obj (gem); addr = mtk_gem->dma_addr; pitch = fb->pitches[0 ];
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/24] drm/mtk: Move GEM BO to drm_framebuffer
Quoted 6 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>
Quoted 124 lines
Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 38 +++++--------------------------- drivers/gpu/drm/mediatek/mtk_drm_fb.h | 1 - drivers/gpu/drm/mediatek/mtk_drm_plane.c | 4 ++-- 3 files changed, 7 insertions(+), 36 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_fb.c +5
-33@@ -15,6 +15,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <linux/dma-buf.h> #include <linux/reservation.h> @@ -30,42 +31,13 @@*/ struct mtk_drm_fb {struct drm_framebuffer base; -/* For now we only support a single plane */ -struct drm_gem_object *gem_obj; };#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return mtk_fb->gem_obj; -} - -static int mtk_drm_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return drm_gem_handle_create (file_priv, mtk_fb->gem_obj, handle); -} - -static void mtk_drm_fb_destroy (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -drm_framebuffer_cleanup (fb); - -drm_gem_object_put_unlocked (mtk_fb->gem_obj); - -kfree (mtk_fb); -} -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { - .create_handle = mtk_drm_fb_create_handle, - .destroy = mtk_drm_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,@@ -84,7 +56,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); - mtk_fb->gem_obj = obj; + mtk_fb->base.obj[0 ] = obj; ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs);if (ret) {@@ -110,7 +82,7 @@ int mtk_fb_wait(struct drm_framebuffer *fb)if (!fb)return 0 ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ];if (!gem || !gem->dma_buf || !gem->dma_buf->resv)return 0 ;drivers/gpu/drm/mediatek/mtk_drm_fb.h +0
-1@@ -14,7 +14,6 @@#ifndef MTK_DRM_FB_H #define MTK_DRM_FB_H -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb);int mtk_fb_wait (struct drm_framebuffer *fb); struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, struct drm_file *file,drivers/gpu/drm/mediatek/mtk_drm_plane.c +2
-2@@ -95,7 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ; -WARN_ON (!mtk_fb_get_gem_obj (fb)); +WARN_ON (!fb->obj[0 ]);if (!state->crtc)return 0 ;@@ -124,7 +124,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ]; mtk_gem =to_mtk_gem_obj (gem); addr = mtk_gem->dma_addr; pitch = fb->pitches[0 ];Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/24] drm/mtk: Move GEM BO to drm_framebuffer
In reply to Daniel StoneQuoted 5 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.
Quoted 8 lines
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 38 +++++--------------------------- drivers/gpu/drm/mediatek/mtk_drm_fb.h | 1 - drivers/gpu/drm/mediatek/mtk_drm_plane.c | 4 ++-- 3 files changed, 7 insertions(+), 36 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/24] drm/mtk: Move GEM BO to drm_framebuffer
In reply to Daniel StoneQuoted 5 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.
Quoted 110 lines
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 38 +++++--------------------------- drivers/gpu/drm/mediatek/mtk_drm_fb.h | 1 - drivers/gpu/drm/mediatek/mtk_drm_plane.c | 4 ++-- 3 files changed, 7 insertions(+), 36 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_fb.c +5
-33@@ -15,6 +15,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <linux/dma-buf.h> #include <linux/reservation.h> @@ -30,42 +31,13 @@*/ struct mtk_drm_fb {struct drm_framebuffer base; -/* For now we only support a single plane */ -struct drm_gem_object *gem_obj; };#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return mtk_fb->gem_obj; -} - -static int mtk_drm_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -return drm_gem_handle_create (file_priv, mtk_fb->gem_obj, handle); -} - -static void mtk_drm_fb_destroy (struct drm_framebuffer *fb) -{ -struct mtk_drm_fb *mtk_fb =to_mtk_fb (fb); - -drm_framebuffer_cleanup (fb); - -drm_gem_object_put_unlocked (mtk_fb->gem_obj); - -kfree (mtk_fb); -} -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { - .create_handle = mtk_drm_fb_create_handle, - .destroy = mtk_drm_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,@@ -84,7 +56,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); - mtk_fb->gem_obj = obj; + mtk_fb->base.obj[0 ] = obj; ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs);if (ret) {@@ -110,7 +82,7 @@ int mtk_fb_wait(struct drm_framebuffer *fb)if (!fb)return 0 ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ];if (!gem || !gem->dma_buf || !gem->dma_buf->resv)return 0 ;drivers/gpu/drm/mediatek/mtk_drm_fb.h +0
-1@@ -14,7 +14,6 @@#ifndef MTK_DRM_FB_H #define MTK_DRM_FB_H -struct drm_gem_object *mtk_fb_get_gem_obj (struct drm_framebuffer *fb);int mtk_fb_wait (struct drm_framebuffer *fb); struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, struct drm_file *file,drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1@@ -95,7 +95,7 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,if (!fb)return 0 ; -WARN_ON (!mtk_fb_get_gem_obj (fb)); +WARN_ON (!fb->obj[0 ]);if (!state->crtc)return 0 ;
drivers/gpu/drm/mediatek/mtk_drm_plane.c static void mtk_plane_atomic_update(struct drm_plane *plane, · line 130
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1
-1@@ -124,7 +124,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ; - gem =mtk_fb_get_gem_obj (fb); + gem = fb->obj[0 ]; mtk_gem =to_mtk_gem_obj (gem); addr = mtk_gem->dma_addr; pitch = fb->pitches[0 ];
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/24 drm/mtk: mtk_drm_fb -> drm_framebuffer
In reply to Daniel StoneNow that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can just delete it.
--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_fb.c +14 -26
@@ -23,49 +23,37 @@#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" -/* -* mtk specific framebuffer structure. -* -* @fb: drm framebuffer object. -* @gem_obj: array of gem objects. -*/ -struct mtk_drm_fb { -struct drm_framebuffer base; -}; - -#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { .create_handle = drm_gem_fb_create_handle, .destroy = drm_gem_fb_destroy, }; -static struct mtk_drm_fb *mtk_drm_framebuffer_init (struct drm_device *dev, +static struct drm_framebuffer *mtk_drm_framebuffer_init (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode,struct drm_gem_object *obj) { -struct mtk_drm_fb *mtk_fb; +struct drm_framebuffer *fb;int ret;if (drm_format_num_planes (mode->pixel_format) !=1 )return ERR_PTR (-EINVAL ); - mtk_fb =kzalloc (sizeof (*mtk_fb),GFP_KERNEL ); -if (!mtk_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); +drm_helper_mode_fill_fb_struct (dev, fb, mode); - mtk_fb->base.obj[0 ] = obj; + fb->obj[0 ] = obj; - ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &mtk_drm_fb_funcs);if (ret) {DRM_ERROR ("failed to initialize framebuffer\n" ); -kfree (mtk_fb); +kfree (fb);return ERR_PTR (ret); } -return mtk_fb; +return fb; }/*
@@ -100,7 +88,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd) { - struct mtk_drm_fb *mtk_fb; + struct drm_framebuffer *fb;struct drm_gem_object *gem;unsigned int width = cmd->width;unsigned int height = cmd->height;
@@ -123,13 +111,13 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, goto unreference; } - mtk_fb =mtk_drm_framebuffer_init (dev, cmd, gem); -if (IS_ERR (mtk_fb)) { - ret =PTR_ERR (mtk_fb); + fb =mtk_drm_framebuffer_init (dev, cmd, gem); +if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto unreference; } -return &mtk_fb->base; +return fb; unreference:drm_gem_object_put_unlocked (gem);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/24] drm/mtk: mtk_drm_fb -> drm_framebuffer
Hi CK, Philipp,
Quoted 2 lines · Daniel Stone
Now that
mtk_drm_fbis an empty wrapper arounddrm_framebuffer, we can just delete it.
Did you get a chance to look at these three patches for Mediatek?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/24] drm/mtk: mtk_drm_fb -> drm_framebuffer
In reply to Daniel StoneQuoted 6 lines · Daniel Stone
Now that
mtk_drm_fbis an empty wrapper arounddrm_framebuffer, we can just delete it.Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>
Quoted 101 lines
--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_fb.c +14
-26@@ -23,49 +23,37 @@#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" -/* -* mtk specific framebuffer structure. -* -* @fb: drm framebuffer object. -* @gem_obj: array of gem objects. -*/ -struct mtk_drm_fb { -struct drm_framebuffer base; -}; - -#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { .create_handle = drm_gem_fb_create_handle, .destroy = drm_gem_fb_destroy, }; -static struct mtk_drm_fb *mtk_drm_framebuffer_init (struct drm_device *dev, +static struct drm_framebuffer *mtk_drm_framebuffer_init (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode,struct drm_gem_object *obj) { -struct mtk_drm_fb *mtk_fb; +struct drm_framebuffer *fb;int ret;if (drm_format_num_planes (mode->pixel_format) !=1 )return ERR_PTR (-EINVAL ); - mtk_fb =kzalloc (sizeof (*mtk_fb),GFP_KERNEL ); -if (!mtk_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); +drm_helper_mode_fill_fb_struct (dev, fb, mode); - mtk_fb->base.obj[0 ] = obj; + fb->obj[0 ] = obj; - ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &mtk_drm_fb_funcs);if (ret) {DRM_ERROR ("failed to initialize framebuffer\n" ); -kfree (mtk_fb); +kfree (fb);return ERR_PTR (ret); } -return mtk_fb; +return fb; }/* @@ -100,7 +88,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd) { - struct mtk_drm_fb *mtk_fb; + struct drm_framebuffer *fb;struct drm_gem_object *gem;unsigned int width = cmd->width;unsigned int height = cmd->height;@@ -123,13 +111,13 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, goto unreference; } - mtk_fb =mtk_drm_framebuffer_init (dev, cmd, gem); -if (IS_ERR (mtk_fb)) { - ret =PTR_ERR (mtk_fb); + fb =mtk_drm_framebuffer_init (dev, cmd, gem); +if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto unreference; } -return &mtk_fb->base; +return fb; unreference:drm_gem_object_put_unlocked (gem);Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/24] drm/mtk: mtk_drm_fb -> drm_framebuffer
In reply to Daniel StoneQuoted 9 lines · Daniel Stone
Now that
mtk_drm_fbis an empty wrapper arounddrm_framebuffer, we can just delete it.Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/24] drm/mtk: mtk_drm_fb -> drm_framebuffer
In reply to Daniel StoneQuoted 3 lines · Daniel Stone
Now that
mtk_drm_fbis an empty wrapper arounddrm_framebuffer, we can just delete it.
Quoted 87 lines
Signed-off-by Daniel Stone <[email protected]>Cc CK Hu <[email protected]>Cc Philipp Zabel <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-)drivers/gpu/drm/mediatek/mtk_drm_fb.c +11
-25@@ -23,49 +23,37 @@#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" -/* -* mtk specific framebuffer structure. -* -* @fb: drm framebuffer object. -* @gem_obj: array of gem objects. -*/ -struct mtk_drm_fb { -struct drm_framebuffer base; -}; - -#define to_mtk_fb (x) container_of(x, struct mtk_drm_fb, base) -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { .create_handle = drm_gem_fb_create_handle, .destroy = drm_gem_fb_destroy, }; -static struct mtk_drm_fb *mtk_drm_framebuffer_init (struct drm_device *dev, +static struct drm_framebuffer *mtk_drm_framebuffer_init (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode,struct drm_gem_object *obj) { -struct mtk_drm_fb *mtk_fb; +struct drm_framebuffer *fb;int ret;if (drm_format_num_planes (mode->pixel_format) !=1 )return ERR_PTR (-EINVAL ); - mtk_fb =kzalloc (sizeof (*mtk_fb),GFP_KERNEL ); -if (!mtk_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (dev, &mtk_fb->base, mode); +drm_helper_mode_fill_fb_struct (dev, fb, mode); - mtk_fb->base.obj[0 ] = obj; + fb->obj[0 ] = obj; - ret =drm_framebuffer_init (dev, &mtk_fb->base, &mtk_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &mtk_drm_fb_funcs);if (ret) {DRM_ERROR ("failed to initialize framebuffer\n" ); -kfree (mtk_fb); +kfree (fb);return ERR_PTR (ret); } -return mtk_fb; +return fb; }/* @@ -100,7 +88,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd) { - struct mtk_drm_fb *mtk_fb; + struct drm_framebuffer *fb;struct drm_gem_object *gem;unsigned int width = cmd->width;unsigned int height = cmd->height;@@ -123,13 +111,13 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, goto unreference; } - mtk_fb =mtk_drm_framebuffer_init (dev, cmd, gem); -if (IS_ERR (mtk_fb)) { - ret =PTR_ERR (mtk_fb); + fb =mtk_drm_framebuffer_init (dev, cmd, gem);
drivers/gpu/drm/mediatek/mtk_drm_fb.c struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, · line 123
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_fb.c +3
-1+if (IS_ERR (fb)) { + ret =PTR_ERR (fb); goto unreference; } -return &mtk_fb->base; +return fb; unreference:drm_gem_object_put_unlocked (gem);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 11/24 drm/tegra: Remove duplicate framebuffer num_planes
In reply to Daniel Stonedrm_framebuffer already stores num_planes for us.
--- drivers/gpu/drm/tegra/drm.h | 1 - drivers/gpu/drm/tegra/fb.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/tegra/drm.h +0 -1
@@ -32,7 +32,6 @@ struct reset_control;struct tegra_fb {struct drm_framebuffer base;struct tegra_bo **planes; -unsigned int num_planes; };#ifdef CONFIG_DRM_FBDEV_EMULATION
drivers/gpu/drm/tegra/fb.c +2 -4
@@ -107,7 +107,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)struct tegra_fb *fb =to_tegra_fb (framebuffer);unsigned int i; -for (i =0 ; i < fb->num_planes; i++) { +for (i =0 ; i < framebuffer->format->num_planes; i++) {struct tegra_bo *bo = fb->planes[i];if (bo) {
@@ -155,11 +155,9 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,return ERR_PTR (-ENOMEM ); } - fb->num_planes = num_planes; -drm_helper_mode_fill_fb_struct (drm, &fb->base, mode_cmd); -for (i =0 ; i < fb->num_planes; i++) +for (i =0 ; i < fb->base.format->num_planes; i++) fb->planes[i] = planes[i]; err =drm_framebuffer_init (drm, &fb->base, &tegra_fb_funcs);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 12/24 drm/tegra: Move GEM BOs to drm_framebuffer
In reply to Daniel StoneSince drm_framebuffer can now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffer create_handle function the same as the GEM framebuffer helper, we can reuse that.
--- drivers/gpu/drm/tegra/drm.h | 1 - drivers/gpu/drm/tegra/fb.c | 37 ++++++++----------------------------- 2 files changed, 8 insertions(+), 30 deletions(-)
drivers/gpu/drm/tegra/drm.h +0 -1
@@ -31,7 +31,6 @@ struct reset_control;struct tegra_fb {struct drm_framebuffer base; -struct tegra_bo **planes; };#ifdef CONFIG_DRM_FBDEV_EMULATION
drivers/gpu/drm/tegra/fb.c +8 -29
@@ -14,6 +14,7 @@#include "drm.h" #include "gem.h" +#include <drm/drm_gem_framebuffer_helper.h> static inline struct tegra_fb *to_tegra_fb (struct drm_framebuffer *fb) {
@@ -30,19 +31,14 @@ static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper)struct tegra_bo *tegra_fb_get_plane (struct drm_framebuffer *framebuffer,unsigned int index) { -struct tegra_fb *fb =to_tegra_fb (framebuffer); - -if (index >= framebuffer->format->num_planes) -return NULL ; - -return fb->planes[index]; +return to_tegra_bo (drm_gem_fb_get_obj (framebuffer, index)); }bool tegra_fb_is_bottom_up (struct drm_framebuffer *framebuffer) { -struct tegra_fb *fb =to_tegra_fb (framebuffer); +struct tegra_bo *bo =tegra_fb_get_plane (framebuffer,0 ); -if (fb->planes[0 ]->flags &TEGRA_BO_BOTTOM_UP ) +if (bo->flags &TEGRA_BO_BOTTOM_UP )return true;return false;
@@ -51,8 +47,7 @@ bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer)int tegra_fb_get_tiling (struct drm_framebuffer *framebuffer,struct tegra_bo_tiling *tiling) { -struct tegra_fb *fb =to_tegra_fb (framebuffer); -uint64_t modifier = fb->base.modifier; +uint64_t modifier = framebuffer->modifier;switch (modifier) {case DRM_FORMAT_MOD_LINEAR :
@@ -108,7 +103,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)unsigned int i;for (i =0 ; i < framebuffer->format->num_planes; i++) { -struct tegra_bo *bo = fb->planes[i]; +struct tegra_bo *bo =tegra_fb_get_plane (framebuffer, i);if (bo) {if (bo->pages)
@@ -119,21 +114,12 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) }drm_framebuffer_cleanup (framebuffer); -kfree (fb->planes);kfree (fb); } -static int tegra_fb_create_handle (struct drm_framebuffer *framebuffer, -struct drm_file *file,unsigned int *handle) -{ -struct tegra_fb *fb =to_tegra_fb (framebuffer); - -return drm_gem_handle_create (file, &fb->planes[0 ]->gem, handle); -} -static const struct drm_framebuffer_funcs tegra_fb_funcs = { .destroy = tegra_fb_destroy, - .create_handle = tegra_fb_create_handle, + .create_handle = drm_gem_fb_create_handle, }; static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
@@ -149,22 +135,15 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,if (!fb)return ERR_PTR (-ENOMEM ); - fb->planes =kzalloc (num_planes *sizeof (*planes),GFP_KERNEL ); -if (!fb->planes) { -kfree (fb); -return ERR_PTR (-ENOMEM ); - } -drm_helper_mode_fill_fb_struct (drm, &fb->base, mode_cmd);for (i =0 ; i < fb->base.format->num_planes; i++) - fb->planes[i] = planes[i]; + fb->base.obj[i] = &planes[i]->gem; err =drm_framebuffer_init (drm, &fb->base, &tegra_fb_funcs);if (err <0 ) {dev_err (drm->dev,"failed to initialize framebuffer: %d\n" , err); -kfree (fb->planes);kfree (fb);return ERR_PTR (err); }
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/24 drm/tegra: tegra_fb -> drm_framebuffer
In reply to Daniel StoneSince tegra_fb is now the same as drm_framebuffer, we can just replace the type completely.
--- drivers/gpu/drm/tegra/drm.h | 6 +----- drivers/gpu/drm/tegra/fb.c | 34 ++++++++++++++-------------------- 2 files changed, 15 insertions(+), 25 deletions(-)
drivers/gpu/drm/tegra/drm.h +1 -5
@@ -29,14 +29,10 @@struct reset_control ; -struct tegra_fb { -struct drm_framebuffer base; -}; -#ifdef CONFIG_DRM_FBDEV_EMULATION struct tegra_fbdev {struct drm_fb_helper base; -struct tegra_fb *fb; +struct drm_framebuffer *fb; };#endif
drivers/gpu/drm/tegra/fb.c +14 -20
@@ -16,11 +16,6 @@#include "gem.h" #include <drm/drm_gem_framebuffer_helper.h> -static inline struct tegra_fb *to_tegra_fb (struct drm_framebuffer *fb) -{ - return container_of(fb, struct tegra_fb, base); -} -#ifdef CONFIG_DRM_FBDEV_EMULATION static inline struct tegra_fbdev *to_tegra_fbdev (struct drm_fb_helper *helper) {
@@ -99,7 +94,6 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,static void tegra_fb_destroy (struct drm_framebuffer *framebuffer) { -struct tegra_fb *fb =to_tegra_fb (framebuffer);unsigned int i;for (i =0 ; i < framebuffer->format->num_planes; i++) {
@@ -114,7 +108,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) }drm_framebuffer_cleanup (framebuffer); -kfree (fb); +kfree (framebuffer); }static const struct drm_framebuffer_funcs tegra_fb_funcs = {
@@ -122,12 +116,12 @@ static const struct drm_framebuffer_funcs tegra_fb_funcs = { .create_handle = drm_gem_fb_create_handle, }; -static struct tegra_fb *tegra_fb_alloc (struct drm_device *drm, -const struct drm_mode_fb_cmd2 *mode_cmd, -struct tegra_bo **planes, -unsigned int num_planes) +static struct drm_framebuffer *tegra_fb_alloc (struct drm_device *drm, +const struct drm_mode_fb_cmd2 *mode_cmd, +struct tegra_bo **planes, +unsigned int num_planes) { -struct tegra_fb *fb; +struct drm_framebuffer *fb;unsigned int i;int err;
@@ -135,12 +129,12 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,if (!fb)return ERR_PTR (-ENOMEM ); -drm_helper_mode_fill_fb_struct (drm, &fb->base, mode_cmd); +drm_helper_mode_fill_fb_struct (drm, fb, mode_cmd); -for (i =0 ; i < fb->base.format->num_planes; i++) - fb->base.obj[i] = &planes[i]->gem; +for (i =0 ; i < fb->format->num_planes; i++) + fb->obj[i] = &planes[i]->gem; - err =drm_framebuffer_init (drm, &fb->base, &tegra_fb_funcs); + err =drm_framebuffer_init (drm, fb, &tegra_fb_funcs);if (err <0 ) {dev_err (drm->dev,"failed to initialize framebuffer: %d\n" , err);
@@ -158,7 +152,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,unsigned int hsub, vsub, i;struct tegra_bo *planes[4 ];struct drm_gem_object *gem; -struct tegra_fb *fb; +struct drm_framebuffer *fb;int err; hsub =drm_format_horz_chroma_subsampling (cmd->pixel_format);
@@ -194,7 +188,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, goto unreference; } -return &fb->base; +return fb; unreference:while (i--)
@@ -275,7 +269,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,return PTR_ERR (fbdev->fb); } - fb = &fbdev->fb->base; + fb = fbdev->fb; helper->fb = fb; helper->fbdev = info;
@@ -376,7 +370,7 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)drm_fb_helper_unregister_fbi (&fbdev->base);if (fbdev->fb) -drm_framebuffer_remove (&fbdev->fb->base); +drm_framebuffer_remove (fbdev->fb);drm_fb_helper_fini (&fbdev->base);tegra_fbdev_free (fbdev);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/24] drm/tegra: tegra_fb -> drm_framebuffer
Hi Thierry,
Quoted 6 lines · Daniel Stone
Since
tegra_fbis now the same asdrm_framebuffer, we can just replace the type completely.Signed-off-by Daniel Stone <[email protected]>Cc Thierry Reding <[email protected]>
Did this still need some more testing, or is it OK to apply?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/24] drm/tegra: tegra_fb -> drm_framebuffer
Quoted 11 lines · Daniel Stone
Hi Thierry,
Quoted 6 lines · Daniel Stone
Since
tegra_fbis now the same asdrm_framebuffer, we can just replace the type completely.Signed-off-by Daniel Stone <[email protected]>Cc Thierry Reding <[email protected]>Did this still need some more testing, or is it OK to apply?
Sorry, this completely fell off the table. I've tested patches 11-15 and they work fine. Applied all of them to drm/tegra/for-next.
Thanks,
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 14/24 drm/tegra: Move fbdev unmap special case
In reply to Daniel StoneUser framebuffers are created with either bo->pages or bo->vaddr set, depending on whether or not an IOMMU is present. On the other hand, the framebuffer created for fbdev emulation has a vaddr mapping made if bo->pages is set after creation. This is set up in fbdev probe.
Remove the special case unmapping from the general-purpose framebuffer destroy, and move it to fbdev teardown.
--- drivers/gpu/drm/tegra/fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/tegra/fb.c +11 -6
@@ -99,12 +99,8 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)for (i =0 ; i < framebuffer->format->num_planes; i++) {struct tegra_bo *bo =tegra_fb_get_plane (framebuffer, i); -if (bo) { -if (bo->pages) -vunmap (bo->vaddr); - +if (bo)drm_gem_object_put_unlocked (&bo->gem); - } }drm_framebuffer_cleanup (framebuffer);
@@ -369,8 +365,17 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) {drm_fb_helper_unregister_fbi (&fbdev->base); -if (fbdev->fb) +if (fbdev->fb) { +struct tegra_bo *bo =tegra_fb_get_plane (fbdev->fb,0 ); + +/* Undo the special mapping we made in fbdev probe. */ +if (bo && bo->pages) { +vunmap (bo->vaddr); + bo->vaddr =0 ; + } +drm_framebuffer_remove (fbdev->fb); + }drm_fb_helper_fini (&fbdev->base);tegra_fbdev_free (fbdev);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 15/24 drm/tegra: Use drm_gem_fb_destroy
In reply to Daniel StoneNow that our destroy function is the same as the helper, use that directly.
--- drivers/gpu/drm/tegra/fb.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/gpu/drm/tegra/fb.c +1 -16
@@ -92,23 +92,8 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,return 0 ; } -static void tegra_fb_destroy (struct drm_framebuffer *framebuffer) -{ -unsigned int i; - -for (i =0 ; i < framebuffer->format->num_planes; i++) { -struct tegra_bo *bo =tegra_fb_get_plane (framebuffer, i); - -if (bo) -drm_gem_object_put_unlocked (&bo->gem); - } - -drm_framebuffer_cleanup (framebuffer); -kfree (framebuffer); -} -static const struct drm_framebuffer_funcs tegra_fb_funcs = { - .destroy = tegra_fb_destroy, + .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, };
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 16/24 drm/exynos: Move GEM BOs to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 39 ++++------------------------------ 1 file changed, 4 insertions(+), 35 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +4 -35
@@ -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]; }
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRe: [PATCH 16/24] drm/exynos: Move GEM BOs to drm_framebuffer
Hi Daniel,
2018년 03월 30일 23:11에 Daniel Stone 이(가) 쓴 글:
Quoted 4 lines
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand 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
Quoted 75 lines
Signed-off-by Daniel Stone <[email protected]>Cc Inki Dae <[email protected]>Cc Joonyoung Shim <[email protected]>Cc Seung-Woo Kim <[email protected]>Cc Kyungmin Park <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 39 ++++------------------------------ 1 file changed, 4 insertions(+), 35 deletions(-)drivers/gpu/drm/exynos/exynos_drm_fb.c +3
-34@@ -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 *
drivers/gpu/drm/exynos/exynos_drm_fb.c exynos_drm_framebuffer_init(struct drm_device *dev, · line 96
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +1
-1@@ -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]; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 16/24] drm/exynos: Move GEM BOs to drm_framebuffer
Hi Inki,
Quoted 7 lines · Inki Dae
2018년 03월 30일 23:11에 Daniel Stone 이(가) 쓴 글:
Quoted 4 lines
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand 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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 17/24 drm/exynos: Move dma_addr out of exynos_drm_fb
In reply to Daniel StoneThis can be calculated from the GEM BO DMA address as well as the offset stored in the base framebuffer.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +3 -5
@@ -37,7 +37,6 @@*/ struct exynos_drm_fb {struct drm_framebuffer fb; -dma_addr_t dma_addr[MAX_FB_BUFFER ]; }; static int check_fb_gem_memory_type(struct drm_device *drm_dev,
@@ -91,8 +90,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev, goto err; exynos_fb->fb.obj[i] = &exynos_gem[i]->base; - exynos_fb->dma_addr[i] = exynos_gem[i]->dma_addr - + mode_cmd->offsets[i]; }drm_helper_mode_fill_fb_struct (dev, &exynos_fb->fb, mode_cmd);
@@ -160,12 +157,13 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,dma_addr_t exynos_drm_fb_dma_addr (struct drm_framebuffer *fb,int index) { -struct exynos_drm_fb *exynos_fb =to_exynos_fb (fb); +struct exynos_drm_gem *exynos_gem;if (WARN_ON_ONCE (index >=MAX_FB_BUFFER ))return 0 ; -return exynos_fb->dma_addr[index]; + exynos_gem =to_exynos_gem (fb->obj[index]); +return exynos_gem->dma_addr + fb->offsets[index]; }static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = {
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 18/24 drm/exynos: exynos_drm_fb -> drm_framebuffer
In reply to Daniel StoneNow exynos_drm_fb is just an empty wrapper around drm_framebuffer, we can drop it.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +8 -20
@@ -27,18 +27,6 @@#include "exynos_drm_iommu.h" #include "exynos_drm_crtc.h" -#define to_exynos_fb (x) container_of(x, struct exynos_drm_fb, fb) - -/* -* exynos specific framebuffer structure. -* -* @fb: drm framebuffer obejct. -* @exynos_gem: array of exynos specific gem object containing a gem object. -*/ -struct exynos_drm_fb { -struct drm_framebuffer fb; -}; -static int check_fb_gem_memory_type (struct drm_device *drm_dev,struct exynos_drm_gem *exynos_gem) {
@@ -76,12 +64,12 @@ exynos_drm_framebuffer_init(struct drm_device *dev, struct exynos_drm_gem **exynos_gem, int count) { -struct exynos_drm_fb *exynos_fb; +struct drm_framebuffer *fb;int i;int ret; - exynos_fb =kzalloc (sizeof (*exynos_fb),GFP_KERNEL ); -if (!exynos_fb) + fb =kzalloc (sizeof (*fb),GFP_KERNEL ); +if (!fb)return ERR_PTR (-ENOMEM );for (i =0 ; i < count; i++) {
@@ -89,21 +77,21 @@ exynos_drm_framebuffer_init(struct drm_device *dev,if (ret <0 ) goto err; - exynos_fb->fb.obj[i] = &exynos_gem[i]->base; + fb->obj[i] = &exynos_gem[i]->base; } -drm_helper_mode_fill_fb_struct (dev, &exynos_fb->fb, mode_cmd); +drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd); - ret =drm_framebuffer_init (dev, &exynos_fb->fb, &exynos_drm_fb_funcs); + ret =drm_framebuffer_init (dev, fb, &exynos_drm_fb_funcs);if (ret <0 ) {DRM_ERROR ("failed to initialize framebuffer\n" ); goto err; } -return &exynos_fb->fb; +return fb; err: -kfree (exynos_fb); +kfree (fb);return ERR_PTR (ret); }
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 19/24 drm/armada: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/armada/armada_fb.c | 23 ++++------------------- drivers/gpu/drm/armada/armada_fb.h | 3 +-- 2 files changed, 5 insertions(+), 21 deletions(-)
drivers/gpu/drm/armada/armada_fb.c +4 -19
@@ -7,30 +7,15 @@*/ #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "armada_drm.h" #include "armada_fb.h" #include "armada_gem.h" #include "armada_hw.h" -static void armada_fb_destroy (struct drm_framebuffer *fb) -{ -struct armada_framebuffer *dfb =drm_fb_to_armada_fb (fb); - -drm_framebuffer_cleanup (&dfb->fb); -drm_gem_object_put_unlocked (&dfb->obj->obj); -kfree (dfb); -} - -static int armada_fb_create_handle (struct drm_framebuffer *fb, -struct drm_file *dfile,unsigned int *handle) -{ -struct armada_framebuffer *dfb =drm_fb_to_armada_fb (fb); -return drm_gem_handle_create (dfile, &dfb->obj->obj, handle); -} -static const struct drm_framebuffer_funcs armada_fb_funcs = { - .destroy = armada_fb_destroy, - .create_handle = armada_fb_create_handle, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, }; struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
@@ -78,7 +63,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, dfb->fmt = format; dfb->mod = config; - dfb->obj = obj; + dfb->fb.obj[0 ] = &obj->obj;drm_helper_mode_fill_fb_struct (dev, &dfb->fb, mode);
drivers/gpu/drm/armada/armada_fb.h +1 -2
@@ -10,13 +10,12 @@struct armada_framebuffer {struct drm_framebuffer fb; -struct armada_gem_object *obj;uint8_t fmt;uint8_t mod; };#define drm_fb_to_armada_fb (dfb) \ container_of(dfb, struct armada_framebuffer, fb) -#define drm_fb_obj (fb) drm_fb_to_armada_fb(fb)->obj +#define drm_fb_obj (fb) drm_to_armada_gem((fb)->obj[0])struct armada_framebuffer *armada_framebuffer_create (struct drm_device *,const struct drm_mode_fb_cmd2 *,struct armada_gem_object *);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
Hi Russell,
Quoted 4 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.
Ping - have you had a chance to look at this?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
Quoted 9 lines · Daniel Stone
Hi Russell,
Quoted 4 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Ping - have you had a chance to look at this?
I haven't, I've not moved any of my trees off 4.16 yet as I've been away on vacation, and also busy dealing with Spectre for 32-bit ARM.
From a quick look, it seems fine, and as I guess the autobuilders haven't complained, it probably builds okay. So it can probably be merged without much risk - if there are any problems I'll sort it out later.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Daniel Stone
Quoted 4 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Ping - have you had a chance to look at this?
Quoted 7 lines
I haven't, I've not moved any of my trees off 4.16 yet as I've been away on vacation, and also busy dealing with Spectre for 32-bit ARM.
From a quick look, it seems fine, and as I guess the autobuilders haven't complained, it probably builds okay. So it can probably be merged without much risk - if there are any problems I'll sort it out later.
Thanks Russell. I did do a build test locally as well which had no complaints. I'll merge this through drm-misc.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Russell King - ARM Linux
maintainerRe: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
Quoted 13 lines · Daniel Stone
Quoted 12 lines · Russell King - ARM Linux
Quoted 7 lines · Daniel Stone
Quoted 4 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Ping - have you had a chance to look at this?
I haven't, I've not moved any of my trees off 4.16 yet as I've been away on vacation, and also busy dealing with Spectre for 32-bit ARM.
Quoted 7 lines
Quoted 4 lines
From a quick look, it seems fine, and as I guess the autobuilders haven't complained, it probably builds okay. So it can probably be merged without much risk - if there are any problems I'll sort it out later.
Thanks Russell. I did do a build test locally as well which had no complaints. I'll merge this through drm-misc.
Hi Daniel,
I've not seen this go in during the last merge window, so I assume either it missed the window or it's been forgotten. Mind if I pick it up instead - I finally have armada on the way to atomic modeset conversion.
Thanks.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
Hi Russell,
Quoted 8 lines · Russell King - ARM Linux
Quoted 2 lines · Daniel Stone
Thanks Russell. I did do a build test locally as well which had no complaints. I'll merge this through drm-misc.
I've not seen this go in during the last merge window, so I assume either it missed the window or it's been forgotten. Mind if I pick it up instead - I finally have armada on the way to atomic modeset conversion.
Thanks for chasing this up! AFAICT it has been merged though though:
it went into drm-misc-next last month, which Dave merged into drm-next with f4366e44efeb895c.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/24] drm/armada: Move GEM BO to drm_framebuffer
In reply to Daniel StoneQuoted 11 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Russell King <[email protected]>--- drivers/gpu/drm/armada/armada_fb.c | 23 ++++------------------- drivers/gpu/drm/armada/armada_fb.h | 3 +-- 2 files changed, 5 insertions(+), 21 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 20/24 drm/gma500: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/gma500/accel_2d.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 62 ++++++---------------------------- drivers/gpu/drm/gma500/framebuffer.h | 1 - drivers/gpu/drm/gma500/gma_display.c | 10 +++--- drivers/gpu/drm/gma500/gtt.h | 2 ++ drivers/gpu/drm/gma500/oaktrail_crtc.c | 3 +- 6 files changed, 20 insertions(+), 60 deletions(-)
drivers/gpu/drm/gma500/accel_2d.c +1 -1
@@ -251,7 +251,7 @@ static void psbfb_copyarea_accel(struct fb_info *info,if (!fb)return ; - offset = psbfb->gtt->offset; + offset =to_gtt_range (fb->obj[0 ])->offset; stride = fb->pitches[0 ];switch (fb->format->depth) {
drivers/gpu/drm/gma500/framebuffer.c +11 -51
120 lines not on this page · raw message
drivers/gpu/drm/gma500/framebuffer.h +0 -1
@@ -31,7 +31,6 @@ struct psb_framebuffer {struct drm_framebuffer base;struct address_space *addr_space;struct fb_info *fbdev; -struct gtt_range *gtt; };struct psb_fbdev {
drivers/gpu/drm/gma500/gma_display.c +5 -5
@@ -60,7 +60,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,struct drm_psb_private *dev_priv = dev->dev_private;struct gma_crtc *gma_crtc =to_gma_crtc (crtc);struct drm_framebuffer *fb = crtc->primary->fb; -struct psb_framebuffer *psbfb =to_psb_fb (fb); +struct gtt_range *gtt =to_gtt_range (fb->obj[0 ]);int pipe = gma_crtc->pipe;const struct psb_offset *map = &dev_priv->regmap[pipe];unsigned long start, offset;
@@ -78,10 +78,10 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,/* We are displaying this buffer, make sure it is actually loaded into the GTT */ - ret =psb_gtt_pin (psbfb->gtt); + ret =psb_gtt_pin (gtt);if (ret <0 ) goto gma_pipe_set_base_exit; - start = psbfb->gtt->offset; + start = gtt->offset; offset = y * fb->pitches[0 ] + x * fb->format->cpp[0 ];REG_WRITE (map->stride, fb->pitches[0 ]);
@@ -129,7 +129,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y, gma_pipe_cleaner:/* If there was a previous display we can now unpin it */ if (old_fb) -psb_gtt_unpin (to_psb_fb (old_fb)->gtt); +psb_gtt_unpin (to_gtt_range (old_fb->obj[0 ])); gma_pipe_set_base_exit:gma_power_end (dev);
@@ -491,7 +491,7 @@ void gma_crtc_disable(struct drm_crtc *crtc) crtc_funcs->dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) { - gt =to_psb_fb (crtc->primary->fb)->gtt; + gt =to_gtt_range (crtc->primary->fb->obj[0 ]);psb_gtt_unpin (gt); } }
drivers/gpu/drm/gma500/gtt.h +2 -0
@@ -53,6 +53,8 @@ struct gtt_range {int roll;/* Roll applied to the GTT entries */ }; +#define to_gtt_range (x) container_of(x, struct gtt_range, gem) +extern struct gtt_range *psb_gtt_alloc_range (struct drm_device *dev,int len,const char *name,int backed,u32 align);
drivers/gpu/drm/gma500/oaktrail_crtc.c +1 -2
@@ -600,7 +600,6 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,struct drm_psb_private *dev_priv = dev->dev_private;struct gma_crtc *gma_crtc =to_gma_crtc (crtc);struct drm_framebuffer *fb = crtc->primary->fb; -struct psb_framebuffer *psbfb =to_psb_fb (fb);int pipe = gma_crtc->pipe;const struct psb_offset *map = &dev_priv->regmap[pipe];unsigned long start, offset;
@@ -617,7 +616,7 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,if (!gma_power_begin (dev, true))return 0 ; - start = psbfb->gtt->offset; + start =to_gtt_range (fb->obj[0 ])->offset; offset = y * fb->pitches[0 ] + x * fb->format->cpp[0 ];REG_WRITE (map->stride, fb->pitches[0 ]);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 20/24] drm/gma500: Move GEM BO to drm_framebuffer
Quoted 7 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Patrik Jakobsson <[email protected]>
Quoted 8 lines
--- drivers/gpu/drm/gma500/accel_2d.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 62 ++++++---------------------------- drivers/gpu/drm/gma500/framebuffer.h | 1 - drivers/gpu/drm/gma500/gma_display.c | 10 +++--- drivers/gpu/drm/gma500/gtt.h | 2 ++ drivers/gpu/drm/gma500/oaktrail_crtc.c | 3 +- 6 files changed, 20 insertions(+), 60 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 21/24 drm/msm: Move GEM BOs to drm_framebuffer
In reply to Daniel StoneSince drm_framebuffer can now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffer create_handle function the same as the GEM framebuffer helper, we can reuse that.
--- drivers/gpu/drm/msm/msm_fb.c | 54 +++++++++----------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-)
drivers/gpu/drm/msm/msm_fb.c +11 -43
@@ -17,6 +17,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "msm_drv.h" #include "msm_kms.h"
@@ -25,49 +26,20 @@struct msm_framebuffer {struct drm_framebuffer base;const struct msm_format *format; -struct drm_gem_object *planes[MAX_PLANE ]; };#define to_msm_framebuffer (x) container_of(x, struct msm_framebuffer, base)static struct drm_framebuffer *msm_framebuffer_init (struct drm_device *dev,const struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **bos); -static int msm_framebuffer_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb); -return drm_gem_handle_create (file_priv, - msm_fb->planes[0 ], handle); -} - -static void msm_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb); -int i, n = fb->format->num_planes; - -DBG ("destroy: FB ID: %d (%p)" , fb->base.id, fb); - -drm_framebuffer_cleanup (fb); - -for (i =0 ; i < n; i++) { -struct drm_gem_object *bo = msm_fb->planes[i]; - -drm_gem_object_put_unlocked (bo); - } - -kfree (msm_fb); -} -static const struct drm_framebuffer_funcs msm_framebuffer_funcs = { - .create_handle = msm_framebuffer_create_handle, - .destroy = msm_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, };#ifdef CONFIG_DEBUG_FS void msm_framebuffer_describe (struct drm_framebuffer *fb,struct seq_file *m) { -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb);int i, n = fb->format->num_planes; seq_printf(m, "fb: %dx%d@%4.4s (%2d, ID:%d)\n",
@@ -77,7 +49,7 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)for (i =0 ; i < n; i++) {seq_printf (m," %d: offset=%d pitch=%d, obj: " , i, fb->offsets[i], fb->pitches[i]); -msm_gem_describe (msm_fb->planes[i], m); +msm_gem_describe (fb->obj[i], m); } }#endif
@@ -90,12 +62,11 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)int msm_framebuffer_prepare (struct drm_framebuffer *fb,struct msm_gem_address_space *aspace) { -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb);int ret, i, n = fb->format->num_planes;uint64_t iova;for (i =0 ; i < n; i++) { - ret =msm_gem_get_iova (msm_fb->planes[i], aspace, &iova); + ret =msm_gem_get_iova (fb->obj[i], aspace, &iova);DBG ("FB[%u]: iova[%d]: %08llx (%d)" , fb->base.id, i, iova, ret);if (ret)return ret;
@@ -107,26 +78,23 @@ int msm_framebuffer_prepare(struct drm_framebuffer *fb,void msm_framebuffer_cleanup (struct drm_framebuffer *fb,struct msm_gem_address_space *aspace) { -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb);int i, n = fb->format->num_planes;for (i =0 ; i < n; i++) -msm_gem_put_iova (msm_fb->planes[i], aspace); +msm_gem_put_iova (fb->obj[i], aspace); }uint32_t msm_framebuffer_iova (struct drm_framebuffer *fb,struct msm_gem_address_space *aspace,int plane) { -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb); -if (!msm_fb->planes[plane]) +if (!fb->obj[plane])return 0 ; -return msm_gem_iova (msm_fb->planes[plane], aspace) + fb->offsets[plane]; +return msm_gem_iova (fb->obj[plane], aspace) + fb->offsets[plane]; }struct drm_gem_object *msm_framebuffer_bo (struct drm_framebuffer *fb,int plane) { -struct msm_framebuffer *msm_fb =to_msm_framebuffer (fb); -return msm_fb->planes[plane]; +return drm_gem_fb_get_obj (fb, plane); }const struct msm_format *msm_framebuffer_format (struct drm_framebuffer *fb)
@@ -201,7 +169,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, msm_fb->format = format; -if (n >ARRAY_SIZE (msm_fb->planes)) { +if (n >ARRAY_SIZE (fb->obj)) { ret = -EINVAL ; goto fail; }
@@ -220,7 +188,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, goto fail; } - msm_fb->planes[i] = bos[i]; + msm_fb->base.obj[i] = bos[i]; }drm_helper_mode_fill_fb_struct (dev, fb, mode_cmd);
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 21/24] drm/msm: Move GEM BOs to drm_framebuffer
Hi Rob,
Quoted 4 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handlefunction the same as the GEM framebuffer helper, we can reuse that.
I didn't get to removing msm_framebuffer completely, because the cleanup was a bit too painful. It still seems like a useful cleanup though - could you please take a look?
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 21/24] drm/msm: Move GEM BOs to drm_framebuffer
In reply to Daniel StoneQuoted 11 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handlefunction the same as the GEM framebuffer helper, we can reuse that.--- drivers/gpu/drm/msm/msm_fb.c | 54 +++++++++----------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 22/24 drm/radeon: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 10 +++++----- drivers/gpu/drm/radeon/radeon_device.c | 4 ++-- drivers/gpu/drm/radeon/radeon_display.c | 31 +++++++---------------------- drivers/gpu/drm/radeon/radeon_fb.c | 8 ++++---- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 11 ++++------ drivers/gpu/drm/radeon/radeon_mode.h | 1 - 6 files changed, 22 insertions(+), 43 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +5 -5
@@ -1176,7 +1176,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = radeon_fb->obj; + obj = radeon_fb->base.obj[0 ]; rbo =gem_to_radeon_bo (obj); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -1442,7 +1442,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,if (!atomic && fb && fb != crtc->primary->fb) { radeon_fb =to_radeon_framebuffer (fb); - rbo =gem_to_radeon_bo (radeon_fb->obj); + rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r;
@@ -1490,7 +1490,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, target_fb = crtc->primary->fb; } - obj = radeon_fb->obj; + obj = radeon_fb->base.obj[0 ]; rbo =gem_to_radeon_bo (obj); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -1642,7 +1642,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,if (!atomic && fb && fb != crtc->primary->fb) { radeon_fb =to_radeon_framebuffer (fb); - rbo =gem_to_radeon_bo (radeon_fb->obj); + rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r;
@@ -2153,7 +2153,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)struct radeon_bo *rbo; radeon_fb =to_radeon_framebuffer (crtc->primary->fb); - rbo =gem_to_radeon_bo (radeon_fb->obj); + rbo =gem_to_radeon_bo (radeon_fb->base.obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r))DRM_ERROR ("failed to reserve rbo before unpin\n" );
drivers/gpu/drm/radeon/radeon_device.c +2 -2
@@ -1599,10 +1599,10 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, } } -if (rfb ==NULL || rfb->obj ==NULL ) { +if (rfb ==NULL || rfb->base.obj[0 ] ==NULL ) {continue ; } - robj =gem_to_radeon_bo (rfb->obj); + robj =gem_to_radeon_bo (rfb->base.obj[0 ]);/* don't unpin kernel fb objects */ if (!radeon_fbdev_robj_is_fb (rdev, robj)) { r =radeon_bo_reserve (robj, false);
drivers/gpu/drm/radeon/radeon_display.c +7 -24
@@ -32,6 +32,7 @@#include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_plane_helper.h> #include <drm/drm_edid.h>
@@ -502,14 +503,14 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,/* schedule unpin of the old buffer */ old_radeon_fb =to_radeon_framebuffer (crtc->primary->fb); - obj = old_radeon_fb->obj; + obj = old_radeon_fb->base.obj[0 ];/* take a reference to the old object */ drm_gem_object_get (obj); work->old_rbo =gem_to_radeon_bo (obj); new_radeon_fb =to_radeon_framebuffer (fb); - obj = new_radeon_fb->obj; + obj = new_radeon_fb->base.obj[0 ]; new_rbo =gem_to_radeon_bo (obj);/* pin the new buffer */
@@ -1285,27 +1286,9 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll, } -static void radeon_user_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct radeon_framebuffer *radeon_fb =to_radeon_framebuffer (fb); - -drm_gem_object_put_unlocked (radeon_fb->obj); -drm_framebuffer_cleanup (fb); -kfree (radeon_fb); -} - -static int radeon_user_framebuffer_create_handle (struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct radeon_framebuffer *radeon_fb =to_radeon_framebuffer (fb); - -return drm_gem_handle_create (file_priv, radeon_fb->obj, handle); -} -static const struct drm_framebuffer_funcs radeon_fb_funcs = { - .destroy = radeon_user_framebuffer_destroy, - .create_handle = radeon_user_framebuffer_create_handle, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, };int
@@ -1315,11 +1298,11 @@ radeon_framebuffer_init(struct drm_device *dev, struct drm_gem_object *obj) {int ret; - rfb->obj = obj; + rfb->base.obj[0 ] = obj;drm_helper_mode_fill_fb_struct (dev, &rfb->base, mode_cmd); ret =drm_framebuffer_init (dev, &rfb->base, &radeon_fb_funcs);if (ret) { - rfb->obj =NULL ; + rfb->base.obj[0 ] =NULL ;return ret; }return 0 ;
drivers/gpu/drm/radeon/radeon_fb.c +4 -4
@@ -312,9 +312,9 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdrm_fb_helper_unregister_fbi (&rfbdev->helper); -if (rfb->obj) { -radeonfb_destroy_pinned_object (rfb->obj); - rfb->obj =NULL ; +if (rfb->base.obj[0 ]) { +radeonfb_destroy_pinned_object (rfb->base.obj[0 ]); + rfb->base.obj[0 ] =NULL ;drm_framebuffer_unregister_private (&rfb->base);drm_framebuffer_cleanup (&rfb->base); }
@@ -400,7 +400,7 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)if (!rdev->mode_info.rfbdev)return false; -if (robj ==gem_to_radeon_bo (rdev->mode_info.rfbdev->rfb.obj)) +if (robj ==gem_to_radeon_bo (rdev->mode_info.rfbdev->rfb.base.obj[0 ]))return true;return false; }
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +4 -7
@@ -423,7 +423,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, }/* Pin framebuffer & get tilling informations */ - obj = radeon_fb->obj; + obj = radeon_fb->base.obj[0 ]; rbo =gem_to_radeon_bo (obj); retry: r =radeon_bo_reserve (rbo, false);
@@ -451,7 +451,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,struct radeon_bo *old_rbo;unsigned long nsize, osize; - old_rbo =gem_to_radeon_bo (to_radeon_framebuffer (fb)->obj); + old_rbo =gem_to_radeon_bo (fb->obj[0 ]); osize =radeon_bo_size (old_rbo); nsize =radeon_bo_size (rbo);if (nsize <= osize && !radeon_bo_reserve (old_rbo, false)) {
@@ -558,8 +558,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch);if (!atomic && fb && fb != crtc->primary->fb) { - radeon_fb =to_radeon_framebuffer (fb); - rbo =gem_to_radeon_bo (radeon_fb->obj); + rbo =gem_to_radeon_bo (fb->obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r;
@@ -1093,11 +1092,9 @@ static void radeon_crtc_disable(struct drm_crtc *crtc)radeon_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct radeon_framebuffer *radeon_fb;struct radeon_bo *rbo; - radeon_fb =to_radeon_framebuffer (crtc->primary->fb); - rbo =gem_to_radeon_bo (radeon_fb->obj); + rbo =gem_to_radeon_bo (crtc->primary->fb->obj[0 ]); r =radeon_bo_reserve (rbo, false);if (unlikely (r))DRM_ERROR ("failed to reserve rbo before unpin\n" );
drivers/gpu/drm/radeon/radeon_mode.h +0 -1
@@ -576,7 +576,6 @@ struct radeon_connector {struct radeon_framebuffer {struct drm_framebuffer base; -struct drm_gem_object *obj; };#define ENCODER_MODE_IS_DP (em) (((em) == ATOM_ENCODER_MODE_DP) || \
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20180330141138.28987-22-daniels-ZGY8ohtN/[email protected]
Thierry Reding
Reviewed-byRe: [PATCH 22/24] drm/radeon: Move GEM BO to drm_framebuffer
Quoted 10 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <daniels-ZGY8ohtN/[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc David (ChunMing) Zhou <[email protected]>
Quoted 8 lines
--- drivers/gpu/drm/radeon/atombios_crtc.c | 10 +++++----- drivers/gpu/drm/radeon/radeon_device.c | 4 ++-- drivers/gpu/drm/radeon/radeon_display.c | 31 +++++++---------------------- drivers/gpu/drm/radeon/radeon_fb.c | 8 ++++---- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 11 ++++------ drivers/gpu/drm/radeon/radeon_mode.h | 1 - 6 files changed, 22 insertions(+), 43 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/24 drm/amdgpu: Move GEM BO to drm_framebuffer
In reply to Daniel StoneSince 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 36 +++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 10 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 +-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 +++---- 10 files changed, 40 insertions(+), 96 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -3
@@ -2539,7 +2539,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct amdgpu_framebuffer *rfb =to_amdgpu_framebuffer (crtc->primary->fb); +struct drm_framebuffer *fb = crtc->primary->fb;struct amdgpu_bo *robj;if (amdgpu_crtc->cursor_bo) {
@@ -2551,10 +2551,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) } } -if (rfb ==NULL || rfb->obj ==NULL ) { +if (fb ==NULL || fb->obj[0 ] ==NULL ) {continue ; } - robj =gem_to_amdgpu_bo (rfb->obj); + robj =gem_to_amdgpu_bo (fb->obj[0 ]);/* don't unpin kernel fb objects */ if (!amdgpu_fbdev_robj_is_fb (adev, robj)) { r =amdgpu_bo_reserve (robj, true);
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +7 -29
@@ -35,6 +35,7 @@#include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h> static void amdgpu_display_flip_callback(struct dma_fence *f,
@@ -151,8 +152,6 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private;struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct amdgpu_framebuffer *old_amdgpu_fb; -struct amdgpu_framebuffer *new_amdgpu_fb;struct drm_gem_object *obj;struct amdgpu_flip_work *work;struct amdgpu_bo *new_abo;
@@ -174,15 +173,13 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, work->async = (page_flip_flags &DRM_MODE_PAGE_FLIP_ASYNC ) !=0 ;/* schedule unpin of the old buffer */ - old_amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - obj = old_amdgpu_fb->obj; + obj = crtc->primary->fb->obj[0 ];/* take a reference to the old object */ work->old_abo =gem_to_amdgpu_bo (obj);amdgpu_bo_ref (work->old_abo); - new_amdgpu_fb =to_amdgpu_framebuffer (fb); - obj = new_amdgpu_fb->obj; + obj = fb->obj[0 ]; new_abo =gem_to_amdgpu_bo (obj);/* pin the new buffer */
@@ -482,28 +479,9 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,return true; } -static void amdgpu_display_user_framebuffer_destroy (struct drm_framebuffer *fb) -{ -struct amdgpu_framebuffer *amdgpu_fb =to_amdgpu_framebuffer (fb); - -drm_gem_object_put_unlocked (amdgpu_fb->obj); -drm_framebuffer_cleanup (fb); -kfree (amdgpu_fb); -} - -static int amdgpu_display_user_framebuffer_create_handle ( -struct drm_framebuffer *fb, -struct drm_file *file_priv, -unsigned int *handle) -{ -struct amdgpu_framebuffer *amdgpu_fb =to_amdgpu_framebuffer (fb); - -return drm_gem_handle_create (file_priv, amdgpu_fb->obj, handle); -} -static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { - .destroy = amdgpu_display_user_framebuffer_destroy, - .create_handle = amdgpu_display_user_framebuffer_create_handle, + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, };uint32_t amdgpu_display_framebuffer_domains (struct amdgpu_device *adev)
@@ -526,11 +504,11 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, struct drm_gem_object *obj) {int ret; - rfb->obj = obj; + rfb->base.obj[0 ] = obj;drm_helper_mode_fill_fb_struct (dev, &rfb->base, mode_cmd); ret =drm_framebuffer_init (dev, &rfb->base, &amdgpu_fb_funcs);if (ret) { - rfb->obj =NULL ; + rfb->base.obj[0 ] =NULL ;return ret; }return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +5 -5
@@ -292,9 +292,9 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdrm_fb_helper_unregister_fbi (&rfbdev->helper); -if (rfb->obj) { -amdgpufb_destroy_pinned_object (rfb->obj); - rfb->obj =NULL ; +if (rfb->base.obj[0 ]) { +amdgpufb_destroy_pinned_object (rfb->base.obj[0 ]); + rfb->base.obj[0 ] =NULL ;drm_framebuffer_unregister_private (&rfb->base);drm_framebuffer_cleanup (&rfb->base); }
@@ -377,7 +377,7 @@ int amdgpu_fbdev_total_size(struct amdgpu_device *adev)if (!adev->mode_info.rfbdev)return 0 ; - robj =gem_to_amdgpu_bo (adev->mode_info.rfbdev->rfb.obj); + robj =gem_to_amdgpu_bo (adev->mode_info.rfbdev->rfb.base.obj[0 ]); size +=amdgpu_bo_size (robj);return size; }
@@ -386,7 +386,7 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj) {if (!adev->mode_info.rfbdev)return false; -if (robj ==gem_to_amdgpu_bo (adev->mode_info.rfbdev->rfb.obj)) +if (robj ==gem_to_amdgpu_bo (adev->mode_info.rfbdev->rfb.base.obj[0 ]))return true;return false; }
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +0 -1
@@ -308,7 +308,6 @@ struct amdgpu_display_funcs {struct amdgpu_framebuffer {struct drm_framebuffer base; -struct drm_gem_object *obj;/* caching for later use */ uint64_t address;
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +5 -12
@@ -1823,7 +1823,6 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_framebuffer *amdgpu_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct amdgpu_bo *abo;
@@ -1842,18 +1841,15 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - amdgpu_fb =to_amdgpu_framebuffer (fb); +if (atomic) target_fb = fb; - }else { - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = amdgpu_fb->obj; + obj = target_fb->obj[0 ]; abo =gem_to_amdgpu_bo (obj); r =amdgpu_bo_reserve (abo, false);if (unlikely (r !=0 ))
@@ -2043,8 +2039,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset,0 );if (!atomic && fb && fb != crtc->primary->fb) { - amdgpu_fb =to_amdgpu_framebuffer (fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r !=0 ))return r;
@@ -2526,11 +2521,9 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)dce_v10_0_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct amdgpu_framebuffer *amdgpu_fb;struct amdgpu_bo *abo; - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (crtc->primary->fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r))DRM_ERROR ("failed to reserve abo before unpin\n" );
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +5 -12
@@ -1862,7 +1862,6 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_framebuffer *amdgpu_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct amdgpu_bo *abo;
@@ -1881,18 +1880,15 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - amdgpu_fb =to_amdgpu_framebuffer (fb); +if (atomic) target_fb = fb; - }else { - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = amdgpu_fb->obj; + obj = target_fb->obj[0 ]; abo =gem_to_amdgpu_bo (obj); r =amdgpu_bo_reserve (abo, false);if (unlikely (r !=0 ))
@@ -2082,8 +2078,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset,0 );if (!atomic && fb && fb != crtc->primary->fb) { - amdgpu_fb =to_amdgpu_framebuffer (fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r !=0 ))return r;
@@ -2601,11 +2596,9 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)dce_v11_0_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct amdgpu_framebuffer *amdgpu_fb;struct amdgpu_bo *abo; - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (crtc->primary->fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r))DRM_ERROR ("failed to reserve abo before unpin\n" );
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +5 -12
@@ -1780,7 +1780,6 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_framebuffer *amdgpu_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct amdgpu_bo *abo;
@@ -1798,18 +1797,15 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - amdgpu_fb =to_amdgpu_framebuffer (fb); +if (atomic) target_fb = fb; - }else { - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = amdgpu_fb->obj; + obj = target_fb->obj[0 ]; abo =gem_to_amdgpu_bo (obj); r =amdgpu_bo_reserve (abo, false);if (unlikely (r !=0 ))
@@ -1978,8 +1974,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset,0 );if (!atomic && fb && fb != crtc->primary->fb) { - amdgpu_fb =to_amdgpu_framebuffer (fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r !=0 ))return r;
@@ -2414,11 +2409,9 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)dce_v6_0_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct amdgpu_framebuffer *amdgpu_fb;struct amdgpu_bo *abo; - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (crtc->primary->fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r))DRM_ERROR ("failed to reserve abo before unpin\n" );
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +5 -12
@@ -1754,7 +1754,6 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_framebuffer *amdgpu_fb;struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct amdgpu_bo *abo;
@@ -1773,18 +1772,15 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,return 0 ; } -if (atomic) { - amdgpu_fb =to_amdgpu_framebuffer (fb); +if (atomic) target_fb = fb; - }else { - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); +else target_fb = crtc->primary->fb; - }/* If atomic, assume fb object is pinned & idle & fenced and * just update base pointers */ - obj = amdgpu_fb->obj; + obj = target_fb->obj[0 ]; abo =gem_to_amdgpu_bo (obj); r =amdgpu_bo_reserve (abo, false);if (unlikely (r !=0 ))
@@ -1955,8 +1951,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,WREG32 (mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset,0 );if (!atomic && fb && fb != crtc->primary->fb) { - amdgpu_fb =to_amdgpu_framebuffer (fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r !=0 ))return r;
@@ -2430,11 +2425,9 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)dce_v8_0_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct amdgpu_framebuffer *amdgpu_fb;struct amdgpu_bo *abo; - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (crtc->primary->fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r))DRM_ERROR ("failed to reserve abo before unpin\n" );
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -3
@@ -168,11 +168,9 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)dce_virtual_crtc_dpms (crtc,DRM_MODE_DPMS_OFF );if (crtc->primary->fb) {int r; -struct amdgpu_framebuffer *amdgpu_fb;struct amdgpu_bo *abo; - amdgpu_fb =to_amdgpu_framebuffer (crtc->primary->fb); - abo =gem_to_amdgpu_bo (amdgpu_fb->obj); + abo =gem_to_amdgpu_bo (crtc->primary->fb->obj[0 ]); r =amdgpu_bo_reserve (abo, true);if (unlikely (r))DRM_ERROR ("failed to reserve abo before unpin\n" );
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -7
@@ -1820,7 +1820,7 @@ static bool fill_rects_from_plane_state(const struct drm_plane_state *state,static int get_fb_info (const struct amdgpu_framebuffer *amdgpu_fb,uint64_t *tiling_flags) { -struct amdgpu_bo *rbo =gem_to_amdgpu_bo (amdgpu_fb->obj); +struct amdgpu_bo *rbo =gem_to_amdgpu_bo (amdgpu_fb->base.obj[0 ]);int r =amdgpu_bo_reserve (rbo, false);if (unlikely (r)) {
@@ -3029,8 +3029,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, } afb =to_amdgpu_framebuffer (new_state->fb); - - obj = afb->obj; + obj = new_state->fb->obj[0 ]; rbo =gem_to_amdgpu_bo (obj); adev =amdgpu_ttm_adev (rbo->tbo.bdev); r =amdgpu_bo_reserve (rbo, false);
@@ -3094,14 +3093,12 @@ static void dm_plane_helper_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) {struct amdgpu_bo *rbo; -struct amdgpu_framebuffer *afb;int r;if (!old_state->fb)return ; - afb =to_amdgpu_framebuffer (old_state->fb); - rbo =gem_to_amdgpu_bo (afb->obj); + rbo =gem_to_amdgpu_bo (old_state->fb->obj[0 ]); r =amdgpu_bo_reserve (rbo, false);if (unlikely (r)) {DRM_ERROR ("failed to reserve rbo before unpin\n" );
@@ -3897,7 +3894,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,int r, vpos, hpos;struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc);struct amdgpu_framebuffer *afb =to_amdgpu_framebuffer (fb); -struct amdgpu_bo *abo =gem_to_amdgpu_bo (afb->obj); +struct amdgpu_bo *abo =gem_to_amdgpu_bo (fb->obj[0 ]);struct amdgpu_device *adev = crtc->dev->dev_private;bool async_flip = (crtc->state->pageflip_flags &DRM_MODE_PAGE_FLIP_ASYNC ) !=0 ;struct dc_flip_addrs addr = { {0 } };
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 24/24] drm/amdgpu: Move GEM BO to drm_framebuffer
Quoted 10 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc David (ChunMing) Zhou <[email protected]>
Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 36 +++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 10 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 17 ++++------- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 +-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 +++---- 10 files changed, 40 insertions(+), 96 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/24] drm/cirrus: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneQuoted 9 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 1 - drivers/gpu/drm/cirrus/cirrus_fbdev.c | 8 ++++---- drivers/gpu/drm/cirrus/cirrus_main.c | 25 ++++--------------------- drivers/gpu/drm/cirrus/cirrus_mode.c | 4 ++-- 4 files changed, 10 insertions(+), 28 deletions(-)
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 01/24] drm/cirrus: Place GEM BOs in drm_framebuffer
In reply to Daniel StoneQuoted 9 lines · Daniel Stone
Since
drm_framebuffercan now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffercreate_handleand destroy functions the same as the GEM framebuffer helper, we can reuse those.Signed-off-by Daniel Stone <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 1 - drivers/gpu/drm/cirrus/cirrus_fbdev.c | 8 ++++---- drivers/gpu/drm/cirrus/cirrus_main.c | 25 ++++--------------------- drivers/gpu/drm/cirrus/cirrus_mode.c | 4 ++-- 4 files changed, 10 insertions(+), 28 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · Daniel Stone
Hi,
I've been working on a getfb2[0] ioctl, which amongst other things supports multi-planar framebuffers as well as modifiers. getfb currently calls the framebuffer'shandle_createhook, which doesn't support multiple planes.Thanks to Noralf's recent work, drivers can just store GEM objects directly in
drm_framebuffer. I use this directly in getfb2: we need direct access to the GEM objects and not a vfunc in order to not hand out duplicate GEM names for the same object.This series converts all drivers except for nouveau, which was a little too non-trivial for my comfort, to storing GEM objects directly in
drm_framebuffer. For those drivers whosedriver_framebufferstruct was nothing butdrm_framebuffer+ BO, it deletes the driver-specific struct. It also makes use of Noralf's generic framebuffer helpers forcreate_handleand destroy where possible.I don't have the hardware for most of these drivers, so have had to settle for just staring really hard at the diff.
Quoted 6 lines
I intend to remove
create_handlewhen all drivers are converted over to placing BOs directly insidedrm_framebuffer. For most drivers there's a relatively easy conversion to using the helpers for basically all framebuffer handling and fbdev emulation as well, though that's a bit further than I was willing to go without hardware to test on ...
Series is:
Quoted 9 lines
Cheers,
Daniel[0]: https://lists.freedesktop.org/archives/dri-devel/2018-March/170512.html
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Alex,
Quoted 10 lines · Alex Deucher
Quoted 6 lines · Daniel Stone
I intend to remove
create_handlewhen all drivers are converted over to placing BOs directly insidedrm_framebuffer. For most drivers there's a relatively easy conversion to using the helpers for basically all framebuffer handling and fbdev emulation as well, though that's a bit further than I was willing to go without hardware to test on ...Series is:
Acked-by Alex Deucher <[email protected]>
Thanks a lot for the review! Are you taking the radeon/amdgpu patches through your tree? They don't have any dependencies on core code.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): CAPj87rOfg18u1xBioeu1D0MoD4My2rZy1Nw3yfA4DhdX2R7g7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 11 lines · Daniel Stone
Hi Alex,
Quoted 8 lines · Alex Deucher
Quoted 6 lines · Daniel Stone
I intend to remove
create_handlewhen all drivers are converted over to placing BOs directly insidedrm_framebuffer. For most drivers there's a relatively easy conversion to using the helpers for basically all framebuffer handling and fbdev emulation as well, though that's a bit further than I was willing to go without hardware to test on ...
Quoted 5 lines
Quoted 2 lines
Series is:
Acked-by Alex Deucher <[email protected]>Thanks a lot for the review! Are you taking the radeon/amdgpu patches through your tree? They don't have any dependencies on core code.
Sure. I'll grab them now.
Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 21 lines · Daniel Stone
Hi,
I've been working on a getfb2[0] ioctl, which amongst other things supports multi-planar framebuffers as well as modifiers. getfb currently calls the framebuffer'shandle_createhook, which doesn't support multiple planes.Thanks to Noralf's recent work, drivers can just store GEM objects directly in
drm_framebuffer. I use this directly in getfb2: we need direct access to the GEM objects and not a vfunc in order to not hand out duplicate GEM names for the same object.This series converts all drivers except for nouveau, which was a little too non-trivial for my comfort, to storing GEM objects directly in
drm_framebuffer. For those drivers whosedriver_framebufferstruct was nothing butdrm_framebuffer+ BO, it deletes the driver-specific struct. It also makes use of Noralf's generic framebuffer helpers forcreate_handleand destroy where possible.I don't have the hardware for most of these drivers, so have had to settle for just staring really hard at the diff.
Quoted 6 lines
I intend to remove
create_handlewhen all drivers are converted over to placing BOs directly insidedrm_framebuffer. For most drivers there's a relatively easy conversion to using the helpers for basically all framebuffer handling and fbdev emulation as well, though that's a bit further than I was willing to go without hardware to test on ...
Series is:
Quoted 9 lines
Cheers,
Daniel[0]: https://lists.freedesktop.org/archives/dri-devel/2018-March/170512.html
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx