deps for msm drm (flip-work helper, const ioctl table, and gem helpers)
Subsystems (17)
cover deps for msm drm (flip-work helper, const ioctl table, and gem helpers)
I'd sent these previously, but consolidating them into one patchset for easier tracking. The individual driver patches are not needed for msm drm/kms but the drm core bits are.
Rob Clark (9):
drm: add flip-work helper
drm/tilcdc: use flip-work helper
drm/omap: use flip-work helper
drm: const'ify ioctls table (v2)
drm/gem: add drm_gem_create_mmap_offset_size()
drm/gem: add shmem get/put page helpers
drm/gma500: use gem get/put page helpers
drm/udl: use gem get/put page helpers
drm/omap: kill omap_gem_helpers.c
drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip_work.c | 124 +++++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 131 ++++++++++++++++++++++++++++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +- drivers/gpu/drm/gma500/gtt.c | 38 ++------- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i810/i810_dma.c | 2 +- drivers/gpu/drm/i810/i810_drv.h | 2 +- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/mga/mga_drv.h | 2 +- drivers/gpu/drm/mga/mga_state.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +- drivers/gpu/drm/omapdrm/Makefile | 3 - drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.h | 5 +- drivers/gpu/drm/omapdrm/omap_fb.c | 74 ++++++++-------- drivers/gpu/drm/omapdrm/omap_gem.c | 8 +- drivers/gpu/drm/omapdrm/omap_gem_helpers.c | 124 --------------------------- drivers/gpu/drm/omapdrm/omap_plane.c | 51 +++++------ drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 2 +- drivers/gpu/drm/r128/r128_drv.h | 2 +- drivers/gpu/drm/r128/r128_state.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 2 +- drivers/gpu/drm/savage/savage_bci.c | 2 +- drivers/gpu/drm/savage/savage_drv.h | 2 +- drivers/gpu/drm/sis/sis_drv.h | 2 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 33 +++----- drivers/gpu/drm/udl/udl_gem.c | 44 ++-------- drivers/gpu/drm/via/via_dma.c | 2 +- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 +- drivers/gpu/host1x/drm/drm.c | 2 +- drivers/staging/imx-drm/imx-drm-core.c | 2 +- include/drm/drmP.h | 7 +- include/drm/drm_flip_work.h | 71 ++++++++++++++++ 39 files changed, 443 insertions(+), 329 deletions(-) create mode 100644 drivers/gpu/drm/drm_flip_work.c delete mode 100644 drivers/gpu/drm/omapdrm/omap_gem_helpers.c create mode 100644 include/drm/drm_flip_work.h
Signature · 1 line
1.8.3.1
PATCH 1/9 drm: add flip-work helper
A small helper to queue up work to do, from workqueue context, after a flip. Typically useful to defer unreffing buffers that may be read by the display controller until vblank.
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip_work.c | 124 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_flip_work.h | 71 +++++++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_flip_work.c create mode 100644 include/drm/drm_flip_work.h
drivers/gpu/drm/Makefile +1 -1
@@ -13,7 +13,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_crtc.o drm_modes.o drm_edid.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ - drm_rect.o drm_vma_manager.o + drm_rect.o drm_vma_manager.o drm_flip_work.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
drivers/gpu/drm/drm_flip_work.c new file +124 -0
124 lines not on this page · raw message
include/drm/drm_flip_work.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 1/9] drm: add flip-work helper
Quoted 5 lines · Rob Clark
A small helper to queue up work to do, from workqueue context, after a flip. Typically useful to defer unreffing buffers that may be read by the display controller until vblank.
Signed-off-by Rob Clark <[email protected]>
Since you have this nice kerneldoc already here, can you please integrate it all into the drm DocBook where all the other helpers are?
I don't think I'll use these for i915, but I can see that they're useful for simple kms drivers. So
if the DocBook gets wired up.
Cheers, Daniel
Quoted 235 lines
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip_work.c | 124 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_flip_work.h | 71 +++++++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_flip_work.c create mode 100644 include/drm/drm_flip_work.hdrivers/gpu/drm/Makefile +1
-1@@ -13,7 +13,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_crtc.o drm_modes.o drm_edid.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ - drm_rect.o drm_vma_manager.o + drm_rect.o drm_vma_manager.o drm_flip_work.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.odrivers/gpu/drm/drm_flip_work.c new file +124
-0@@ -0,0 +1,124 @@ +/* +* Copyright (C) 2013 Red Hat +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#include "drmP.h" +#include "drm_flip_work.h" + +/** +* drm_flip_work_queue - queue work +* @work: the flip-work +* @val: the value to queue +* +* Queues work, that will later be run (passed back to drm_flip_func_t +* func) on a work queue after drm_flip_work_commit() is called. +*/ +void drm_flip_work_queue (struct drm_flip_work *work,void *val) +{ +if (kfifo_put (&work->fifo, (const void **)&val)) { +atomic_inc (&work->pending); + }else { +DRM_ERROR ("%s fifo full!\n" , work->name); + work->func (work, val); + } +} +EXPORT_SYMBOL (drm_flip_work_queue); + +/** +* drm_flip_work_commit - commit queued work +* @work: the flip-work +* @wq: the work-queue to run the queued work on +* +* Trigger work previously queued by drm_flip_work_queue() to run +* on a workqueue. The typical usage would be to queue work (via +* drm_flip_work_queue()) at any point (from vblank irq and/or +* prior), and then from vblank irq commit the queued work. +*/ +void drm_flip_work_commit (struct drm_flip_work *work, +struct workqueue_struct *wq) +{ +uint32_t pending =atomic_read (&work->pending); +atomic_add (pending, &work->count); +atomic_sub (pending, &work->pending); +queue_work (wq, &work->worker); +} +EXPORT_SYMBOL (drm_flip_work_commit); + +static void flip_worker (struct work_struct *w) +{ + struct drm_flip_work *work = container_of(w, struct drm_flip_work, worker); +uint32_t count =atomic_read (&work->count); +void *val =NULL ; + +atomic_sub (count, &work->count); + +while (count--) +if (!WARN_ON (!kfifo_get (&work->fifo, &val))) + work->func (work, val); +} + +/** +* drm_flip_work_init - initialize flip-work +* @work: the flip-work to initialize +* @size: the max queue depth +* @name: debug name +* @func: the callback work function +* +* Initializes/allocates resources for the flip-work +* +* RETURNS: +* Zero on success, error code on failure. +*/ +int drm_flip_work_init (struct drm_flip_work *work,int size, +const char *name,drm_flip_func_t func) +{ +int ret; + + work->name = name; +atomic_set (&work->count,0 ); +atomic_set (&work->pending,0 ); + work->func = func; + + ret =kfifo_alloc (&work->fifo, size,GFP_KERNEL ); +if (ret) { +DRM_ERROR ("could not allocate %s fifo\n" , name); +return ret; + } + +INIT_WORK (&work->worker, flip_worker); + +return 0 ; +} +EXPORT_SYMBOL (drm_flip_work_init); + +/** +* drm_flip_work_cleanup - cleans up flip-work +* @work: the flip-work to cleanup +* +* Destroy resources allocated for the flip-work +*/ +void drm_flip_work_cleanup (struct drm_flip_work *work) +{ +WARN_ON (!kfifo_is_empty (&work->fifo)); +kfifo_free (&work->fifo); +} +EXPORT_SYMBOL (drm_flip_work_cleanup);include/drm/drm_flip_work.h new file +71
-0@@ -0,0 +1,71 @@ +/* +* Copyright (C) 2013 Red Hat +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#ifndef DRM_FLIP_WORK_H +#define DRM_FLIP_WORK_H + +#include <linux/kfifo.h> +#include <linux/workqueue.h> + +/** +* DOC: flip utils +* +* Util to queue up work to run from work-queue context after flip/vblank. +* Typically this can be used to defer unref of framebuffer's, cursor +* bo's, etc until after vblank. The APIs are all safe (and lockless) +* for up to one producer and once consumer at a time. The single-consumer +* aspect is ensured by committing the queued work to a single work-queue. +*/ + +struct drm_flip_work ; + +/** +* drm_flip_func_t - callback function +* +* @work: the flip work +* @val: value queued via drm_flip_work_queue() +* +* Callback function to be called for each of the queue'd work items after +* drm_flip_work_commit() is called. +*/ +typedef void (*drm_flip_func_t )(struct drm_flip_work *work,void *val); + +/** +* struct drm_flip_work - flip work queue +*/ +struct drm_flip_work { +const char *name; +atomic_t pending, count; +drm_flip_func_t func; +struct work_struct worker; + DECLARE_KFIFO_PTR(fifo, void *); +}; + +void drm_flip_work_queue (struct drm_flip_work *work,void *val); +void drm_flip_work_commit (struct drm_flip_work *work, +struct workqueue_struct *wq); +int drm_flip_work_init (struct drm_flip_work *work,int size, +const char *name,drm_flip_func_t func); +void drm_flip_work_cleanup (struct drm_flip_work *work); + +#endif /* DRM_FLIP_WORK_H */ Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 1/9] drm: add flip-work helper
Quoted 10 lines · Daniel Vetter
Quoted 5 lines · Rob Clark
A small helper to queue up work to do, from workqueue context, after a flip. Typically useful to defer unreffing buffers that may be read by the display controller until vblank.
Signed-off-by Rob Clark <[email protected]>Since you have this nice kerneldoc already here, can you please integrate it all into the drm DocBook where all the other helpers are?
Quoted 7 lines
I don't think I'll use these for i915, but I can see that they're useful for simple kms drivers. So
Acked-by Daniel Vetter <[email protected]>if the DocBook gets wired up.
something like:
-----------
Documentation/DocBook/drm.tmpl +6 -0
@@ -2213,6 +2213,12 @@ void intel_crt_init(struct drm_device *dev) !Edrivers/gpu/drm/drm_rect.c </sect2> <sect2> + <title>Flip-work Helper Reference</title> +!Pinclude/drm/drm_flip_work.h flip-work helper +!Iinclude/drm/drm_flip_work.h +!Edrivers/gpu/drm/drm_flip_work.c + </sect2> + <sect2> <title>VMA Offset Manager</title> !Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager !Edrivers/gpu/drm/drm_vma_manager.c
-----------
Quoted 243 lines
Cheers, Daniel
Quoted 231 lines
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip_work.c | 124 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_flip_work.h | 71 +++++++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_flip_work.c create mode 100644 include/drm/drm_flip_work.hdrivers/gpu/drm/Makefile +1
-1@@ -13,7 +13,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_crtc.o drm_modes.o drm_edid.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ - drm_rect.o drm_vma_manager.o + drm_rect.o drm_vma_manager.o drm_flip_work.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.odrivers/gpu/drm/drm_flip_work.c new file +124
-0@@ -0,0 +1,124 @@ +/* +* Copyright (C) 2013 Red Hat +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#include "drmP.h" +#include "drm_flip_work.h" + +/** +* drm_flip_work_queue - queue work +* @work: the flip-work +* @val: the value to queue +* +* Queues work, that will later be run (passed back to drm_flip_func_t +* func) on a work queue after drm_flip_work_commit() is called. +*/ +void drm_flip_work_queue (struct drm_flip_work *work,void *val) +{ +if (kfifo_put (&work->fifo, (const void **)&val)) { +atomic_inc (&work->pending); + }else { +DRM_ERROR ("%s fifo full!\n" , work->name); + work->func (work, val); + } +} +EXPORT_SYMBOL (drm_flip_work_queue); + +/** +* drm_flip_work_commit - commit queued work +* @work: the flip-work +* @wq: the work-queue to run the queued work on +* +* Trigger work previously queued by drm_flip_work_queue() to run +* on a workqueue. The typical usage would be to queue work (via +* drm_flip_work_queue()) at any point (from vblank irq and/or +* prior), and then from vblank irq commit the queued work. +*/ +void drm_flip_work_commit (struct drm_flip_work *work, +struct workqueue_struct *wq) +{ +uint32_t pending =atomic_read (&work->pending); +atomic_add (pending, &work->count); +atomic_sub (pending, &work->pending); +queue_work (wq, &work->worker); +} +EXPORT_SYMBOL (drm_flip_work_commit); + +static void flip_worker (struct work_struct *w) +{ + struct drm_flip_work *work = container_of(w, struct drm_flip_work, worker); +uint32_t count =atomic_read (&work->count); +void *val =NULL ; + +atomic_sub (count, &work->count); + +while (count--) +if (!WARN_ON (!kfifo_get (&work->fifo, &val))) + work->func (work, val); +} + +/** +* drm_flip_work_init - initialize flip-work +* @work: the flip-work to initialize +* @size: the max queue depth +* @name: debug name +* @func: the callback work function +* +* Initializes/allocates resources for the flip-work +* +* RETURNS: +* Zero on success, error code on failure. +*/ +int drm_flip_work_init (struct drm_flip_work *work,int size, +const char *name,drm_flip_func_t func) +{ +int ret; + + work->name = name; +atomic_set (&work->count,0 ); +atomic_set (&work->pending,0 ); + work->func = func; + + ret =kfifo_alloc (&work->fifo, size,GFP_KERNEL ); +if (ret) { +DRM_ERROR ("could not allocate %s fifo\n" , name); +return ret; + } + +INIT_WORK (&work->worker, flip_worker); + +return 0 ; +} +EXPORT_SYMBOL (drm_flip_work_init); + +/** +* drm_flip_work_cleanup - cleans up flip-work +* @work: the flip-work to cleanup +* +* Destroy resources allocated for the flip-work +*/ +void drm_flip_work_cleanup (struct drm_flip_work *work) +{ +WARN_ON (!kfifo_is_empty (&work->fifo)); +kfifo_free (&work->fifo); +} +EXPORT_SYMBOL (drm_flip_work_cleanup);include/drm/drm_flip_work.h new file +71
-1@@ -0,0 +1,71 @@ +/* +* Copyright (C) 2013 Red Hat +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#ifndef DRM_FLIP_WORK_H +#define DRM_FLIP_WORK_H + +#include <linux/kfifo.h> +#include <linux/workqueue.h> + +/** +* DOC: flip utils +* +* Util to queue up work to run from work-queue context after flip/vblank. +* Typically this can be used to defer unref of framebuffer's, cursor +* bo's, etc until after vblank. The APIs are all safe (and lockless) +* for up to one producer and once consumer at a time. The single-consumer +* aspect is ensured by committing the queued work to a single work-queue. +*/ + +struct drm_flip_work ; + +/** +* drm_flip_func_t - callback function +* +* @work: the flip work +* @val: value queued via drm_flip_work_queue() +* +* Callback function to be called for each of the queue'd work items after +* drm_flip_work_commit() is called. +*/ +typedef void (*drm_flip_func_t )(struct drm_flip_work *work,void *val); + +/** +* struct drm_flip_work - flip work queue +*/ +struct drm_flip_work { +const char *name; +atomic_t pending, count; +drm_flip_func_t func; +struct work_struct worker; + DECLARE_KFIFO_PTR(fifo, void *); +}; + +void drm_flip_work_queue (struct drm_flip_work *work,void *val); +void drm_flip_work_commit (struct drm_flip_work *work, +struct workqueue_struct *wq); +int drm_flip_work_init (struct drm_flip_work *work,int size, +const char *name,drm_flip_func_t func); +void drm_flip_work_cleanup (struct drm_flip_work *work); + +#endif /* DRM_FLIP_WORK_H */ --1.8.3.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/9 drm: add flip-work helper
A small helper to queue up work to do, from workqueue context, after a flip. Typically useful to defer unreffing buffers that may be read by the display controller until vblank.
v1: original
v2: wire up docbook + couple docbook fixes
--- Documentation/DocBook/drm.tmpl | 6 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip_work.c | 124 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_flip_work.h | 76 ++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_flip_work.c create mode 100644 include/drm/drm_flip_work.h
Documentation/DocBook/drm.tmpl +6 -0
@@ -2213,6 +2213,12 @@ void intel_crt_init(struct drm_device *dev) !Edrivers/gpu/drm/drm_rect.c </sect2> <sect2> + <title>Flip-work Helper Reference</title> +!Pinclude/drm/drm_flip_work.h flip utils +!Iinclude/drm/drm_flip_work.h +!Edrivers/gpu/drm/drm_flip_work.c + </sect2> + <sect2> <title>VMA Offset Manager</title> !Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager !Edrivers/gpu/drm/drm_vma_manager.c
drivers/gpu/drm/Makefile +1 -1
@@ -13,7 +13,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_crtc.o drm_modes.o drm_edid.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ - drm_rect.o drm_vma_manager.o + drm_rect.o drm_vma_manager.o drm_flip_work.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
drivers/gpu/drm/drm_flip_work.c new file +124 -0
124 lines not on this page · raw message
include/drm/drm_flip_work.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/9 drm/tilcdc: use flip-work helper
In reply to Rob Clark--- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +12 -21
@@ -15,7 +15,7 @@* this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/kfifo.h> +#include "drm_flip_work.h" #include "tilcdc_drv.h" #include "tilcdc_regs.h"
@@ -35,21 +35,18 @@ struct tilcdc_crtc {struct drm_framebuffer *scanout[2 ];/* for deferred fb unref's: */ - DECLARE_KFIFO_PTR(unref_fifo, struct drm_framebuffer *); -struct work_struct work; +struct drm_flip_work unref_work; };#define to_tilcdc_crtc (x) container_of(x, struct tilcdc_crtc, base) -static void unref_worker (struct work_struct *work) +static void unref_worker (struct drm_flip_work *work,void *val) {struct tilcdc_crtc *tilcdc_crtc = - container_of(work, struct tilcdc_crtc, work); + container_of(work, struct tilcdc_crtc, unref_work);struct drm_device *dev = tilcdc_crtc->base.dev; -struct drm_framebuffer *fb;mutex_lock (&dev->mode_config.mutex); -while (kfifo_get (&tilcdc_crtc->unref_fifo, &fb)) -drm_framebuffer_unreference (fb); +drm_framebuffer_unreference (val);mutex_unlock (&dev->mode_config.mutex); }
@@ -68,19 +65,14 @@ static void set_scanout(struct drm_crtc *crtc, int n) };struct tilcdc_crtc *tilcdc_crtc =to_tilcdc_crtc (crtc);struct drm_device *dev = crtc->dev; +struct tilcdc_drm_private *priv = dev->dev_private;pm_runtime_get_sync (dev->dev);tilcdc_write (dev, base_reg[n], tilcdc_crtc->start);tilcdc_write (dev, ceil_reg[n], tilcdc_crtc->end);if (tilcdc_crtc->scanout[n]) { -if (kfifo_put (&tilcdc_crtc->unref_fifo, - (const struct drm_framebuffer **)&tilcdc_crtc->scanout[n])) { -struct tilcdc_drm_private *priv = dev->dev_private; -queue_work (priv->wq, &tilcdc_crtc->work); - }else { -dev_err (dev->dev,"unref fifo full!\n" ); -drm_framebuffer_unreference (tilcdc_crtc->scanout[n]); - } +drm_flip_work_queue (&tilcdc_crtc->unref_work, tilcdc_crtc->scanout[n]); +drm_flip_work_commit (&tilcdc_crtc->unref_work, priv->wq); } tilcdc_crtc->scanout[n] = crtc->fb;drm_framebuffer_reference (tilcdc_crtc->scanout[n]);
@@ -149,8 +141,8 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc)WARN_ON (tilcdc_crtc->dpms ==DRM_MODE_DPMS_ON );drm_crtc_cleanup (crtc); -WARN_ON (!kfifo_is_empty (&tilcdc_crtc->unref_fifo)); -kfifo_free (&tilcdc_crtc->unref_fifo); +drm_flip_work_cleanup (&tilcdc_crtc->unref_work); +kfree (tilcdc_crtc); }
@@ -666,14 +658,13 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev) tilcdc_crtc->dpms =DRM_MODE_DPMS_OFF ;init_waitqueue_head (&tilcdc_crtc->frame_done_wq); - ret =kfifo_alloc (&tilcdc_crtc->unref_fifo,16 ,GFP_KERNEL ); + ret =drm_flip_work_init (&tilcdc_crtc->unref_work,16 , +"unref" , unref_worker);if (ret) {dev_err (dev->dev,"could not allocate unref FIFO\n" ); goto fail; } -INIT_WORK (&tilcdc_crtc->work, unref_worker); - ret =drm_crtc_init (dev, crtc, &tilcdc_crtc_funcs);if (ret <0 ) goto fail;
Signature · 1 line
1.8.3.1
PATCH 3/9 drm/omap: use flip-work helper
In reply to Rob ClarkAnd simplify how we hold a ref+pin to what is being scanned out by using fb refcnt'ing. The previous logic pre-dated fb refcnt, and as a result was less straightforward than it could have been. By holding a ref to the fb, we don't have to care about how many plane's there are and holding a ref to each color plane's bo.
--- drivers/gpu/drm/omapdrm/omap_drv.h | 5 +-- drivers/gpu/drm/omapdrm/omap_fb.c | 74 +++++++++++++++++------------------- drivers/gpu/drm/omapdrm/omap_plane.c | 51 +++++++++++-------------- 3 files changed, 58 insertions(+), 72 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.h +2 -3
@@ -203,9 +203,8 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,struct drm_framebuffer *omap_framebuffer_init (struct drm_device *dev,struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **bos);struct drm_gem_object *omap_framebuffer_bo (struct drm_framebuffer *fb,int p); -int omap_framebuffer_replace (struct drm_framebuffer *a, -struct drm_framebuffer *b,void *arg, -void (*unpin)(void *arg,struct drm_gem_object *bo)); +int omap_framebuffer_pin (struct drm_framebuffer *fb); +int omap_framebuffer_unpin (struct drm_framebuffer *fb);void omap_framebuffer_update_scanout (struct drm_framebuffer *fb,struct omap_drm_window *win,struct omap_overlay_info *info); struct drm_connector *omap_framebuffer_get_next_connector(
drivers/gpu/drm/omapdrm/omap_fb.c +34 -40
89 lines not on this page · raw message
drivers/gpu/drm/omapdrm/omap_plane.c +22 -29
110 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 4/9 drm: const'ify ioctls table (v2)
In reply to Rob ClarkBecause, there is no reason for it not to be const.
v1: original
v2: fix compile break in vmwgfx, and couple related cleanups suggested
by Ville Syrjälä
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i810/i810_dma.c | 2 +- drivers/gpu/drm/i810/i810_drv.h | 2 +- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/mga/mga_drv.h | 2 +- drivers/gpu/drm/mga/mga_state.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 5 ++--- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 2 +- drivers/gpu/drm/r128/r128_drv.h | 2 +- drivers/gpu/drm/r128/r128_state.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 2 +- drivers/gpu/drm/savage/savage_bci.c | 2 +- drivers/gpu/drm/savage/savage_drv.h | 2 +- drivers/gpu/drm/sis/sis_drv.h | 2 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/via/via_dma.c | 2 +- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ++-- drivers/gpu/host1x/drm/drm.c | 2 +- drivers/staging/imx-drm/imx-drm-core.c | 2 +- include/drm/drmP.h | 2 +- 26 files changed, 29 insertions(+), 30 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -2
@@ -213,7 +213,7 @@ static const struct vm_operations_struct exynos_drm_gem_vm_ops = { .close = drm_gem_vm_close, }; -static struct drm_ioctl_desc exynos_ioctls[] = { +static const struct drm_ioctl_desc exynos_ioctls[] = {DRM_IOCTL_DEF_DRV (EXYNOS_GEM_CREATE , exynos_drm_gem_create_ioctl,DRM_UNLOCKED |DRM_AUTH ), DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MAP_OFFSET,
@@ -277,6 +277,7 @@ static struct drm_driver exynos_drm_driver = { .gem_prime_export = exynos_dmabuf_prime_export, .gem_prime_import = exynos_dmabuf_prime_import, .ioctls = exynos_ioctls, + .num_ioctls = ARRAY_SIZE(exynos_ioctls), .fops = &exynos_drm_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,
@@ -288,7 +289,6 @@ static struct drm_driver exynos_drm_driver = {static int exynos_drm_platform_probe (struct platform_device *pdev) { pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); - exynos_drm_driver.num_ioctls =DRM_ARRAY_SIZE (exynos_ioctls);return drm_platform_init (&exynos_drm_driver, pdev); }
drivers/gpu/drm/gma500/psb_drv.c +1 -1
@@ -131,7 +131,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,static int psb_dpst_bl_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); -static struct drm_ioctl_desc psb_ioctls[] = { +static const struct drm_ioctl_desc psb_ioctls[] = {DRM_IOCTL_DEF_DRV (GMA_ADB , psb_adb_ioctl,DRM_AUTH ),DRM_IOCTL_DEF_DRV (GMA_MODE_OPERATION , psb_mode_operation_ioctl,DRM_AUTH ),
drivers/gpu/drm/i810/i810_dma.c +1 -1
@@ -1241,7 +1241,7 @@ int i810_driver_dma_quiescent(struct drm_device *dev)return 0 ; } -struct drm_ioctl_desc i810_ioctls[] = { +const struct drm_ioctl_desc i810_ioctls[] = {DRM_IOCTL_DEF_DRV (I810_INIT , i810_dma_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY |DRM_UNLOCKED ),DRM_IOCTL_DEF_DRV (I810_VERTEX , i810_dma_vertex,DRM_AUTH |DRM_UNLOCKED ),DRM_IOCTL_DEF_DRV (I810_CLEAR , i810_clear_bufs,DRM_AUTH |DRM_UNLOCKED ),
drivers/gpu/drm/i810/i810_drv.h +1 -1
@@ -125,7 +125,7 @@ extern void i810_driver_preclose(struct drm_device *dev,extern int i810_driver_device_is_agp (struct drm_device *dev);extern long i810_ioctl (struct file *file,unsigned int cmd,unsigned long arg); -extern struct drm_ioctl_desc i810_ioctls[]; +extern const struct drm_ioctl_desc i810_ioctls[];extern int i810_max_ioctl;#define I810_BASE (reg) ((unsigned long) \
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -1834,7 +1834,7 @@ void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)kfree (file_priv); } -struct drm_ioctl_desc i915_ioctls[] = { +const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_INIT , i915_dma_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (I915_FLUSH , i915_flush_ioctl,DRM_AUTH ),DRM_IOCTL_DEF_DRV (I915_FLIP , i915_flip_bufs,DRM_AUTH ),
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1566,7 +1566,7 @@ struct drm_i915_file_private {#define INTEL_RC6p_ENABLE (1<<1)#define INTEL_RC6pp_ENABLE (1<<2) -extern struct drm_ioctl_desc i915_ioctls[]; +extern const struct drm_ioctl_desc i915_ioctls[];extern int i915_max_ioctl;extern unsigned int i915_fbpercrtc__always_unused ;extern int i915_panel_ignore_lid__read_mostly ;
drivers/gpu/drm/mga/mga_drv.h +1 -1
@@ -149,7 +149,7 @@ typedef struct drm_mga_private {unsigned int agp_size; } drm_mga_private_t; -extern struct drm_ioctl_desc mga_ioctls[]; +extern const struct drm_ioctl_desc mga_ioctls[];extern int mga_max_ioctl;/* mga_dma.c */
drivers/gpu/drm/mga/mga_state.c +1 -1
@@ -1083,7 +1083,7 @@ file_priv)return 0 ; } -struct drm_ioctl_desc mga_ioctls[] = { +const struct drm_ioctl_desc mga_ioctls[] = {DRM_IOCTL_DEF_DRV (MGA_INIT , mga_dma_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (MGA_FLUSH , mga_dma_flush,DRM_AUTH ),DRM_IOCTL_DEF_DRV (MGA_RESET , mga_dma_reset,DRM_AUTH ),
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -3
@@ -640,7 +640,7 @@ nouveau_drm_postclose(struct drm_device *dev, struct drm_file *fpriv)nouveau_cli_destroy (cli); } -static struct drm_ioctl_desc +static const struct drm_ioctl_desc nouveau_ioctls[] = {DRM_IOCTL_DEF_DRV (NOUVEAU_GETPARAM , nouveau_abi16_ioctl_getparam,DRM_UNLOCKED |DRM_AUTH ),DRM_IOCTL_DEF_DRV (NOUVEAU_SETPARAM , nouveau_abi16_ioctl_setparam,DRM_UNLOCKED |DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),
@@ -695,6 +695,7 @@ driver = { .disable_vblank = nouveau_drm_vblank_disable, .ioctls = nouveau_ioctls, + .num_ioctls = ARRAY_SIZE(nouveau_ioctls), .fops = &nouveau_driver_fops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
@@ -765,8 +766,6 @@ nouveau_drm_pci_driver = {static int __init nouveau_drm_init (void ) { - driver.num_ioctls =ARRAY_SIZE (nouveau_ioctls); -if (nouveau_modeset ==-1 ) {#ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force ())
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -419,7 +419,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data,return ret; } -static struct drm_ioctl_desc ioctls[DRM_COMMAND_END -DRM_COMMAND_BASE ] = { +static const struct drm_ioctl_desc ioctls[DRM_COMMAND_END -DRM_COMMAND_BASE ] = {DRM_IOCTL_DEF_DRV (OMAP_GET_PARAM , ioctl_get_param,DRM_UNLOCKED |DRM_AUTH ),DRM_IOCTL_DEF_DRV (OMAP_SET_PARAM , ioctl_set_param,DRM_UNLOCKED |DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (OMAP_GEM_NEW , ioctl_gem_new,DRM_UNLOCKED |DRM_AUTH ),
drivers/gpu/drm/qxl/qxl_drv.h +1 -1
@@ -319,7 +319,7 @@ struct qxl_device {/* forward declaration for QXL_INFO_IO */ void qxl_io_log (struct qxl_device *qdev,const char *fmt, ...); -extern struct drm_ioctl_desc qxl_ioctls[]; +extern const struct drm_ioctl_desc qxl_ioctls[];extern int qxl_max_ioctl;int qxl_driver_load (struct drm_device *dev,unsigned long flags);
drivers/gpu/drm/qxl/qxl_ioctl.c +1 -1
@@ -402,7 +402,7 @@ static int qxl_alloc_surf_ioctl(struct drm_device *dev, void *data,return ret; } -struct drm_ioctl_desc qxl_ioctls[] = { +const struct drm_ioctl_desc qxl_ioctls[] = {DRM_IOCTL_DEF_DRV (QXL_ALLOC , qxl_alloc_ioctl,DRM_AUTH |DRM_UNLOCKED ),DRM_IOCTL_DEF_DRV (QXL_MAP , qxl_map_ioctl,DRM_AUTH |DRM_UNLOCKED ),
drivers/gpu/drm/r128/r128_drv.h +1 -1
@@ -131,7 +131,7 @@ typedef struct drm_r128_buf_priv {drm_r128_freelist_t *list_entry; } drm_r128_buf_priv_t; -extern struct drm_ioctl_desc r128_ioctls[]; +extern const struct drm_ioctl_desc r128_ioctls[];extern int r128_max_ioctl;/* r128_cce.c */
drivers/gpu/drm/r128/r128_state.c +1 -1
@@ -1643,7 +1643,7 @@ void r128_driver_lastclose(struct drm_device *dev)r128_do_cleanup_cce (dev); } -struct drm_ioctl_desc r128_ioctls[] = { +const struct drm_ioctl_desc r128_ioctls[] = {DRM_IOCTL_DEF_DRV (R128_INIT , r128_cce_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (R128_CCE_START , r128_cce_start,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (R128_CCE_STOP , r128_cce_stop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -109,7 +109,7 @@ void radeon_gem_object_close(struct drm_gem_object *obj, struct drm_file *file_priv);extern int radeon_get_crtc_scanoutpos (struct drm_device *dev,int crtc,int *vpos,int *hpos); -extern struct drm_ioctl_desc radeon_ioctls_kms[]; +extern const struct drm_ioctl_desc radeon_ioctls_kms[];extern int radeon_max_kms_ioctl;int radeon_mmap (struct file *filp,struct vm_area_struct *vma); int radeon_mode_dumb_mmap(struct drm_file *filp,
drivers/gpu/drm/radeon/radeon_kms.c +1 -1
@@ -722,7 +722,7 @@ KMS_INVALID_IOCTL(radeon_surface_alloc_kms)KMS_INVALID_IOCTL (radeon_surface_free_kms) -struct drm_ioctl_desc radeon_ioctls_kms[] = { +const struct drm_ioctl_desc radeon_ioctls_kms[] = {DRM_IOCTL_DEF_DRV (RADEON_CP_INIT , radeon_cp_init_kms,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (RADEON_CP_START , radeon_cp_start_kms,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (RADEON_CP_STOP , radeon_cp_stop_kms,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),
drivers/gpu/drm/savage/savage_bci.c +1 -1
@@ -1072,7 +1072,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)drm_idlelock_release (&file_priv->master->lock); } -struct drm_ioctl_desc savage_ioctls[] = { +const struct drm_ioctl_desc savage_ioctls[] = {DRM_IOCTL_DEF_DRV (SAVAGE_BCI_INIT , savage_bci_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (SAVAGE_BCI_CMDBUF , savage_bci_cmdbuf,DRM_AUTH ),DRM_IOCTL_DEF_DRV (SAVAGE_BCI_EVENT_EMIT , savage_bci_event_emit,DRM_AUTH ),
drivers/gpu/drm/savage/savage_drv.h +1 -1
@@ -104,7 +104,7 @@ enum savage_family { S3_LAST }; -extern struct drm_ioctl_desc savage_ioctls[]; +extern const struct drm_ioctl_desc savage_ioctls[];extern int savage_max_ioctl;#define S3_SAVAGE3D_SERIES (chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
drivers/gpu/drm/sis/sis_drv.h +1 -1
@@ -70,7 +70,7 @@ extern void sis_reclaim_buffers_locked(struct drm_device *dev, struct drm_file *file_priv);extern void sis_lastclose (struct drm_device *dev); -extern struct drm_ioctl_desc sis_ioctls[]; +extern const struct drm_ioctl_desc sis_ioctls[];extern int sis_max_ioctl;#endif
drivers/gpu/drm/sis/sis_mm.c +1 -1
@@ -348,7 +348,7 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,return ; } -struct drm_ioctl_desc sis_ioctls[] = { +const struct drm_ioctl_desc sis_ioctls[] = {DRM_IOCTL_DEF_DRV (SIS_FB_ALLOC , sis_fb_alloc,DRM_AUTH ),DRM_IOCTL_DEF_DRV (SIS_FB_FREE , sis_drm_free,DRM_AUTH ),DRM_IOCTL_DEF_DRV (SIS_AGP_INIT , sis_ioctl_agp_init,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),
drivers/gpu/drm/via/via_dma.c +1 -1
@@ -720,7 +720,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *return ret; } -struct drm_ioctl_desc via_ioctls[] = { +const struct drm_ioctl_desc via_ioctls[] = {DRM_IOCTL_DEF_DRV (VIA_ALLOCMEM , via_mem_alloc,DRM_AUTH ),DRM_IOCTL_DEF_DRV (VIA_FREEMEM , via_mem_free,DRM_AUTH ),DRM_IOCTL_DEF_DRV (VIA_AGP_INIT , via_agp_init,DRM_AUTH |DRM_MASTER ),
drivers/gpu/drm/via/via_drv.h +1 -1
@@ -114,7 +114,7 @@ enum via_family {#define VIA_READ8 (reg) DRM_READ8(VIA_BASE, reg)#define VIA_WRITE8 (reg, val) DRM_WRITE8(VIA_BASE, reg, val) -extern struct drm_ioctl_desc via_ioctls[]; +extern const struct drm_ioctl_desc via_ioctls[];extern int via_max_ioctl;extern int via_fb_init (struct drm_device *dev,void *data,struct drm_file *file_priv);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +2 -2
@@ -124,7 +124,7 @@* Ioctl definitions. */ -static struct drm_ioctl_desc vmw_ioctls[] = { +static const struct drm_ioctl_desc vmw_ioctls[] = {VMW_IOCTL_DEF (VMW_GET_PARAM , vmw_getparam_ioctl,DRM_AUTH |DRM_UNLOCKED ), VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl,
@@ -782,7 +782,7 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd,if ((nr >=DRM_COMMAND_BASE ) && (nr <DRM_COMMAND_END ) && (nr <DRM_COMMAND_BASE + dev->driver->num_ioctls)) { -struct drm_ioctl_desc *ioctl = +const struct drm_ioctl_desc *ioctl = &vmw_ioctls[nr -DRM_COMMAND_BASE ];if (unlikely (ioctl->cmd_drv != cmd)) {
drivers/gpu/host1x/drm/drm.c +1 -1
@@ -487,7 +487,7 @@ static int tegra_submit(struct drm_device *drm, void *data, }#endif -static struct drm_ioctl_desc tegra_drm_ioctls[] = { +static const struct drm_ioctl_desc tegra_drm_ioctls[] = { #ifdef CONFIG_DRM_TEGRA_STAGINGDRM_IOCTL_DEF_DRV (TEGRA_GEM_CREATE , tegra_gem_create,DRM_UNLOCKED |DRM_AUTH ), DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, DRM_UNLOCKED),
drivers/staging/imx-drm/imx-drm-core.c +1 -1
@@ -783,7 +783,7 @@ int imx_drm_remove_connector(struct imx_drm_connector *imx_drm_connector) }EXPORT_SYMBOL_GPL (imx_drm_remove_connector); -static struct drm_ioctl_desc imx_drm_ioctls[] = { +static const struct drm_ioctl_desc imx_drm_ioctls[] = {/* none so far */ };
include/drm/drmP.h +1 -1
@@ -965,7 +965,7 @@ struct drm_driver {u32 driver_features;int dev_priv_size; -struct drm_ioctl_desc *ioctls; +const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops;union {
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/9] drm: const'ify ioctls table (v2)
oh, whoops, this one is already on drm-next
Quoted 36 lines · Rob Clark
Because, there is no reason for it not to be const.
v1: original
v2: fix compile break in vmwgfx, and couple related cleanups suggested
by Ville SyrjäläSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i810/i810_dma.c | 2 +- drivers/gpu/drm/i810/i810_drv.h | 2 +- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/mga/mga_drv.h | 2 +- drivers/gpu/drm/mga/mga_state.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 5 ++--- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 2 +- drivers/gpu/drm/r128/r128_drv.h | 2 +- drivers/gpu/drm/r128/r128_state.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 2 +- drivers/gpu/drm/savage/savage_bci.c | 2 +- drivers/gpu/drm/savage/savage_drv.h | 2 +- drivers/gpu/drm/sis/sis_drv.h | 2 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/via/via_dma.c | 2 +- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ++-- drivers/gpu/host1x/drm/drm.c | 2 +- drivers/staging/imx-drm/imx-drm-core.c | 2 +- include/drm/drmP.h | 2 +- 26 files changed, 29 insertions(+), 30 deletions(-)
PATCH 5/9 drm/gem: add drm_gem_create_mmap_offset_size()
In reply to Rob ClarkVariant of drm_gem_create_mmap_offset() which doesn't make the assumption that virtual size and physical size (obj->size) are the same. This is needed in omapdrm to deal with tiled buffers. And lets us get rid of a duplicated and slightly modified version of drm_gem_create_mmap_offset() in omapdrm.
--- drivers/gpu/drm/drm_gem.c | 28 ++++++++++++++++++++++++---- include/drm/drmP.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_gem.c +24 -4
@@ -303,24 +303,44 @@ drm_gem_free_mmap_offset(struct drm_gem_object *obj)EXPORT_SYMBOL (drm_gem_free_mmap_offset);/** -* drm_gem_create_mmap_offset - create a fake mmap offset for an object +* drm_gem_create_mmap_offset_size - create a fake mmap offset for an object * @obj: obj in question +* @size: the virtual size * * GEM memory mapping works by handing back to userspace a fake mmap offset * it can use in a subsequent mmap(2) call. The DRM core code then looks * up the object based on the offset and sets up the various memory mapping * structures. * -* This routine allocates and attaches a fake offset for @obj. +* This routine allocates and attaches a fake offset for @obj, in cases where +* the virtual size differs from the physical size (ie. obj->size). Otherwise +* just use drm_gem_create_mmap_offset(). */ int -drm_gem_create_mmap_offset (struct drm_gem_object *obj) +drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size) {struct drm_device *dev = obj->dev;struct drm_gem_mm *mm = dev->mm_private;return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, - obj->size /PAGE_SIZE ); + size /PAGE_SIZE ); +} +EXPORT_SYMBOL (drm_gem_create_mmap_offset_size); + +/** +* drm_gem_create_mmap_offset - create a fake mmap offset for an object +* @obj: obj in question +* +* GEM memory mapping works by handing back to userspace a fake mmap offset +* it can use in a subsequent mmap(2) call. The DRM core code then looks +* up the object based on the offset and sets up the various memory mapping +* structures. +* +* This routine allocates and attaches a fake offset for @obj. +*/ +int drm_gem_create_mmap_offset (struct drm_gem_object *obj) +{ +return drm_gem_create_mmap_offset_size (obj, obj->size); }EXPORT_SYMBOL (drm_gem_create_mmap_offset);
include/drm/drmP.h +1 -0
@@ -1668,6 +1668,7 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)void drm_gem_free_mmap_offset (struct drm_gem_object *obj);int drm_gem_create_mmap_offset (struct drm_gem_object *obj); +int drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size); struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
Signature · 1 line
1.8.3.1
Re: [PATCH 5/9] drm/gem: add drm_gem_create_mmap_offset_size()
Hi
Quoted 7 lines · Rob Clark
Variant of
drm_gem_create_mmap_offset()which doesn't make the assumption that virtual size and physical size (obj->size) are the same. This is needed in omapdrm to deal with tiled buffers. And lets us get rid of a duplicated and slightly modified version ofdrm_gem_create_mmap_offset()in omapdrm.Signed-off-by Rob Clark <[email protected]>
Regards
David
Quoted 77 lines
--- drivers/gpu/drm/drm_gem.c | 28 ++++++++++++++++++++++++---- include/drm/drmP.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_gem.c +24
-4@@ -303,24 +303,44 @@ drm_gem_free_mmap_offset(struct drm_gem_object *obj)EXPORT_SYMBOL (drm_gem_free_mmap_offset);/** -* drm_gem_create_mmap_offset - create a fake mmap offset for an object +* drm_gem_create_mmap_offset_size - create a fake mmap offset for an object * @obj: obj in question +* @size: the virtual size * * GEM memory mapping works by handing back to userspace a fake mmap offset * it can use in a subsequent mmap(2) call. The DRM core code then looks * up the object based on the offset and sets up the various memory mapping * structures. * -* This routine allocates and attaches a fake offset for @obj. +* This routine allocates and attaches a fake offset for @obj, in cases where +* the virtual size differs from the physical size (ie. obj->size). Otherwise +* just use drm_gem_create_mmap_offset(). */ int -drm_gem_create_mmap_offset (struct drm_gem_object *obj) +drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size) {struct drm_device *dev = obj->dev;struct drm_gem_mm *mm = dev->mm_private;return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, - obj->size /PAGE_SIZE ); + size /PAGE_SIZE ); +} +EXPORT_SYMBOL (drm_gem_create_mmap_offset_size); + +/** +* drm_gem_create_mmap_offset - create a fake mmap offset for an object +* @obj: obj in question +* +* GEM memory mapping works by handing back to userspace a fake mmap offset +* it can use in a subsequent mmap(2) call. The DRM core code then looks +* up the object based on the offset and sets up the various memory mapping +* structures. +* +* This routine allocates and attaches a fake offset for @obj. +*/ +int drm_gem_create_mmap_offset (struct drm_gem_object *obj) +{ +return drm_gem_create_mmap_offset_size (obj, obj->size); }EXPORT_SYMBOL (drm_gem_create_mmap_offset);include/drm/drmP.h +1
-1@@ -1668,6 +1668,7 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)void drm_gem_free_mmap_offset (struct drm_gem_object *obj);int drm_gem_create_mmap_offset (struct drm_gem_object *obj); +int drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size); struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, --1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/9 drm/gem: add shmem get/put page helpers
In reply to Rob ClarkBasically just extracting some code duplicated in gma500, omapdrm, udl, and upcoming msm driver.
--- drivers/gpu/drm/drm_gem.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++ include/drm/drmP.h | 4 ++ 2 files changed, 107 insertions(+)
drivers/gpu/drm/drm_gem.c +103 -0
@@ -344,6 +344,109 @@ int drm_gem_create_mmap_offset(struct drm_gem_object *obj) }EXPORT_SYMBOL (drm_gem_create_mmap_offset); +/** +* drm_gem_get_pages - helper to allocate backing pages for a GEM object +* from shmem +* @obj: obj in question +* @gfpmask: gfp mask of requested pages +*/ +struct page **drm_gem_get_pages (struct drm_gem_object *obj,gfp_t gfpmask) +{ +struct inode *inode; +struct address_space *mapping; +struct page *p, **pages; +int i, npages; + +/* This is the shared memory object that backs the GEM resource */ + inode =file_inode (obj->filp); + mapping = inode->i_mapping; + +/* We already BUG_ON() for non-page-aligned sizes in +* drm_gem_object_init(), so we should never hit this unless +* driver author is doing something really wrong: +*/ +WARN_ON ((obj->size & (PAGE_SIZE -1 )) !=0 ); + + npages = obj->size >>PAGE_SHIFT ; + + pages =drm_malloc_ab (npages,sizeof (struct page *)); +if (pages ==NULL ) +return ERR_PTR (-ENOMEM ); + + gfpmask |=mapping_gfp_mask (mapping); + +for (i =0 ; i < npages; i++) { + p =shmem_read_mapping_page_gfp (mapping, i, gfpmask); +if (IS_ERR (p)) + goto fail; + pages[i] = p; + +/* There is a hypothetical issue w/ drivers that require +* buffer memory in the low 4GB.. if the pages are un- +* pinned, and swapped out, they can end up swapped back +* in above 4GB. If pages are already in memory, then +* shmem_read_mapping_page_gfp will ignore the gfpmask, +* even if the already in-memory page disobeys the mask. +* +* It is only a theoretical issue today, because none of +* the devices with this limitation can be populated with +* enough memory to trigger the issue. But this BUG_ON() +* is here as a reminder in case the problem with +* shmem_read_mapping_page_gfp() isn't solved by the time +* it does become a real issue. +* +* See this thread: http://lkml.org/lkml/2011/7/11/238 +*/ +BUG_ON ((gfpmask & __GFP_DMA32) && + (page_to_pfn (p) >=0x00100000UL )); + } + +return pages; + +fail: +while (i--) +page_cache_release (pages[i]); + +drm_free_large (pages); +return ERR_CAST (p); +} +EXPORT_SYMBOL (drm_gem_get_pages); + +/** +* drm_gem_put_pages - helper to free backing pages for a GEM object +* @obj: obj in question +* @pages: pages to free +* @dirty: if true, pages will be marked as dirty +* @accessed: if true, the pages will be marked as accessed +*/ +void drm_gem_put_pages (struct drm_gem_object *obj,struct page **pages, +bool dirty,bool accessed) +{ +int i, npages; + +/* We already BUG_ON() for non-page-aligned sizes in +* drm_gem_object_init(), so we should never hit this unless +* driver author is doing something really wrong: +*/ +WARN_ON ((obj->size & (PAGE_SIZE -1 )) !=0 ); + + npages = obj->size >>PAGE_SHIFT ; + +for (i =0 ; i < npages; i++) { +if (dirty) +set_page_dirty (pages[i]); + +if (accessed) +mark_page_accessed (pages[i]); + +/* Undo the reference we took when populating the table */ +page_cache_release (pages[i]); + } + +drm_free_large (pages); +} +EXPORT_SYMBOL (drm_gem_put_pages); +/** Returns a reference to the object named by the handle. */ struct drm_gem_object * drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
include/drm/drmP.h +4 -0
@@ -1670,6 +1670,10 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj);int drm_gem_create_mmap_offset (struct drm_gem_object *obj);int drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size); +struct page **drm_gem_get_pages (struct drm_gem_object *obj,gfp_t gfpmask); +void drm_gem_put_pages (struct drm_gem_object *obj,struct page **pages, +bool dirty,bool accessed); +struct drm_gem_object *drm_gem_object_lookup (struct drm_device *dev,struct drm_file *filp,u32 handle);
Signature · 1 line
1.8.3.1
PATCH 7/9 drm/gma500: use gem get/put page helpers
In reply to Rob Clark--- drivers/gpu/drm/gma500/gtt.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)
drivers/gpu/drm/gma500/gtt.c +6 -32
@@ -196,37 +196,17 @@ void psb_gtt_roll(struct drm_device *dev, struct gtt_range *r, int roll)*/ static int psb_gtt_attach_pages (struct gtt_range *gt) { -struct inode *inode; -struct address_space *mapping; -int i; -struct page *p; -int pages = gt->gem.size /PAGE_SIZE ; +struct page **pages;WARN_ON (gt->pages); -/* This is the shared memory object that backs the GEM resource */ - inode =file_inode (gt->gem.filp); - mapping = inode->i_mapping; + pages =drm_gem_get_pages (>->gem,0 ); +if (IS_ERR (pages)) +return PTR_ERR (pages); - gt->pages =kmalloc (pages *sizeof (struct page *),GFP_KERNEL ); -if (gt->pages ==NULL ) -return -ENOMEM ; - gt->npage = pages; + gt->pages = pages; -for (i =0 ; i < pages; i++) { - p =shmem_read_mapping_page (mapping, i); -if (IS_ERR (p)) - goto err; - gt->pages[i] = p; - }return 0 ; - -err: -while (i--) -page_cache_release (gt->pages[i]); -kfree (gt->pages); - gt->pages =NULL ; -return PTR_ERR (p); }/**
@@ -240,13 +220,7 @@ err:*/ static void psb_gtt_detach_pages (struct gtt_range *gt) { -int i; -for (i =0 ; i < gt->npage; i++) { -/* FIXME: do we need to force dirty */ -set_page_dirty (gt->pages[i]); -page_cache_release (gt->pages[i]); - } -kfree (gt->pages); +drm_gem_put_pages (>->gem, gt->pages, true, false); gt->pages =NULL ; }
Signature · 1 line
1.8.3.1
Re: [PATCH 7/9] drm/gma500: use gem get/put page helpers
Quoted 5 lines · Rob Clark
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/gma500/gtt.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)[ snip ]
This is quite late to report, but I've just begun testing 3.12, and this patch makes my screen garbled when using the modesetting xorg driver.
So far it looks like the buffer that the xorg driver gets is not the one that is actually mapped by the kernel.
I'm currently trying to know what exactly causes the problem, but I don't know anything about the internals here...
I doubt it will help, but the fbdev driver still works with this patch.
- Guillaume
Re: [PATCH 7/9] drm/gma500: use gem get/put page helpers
Quoted 7 lines · Guillaume CLÉMENT
Quoted 5 lines · Rob Clark
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/gma500/gtt.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)[ snip ]
Quoted 9 lines
This is quite late to report, but I've just begun testing 3.12, and this patch makes my screen garbled when using the modesetting xorg driver.
So far it looks like the buffer that the xorg driver gets is not the one that is actually mapped by the kernel.
I'm currently trying to know what exactly causes the problem, but I don't know anything about the internals here...
could you try this small patch.. I think I missed something w/ my original patch (sorry, no hw to test on here):
----------
drivers/gpu/drm/gma500/gtt.c +1 -0
@@ -204,6 +204,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt)if (IS_ERR (pages))return PTR_ERR (pages); + gt->npage = gt->gem.size /PAGE_SIZE ; gt->pages = pages;return 0 ;
----------
Quoted 5 lines
I doubt it will help, but the fbdev driver still works with this patch.
- Guillaume
Patrik Jakobsson
maintainerRe: [PATCH 7/9] drm/gma500: use gem get/put page helpers
Quoted 28 lines · Rob Clark
Quoted 7 lines · Guillaume CLÉMENT
Quoted 5 lines · Rob Clark
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/gma500/gtt.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)[ snip ]
Quoted 9 lines
This is quite late to report, but I've just begun testing 3.12, and this patch makes my screen garbled when using the modesetting xorg driver.
So far it looks like the buffer that the xorg driver gets is not the one that is actually mapped by the kernel.
I'm currently trying to know what exactly causes the problem, but I don't know anything about the internals here...
could you try this small patch.. I think I missed something w/ my original patch (sorry, no hw to test on here):
----------
drivers/gpu/drm/gma500/gtt.c +0
-0
drivers/gpu/drm/gma500/gtt.c static int psb_gtt_attach_pages(struct gtt_range *gt)
Quoted 8 lines
drivers/gpu/drm/gma500/gtt.c +1
-1@@ -204,6 +204,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt)if (IS_ERR (pages))return PTR_ERR (pages); + gt->npage = gt->gem.size /PAGE_SIZE ; gt->pages = pages;return 0 ; ----------
Rob, if this works, can you please make sure it goes into Dave's tree. I'm currently travelling and I'll be away for at least one week.
Thanks
Patrik
Re: [PATCH 7/9] drm/gma500: use gem get/put page helpers
In reply to Guillaume CLÉMENTQuoted 3 lines
This is quite late to report, but I've just begun testing 3.12, and this patch makes my screen garbled when using the modesetting xorg driver.
Alright, after trying to notice what was different between the old and new code, I've found the culprit :
- gt->npage = pages;
There is no equivalent of this line with the new code. This must mess things up.
By writing:
gt->npage = gt->gem.size / PAGE_SIZE;
after:
gt->npage = pages;
I don't experience the problem anymore. If this looks good to you, I'll create a patch for this.
Thanks,
- Guillaume
PATCH 8/9 drm/udl: use gem get/put page helpers
In reply to Rob Clark--- drivers/gpu/drm/udl/udl_gem.c | 44 ++++++------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-)
drivers/gpu/drm/udl/udl_gem.c +6 -38
@@ -123,55 +123,23 @@ int udl_gem_init_object(struct drm_gem_object *obj)static int udl_gem_get_pages (struct udl_gem_object *obj,gfp_t gfpmask) { -int page_count, i; -struct page *page; -struct inode *inode; -struct address_space *mapping; +struct page **pages;if (obj->pages)return 0 ; - page_count = obj->base.size /PAGE_SIZE ; -BUG_ON (obj->pages !=NULL ); - obj->pages =drm_malloc_ab (page_count,sizeof (struct page *)); -if (obj->pages ==NULL ) -return -ENOMEM ; - - inode =file_inode (obj->base.filp); - mapping = inode->i_mapping; - gfpmask |=mapping_gfp_mask (mapping); + pages =drm_gem_get_pages (&obj->base, gfpmask); +if (IS_ERR (pages)) +return PTR_ERR (pages); -for (i =0 ; i < page_count; i++) { - page =shmem_read_mapping_page_gfp (mapping, i, gfpmask); -if (IS_ERR (page)) - goto err_pages; - obj->pages[i] = page; - } + obj->pages = pages;return 0 ; -err_pages: -while (i--) -page_cache_release (obj->pages[i]); -drm_free_large (obj->pages); - obj->pages =NULL ; -return PTR_ERR (page); }static void udl_gem_put_pages (struct udl_gem_object *obj) { -int page_count = obj->base.size /PAGE_SIZE ; -int i; - -if (obj->base.import_attach) { -drm_free_large (obj->pages); - obj->pages =NULL ; -return ; - } - -for (i =0 ; i < page_count; i++) -page_cache_release (obj->pages[i]); - -drm_free_large (obj->pages); +drm_gem_put_pages (&obj->base, obj->pages, false, false); obj->pages =NULL ; }
Signature · 1 line
1.8.3.1
PATCH 9/9 drm/omap: kill omap_gem_helpers.c
In reply to Rob Clark--- drivers/gpu/drm/omapdrm/Makefile | 3 - drivers/gpu/drm/omapdrm/omap_gem.c | 8 +- drivers/gpu/drm/omapdrm/omap_gem_helpers.c | 124 ----------------------------- 3 files changed, 4 insertions(+), 131 deletions(-) delete mode 100644 drivers/gpu/drm/omapdrm/omap_gem_helpers.c
drivers/gpu/drm/omapdrm/Makefile +0 -3
@@ -18,7 +18,4 @@ omapdrm-y := omap_drv.o \ omap_dmm_tiler.o \ tcm-sita.o -# temporary: -omapdrm-y += omap_gem_helpers.o - obj-$(CONFIG_DRM_OMAP) += omapdrm.o
drivers/gpu/drm/omapdrm/omap_gem.c +4 -4
@@ -237,7 +237,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)* mapping_gfp_mask(mapping) which conflicts w/ GFP_DMA32.. probably * we actually want CMA memory for it all anyways.. */ - pages =_drm_gem_get_pages (obj,GFP_KERNEL ); + pages =drm_gem_get_pages (obj,GFP_KERNEL );if (IS_ERR (pages)) {dev_err (obj->dev->dev,"could not get pages: %ld\n" ,PTR_ERR (pages));return PTR_ERR (pages);
@@ -271,7 +271,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)return 0 ; free_pages: -_drm_gem_put_pages (obj, pages, true, false); +drm_gem_put_pages (obj, pages, true, false);return ret; }
@@ -295,7 +295,7 @@ static void omap_gem_detach_pages(struct drm_gem_object *obj)kfree (omap_obj->addrs); omap_obj->addrs =NULL ; -_drm_gem_put_pages (obj, omap_obj->pages, true, false); +drm_gem_put_pages (obj, omap_obj->pages, true, false); omap_obj->pages =NULL ; }
@@ -316,7 +316,7 @@ static uint64_t mmap_offset(struct drm_gem_object *obj)/* Make it mmapable */ size =omap_gem_mmap_size (obj); - ret =_drm_gem_create_mmap_offset_size (obj, size); + ret =drm_gem_create_mmap_offset_size (obj, size);if (ret) {dev_err (dev->dev,"could not allocate mmap offset\n" );return 0 ;
drivers/gpu/drm/omapdrm/omap_gem_helpers.c deleted +0 -124
124 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 9/9] drm/omap: kill omap_gem_helpers.c
Quoted 1 line · Rob Clark
Signed-off-by Rob Clark <[email protected]>
Patches 5-9 are Reviewed-by: Daniel Vetter <[email protected]>
Quoted 196 lines
--- drivers/gpu/drm/omapdrm/Makefile | 3 - drivers/gpu/drm/omapdrm/omap_gem.c | 8 +- drivers/gpu/drm/omapdrm/omap_gem_helpers.c | 124 ----------------------------- 3 files changed, 4 insertions(+), 131 deletions(-) delete mode 100644 drivers/gpu/drm/omapdrm/omap_gem_helpers.cdrivers/gpu/drm/omapdrm/Makefile +0
-3@@ -18,7 +18,4 @@ omapdrm-y := omap_drv.o \ omap_dmm_tiler.o \ tcm-sita.o -# temporary: -omapdrm-y += omap_gem_helpers.o - obj-$(CONFIG_DRM_OMAP) += omapdrm.odrivers/gpu/drm/omapdrm/omap_gem.c +4
-4@@ -237,7 +237,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)* mapping_gfp_mask(mapping) which conflicts w/ GFP_DMA32.. probably * we actually want CMA memory for it all anyways.. */ - pages =_drm_gem_get_pages (obj,GFP_KERNEL ); + pages =drm_gem_get_pages (obj,GFP_KERNEL );if (IS_ERR (pages)) {dev_err (obj->dev->dev,"could not get pages: %ld\n" ,PTR_ERR (pages));return PTR_ERR (pages);@@ -271,7 +271,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)return 0 ; free_pages: -_drm_gem_put_pages (obj, pages, true, false); +drm_gem_put_pages (obj, pages, true, false);return ret; }@@ -295,7 +295,7 @@ static void omap_gem_detach_pages(struct drm_gem_object *obj)kfree (omap_obj->addrs); omap_obj->addrs =NULL ; -_drm_gem_put_pages (obj, omap_obj->pages, true, false); +drm_gem_put_pages (obj, omap_obj->pages, true, false); omap_obj->pages =NULL ; }@@ -316,7 +316,7 @@ static uint64_t mmap_offset(struct drm_gem_object *obj)/* Make it mmapable */ size =omap_gem_mmap_size (obj); - ret =_drm_gem_create_mmap_offset_size (obj, size); + ret =drm_gem_create_mmap_offset_size (obj, size);if (ret) {dev_err (dev->dev,"could not allocate mmap offset\n" );return 0 ;drivers/gpu/drm/omapdrm/omap_gem_helpers.c deleted +0
-124@@ -1,124 +0,0 @@ -/* -* drivers/gpu/drm/omapdrm/omap_gem_helpers.c -* -* Copyright (C) 2011 Texas Instruments -* Author: Rob Clark <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -/* temporary copy of drm_gem_{get,put}_pages() until the -* "drm/gem: add functions to get/put pages" patch is merged.. -*/ - -#include <linux/module.h> -#include <linux/types.h> -#include <linux/shmem_fs.h> - -#include <drm/drmP.h> - -/** -* drm_gem_get_pages - helper to allocate backing pages for a GEM object -* @obj: obj in question -* @gfpmask: gfp mask of requested pages -*/ -struct page **_drm_gem_get_pages (struct drm_gem_object *obj,gfp_t gfpmask) -{ -struct inode *inode; -struct address_space *mapping; -struct page *p, **pages; -int i, npages; - -/* This is the shared memory object that backs the GEM resource */ - inode =file_inode (obj->filp); - mapping = inode->i_mapping; - - npages = obj->size >>PAGE_SHIFT ; - - pages =drm_malloc_ab (npages,sizeof (struct page *)); -if (pages ==NULL ) -return ERR_PTR (-ENOMEM ); - - gfpmask |=mapping_gfp_mask (mapping); - -for (i =0 ; i < npages; i++) { - p =shmem_read_mapping_page_gfp (mapping, i, gfpmask); -if (IS_ERR (p)) - goto fail; - pages[i] = p; - -/* There is a hypothetical issue w/ drivers that require -* buffer memory in the low 4GB.. if the pages are un- -* pinned, and swapped out, they can end up swapped back -* in above 4GB. If pages are already in memory, then -* shmem_read_mapping_page_gfp will ignore the gfpmask, -* even if the already in-memory page disobeys the mask. -* -* It is only a theoretical issue today, because none of -* the devices with this limitation can be populated with -* enough memory to trigger the issue. But this BUG_ON() -* is here as a reminder in case the problem with -* shmem_read_mapping_page_gfp() isn't solved by the time -* it does become a real issue. -* -* See this thread: http://lkml.org/lkml/2011/7/11/238 -*/ -BUG_ON ((gfpmask & __GFP_DMA32) && - (page_to_pfn (p) >=0x00100000UL )); - } - -return pages; - -fail: -while (i--) -page_cache_release (pages[i]); - -drm_free_large (pages); -return ERR_CAST (p); -} - -/** -* drm_gem_put_pages - helper to free backing pages for a GEM object -* @obj: obj in question -* @pages: pages to free -*/ -void _drm_gem_put_pages (struct drm_gem_object *obj,struct page **pages, -bool dirty,bool accessed) -{ -int i, npages; - - npages = obj->size >>PAGE_SHIFT ; - -for (i =0 ; i < npages; i++) { -if (dirty) -set_page_dirty (pages[i]); - -if (accessed) -mark_page_accessed (pages[i]); - -/* Undo the reference we took when populating the table */ -page_cache_release (pages[i]); - } - -drm_free_large (pages); -} - -int -_drm_gem_create_mmap_offset_size (struct drm_gem_object *obj,size_t size) -{ -struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; - -return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, - size /PAGE_SIZE ); -}Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch