DRM: Core Cleanups
Subsystems (21)
cover DRM: Core Cleanups
Hi
More cleanups of DRM core code. Diffstat says:
72 files changed, 832 insertions(+), 1038 deletions(-)
..which is already nice, but doesn't reflect that a lot of code is now hidden from main headers. Furthermore, with this series applied, drmP.h no longer looks as ugly as it is now (widly unstructured). It still ain't a beauty, though:
include/drm/drmP.h | 236 ++++++++-----------------------
Anyhow, highlights:
- drop "drm_memory.h"
- drop "drm_usb.c"
- drop "struct drm_waitlist"
- drop "struct drm_sigdata"
- drop "struct drm_bus"
- drop "drm_master->unique_size"
Two patches are driver related:
- radeon: Patch #1, moves drm_buffer.c to radeon/
- nouveau: Patch #17, splits drm_driver for nouveau
They're rather trivial. Everything else is DRM-core.
I've moved some legacy stuff around so it's easier to drop it once unused. If someone disagrees with move, let me know and I'll drop the patch.
I've pushed this to the 0-day testing bots now. I'll comment on the patches in case something shows up.
Comments welcome!
David
David Herrmann (20):
drm/radeon: move drm_buffer to drm/radeon/
drm: mark drm_buf and drm_map as legacy
drm: move "struct drm_vma_entry" to drm_vm.c
drm: move "struct drm_magic_entry" to drm_auth.c
drm: drop unused "struct drm_waitlist"
drm: move AGP definitions harder
drm: replace weird conditional includes
drm: drop __KERNEL__ protection in drmP.h
drm: merge drm_memory.h into drm_memory.c
drm: move __OS_HAS_AGP into drm_agpsupport.h
drm: order includes alphabetically in drmP.h
drm: drop DRM_DEBUG_CODE
drm: inline "struct drm_sigdata"
drm: move remaining includes in drmP.h to the top
drm: simplify drm_*_set_unique()
drm: drop unused drm_master->unique_size
drm: add driver->set_busid() callback
drm: Goody bye, drm_bus!
drm: merge drm_usb into udl
drm: move drm-lock API to drm_legacy.h
Documentation/DocBook/drm.tmpl | 3 +- drivers/gpu/drm/Kconfig | 6 - drivers/gpu/drm/Makefile | 5 +- drivers/gpu/drm/armada/armada_drv.c | 1 + drivers/gpu/drm/ast/ast_drv.c | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 1 + drivers/gpu/drm/drm_agpsupport.c | 1 + drivers/gpu/drm/drm_auth.c | 6 + drivers/gpu/drm/drm_buffer.c | 181 ------------------------ drivers/gpu/drm/drm_bufs.c | 89 ++++++------ drivers/gpu/drm/drm_debugfs.c | 2 - drivers/gpu/drm/drm_drv.c | 11 +- drivers/gpu/drm/drm_fops.c | 16 +-- drivers/gpu/drm/drm_info.c | 59 -------- drivers/gpu/drm/drm_ioctl.c | 27 ++-- drivers/gpu/drm/drm_legacy.h | 39 +++++ drivers/gpu/drm/drm_lock.c | 35 ++--- drivers/gpu/drm/drm_memory.c | 12 ++ drivers/gpu/drm/drm_pci.c | 41 ++---- drivers/gpu/drm/drm_platform.c | 38 ++--- drivers/gpu/drm/drm_usb.c | 88 ------------ drivers/gpu/drm/drm_vm.c | 74 ++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/i810/i810_dma.c | 4 +- drivers/gpu/drm/i810/i810_drv.c | 1 + drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/mga/mga_dma.c | 49 +++---- drivers/gpu/drm/mga/mga_drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 19 ++- drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/qxl/qxl_drv.c | 1 + drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/r128/r128_drv.c | 1 + drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/drm_buffer.c | 177 +++++++++++++++++++++++ drivers/gpu/drm/radeon/drm_buffer.h | 148 +++++++++++++++++++ drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/gpu/drm/radeon/r600_cp.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 17 ++- drivers/gpu/drm/radeon/radeon_cp.c | 22 +-- drivers/gpu/drm/radeon/radeon_drv.c | 2 + drivers/gpu/drm/radeon/radeon_ring.c | 21 --- drivers/gpu/drm/radeon/radeon_state.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 + drivers/gpu/drm/savage/savage_bci.c | 23 +-- drivers/gpu/drm/savage/savage_drv.c | 1 + drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 + drivers/gpu/drm/sis/sis_drv.c | 1 + drivers/gpu/drm/sis/sis_mm.c | 6 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 + drivers/gpu/drm/udl/Kconfig | 3 +- drivers/gpu/drm/udl/udl_connector.c | 4 +- drivers/gpu/drm/udl/udl_drv.c | 102 +++++++------ drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 8 +- drivers/gpu/drm/via/via_drv.c | 1 + drivers/gpu/drm/via/via_map.c | 2 +- drivers/gpu/drm/via/via_mm.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + drivers/staging/imx-drm/imx-drm-core.c | 1 + include/drm/drmP.h | 236 ++++++++----------------------- include/drm/drm_agpsupport.h | 26 +++- include/drm/drm_buffer.h | 148 ------------------- include/drm/drm_crtc.h | 4 +- include/drm/drm_memory.h | 59 -------- include/drm/drm_usb.h | 15 -- 72 files changed, 832 insertions(+), 1038 deletions(-) delete mode 100644 drivers/gpu/drm/drm_buffer.c delete mode 100644 drivers/gpu/drm/drm_usb.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.h delete mode 100644 include/drm/drm_buffer.h delete mode 100644 include/drm/drm_memory.h delete mode 100644 include/drm/drm_usb.h
Signature · 1 line
2.1.0
PATCH 1/20 drm/radeon: move drm_buffer to drm/radeon/
Radeon UMS is the last user of drm_buffer. Move it out of sight so radeon can drop it together with UMS.
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_buffer.c | 181 ---------------------------------- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/drm_buffer.c | 177 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/drm_buffer.h | 148 +++++++++++++++++++++++++++ drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 2 +- include/drm/drm_buffer.h | 148 --------------------------- 8 files changed, 329 insertions(+), 333 deletions(-) delete mode 100644 drivers/gpu/drm/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.h delete mode 100644 include/drm/drm_buffer.h
drivers/gpu/drm/Makefile +1 -1
@@ -4,7 +4,7 @@ ccflags-y := -Iinclude/drm -drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ +drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
drivers/gpu/drm/drm_buffer.c deleted +0 -181
181 lines not on this page · raw message
drivers/gpu/drm/radeon/Makefile +1 -1
@@ -60,7 +60,7 @@ radeon-y := radeon_drv.o # add UMS driver radeon-$(CONFIG_DRM_RADEON_UMS)+= radeon_cp.o radeon_state.o radeon_mem.o \ - radeon_irq.o r300_cmdbuf.o r600_cp.o r600_blit.o + radeon_irq.o r300_cmdbuf.o r600_cp.o r600_blit.o drm_buffer.o # add KMS driver radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \
drivers/gpu/drm/radeon/drm_buffer.c new file +177 -0
177 lines not on this page · raw message
drivers/gpu/drm/radeon/drm_buffer.h new file +148 -0
148 lines not on this page · raw message
drivers/gpu/drm/radeon/r300_cmdbuf.c +1 -1
@@ -34,10 +34,10 @@*/ #include <drm/drmP.h> -#include <drm/drm_buffer.h> #include <drm/radeon_drm.h> #include "radeon_drv.h" #include "r300_reg.h" +#include "drm_buffer.h" #include <asm/unaligned.h>
drivers/gpu/drm/radeon/radeon_state.c +1 -1
@@ -30,9 +30,9 @@*/ #include <drm/drmP.h> -#include <drm/drm_buffer.h> #include <drm/radeon_drm.h> #include "radeon_drv.h" +#include "drm_buffer.h" /* ================================================================ * Helper functions for client state checking and fixup
include/drm/drm_buffer.h deleted +0 -148
148 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 01/20] drm/radeon: move drm_buffer to drm/radeon/
Quoted 4 lines · David Herrmann
Radeon UMS is the last user of
drm_buffer. Move it out of sight so radeon can drop it together with UMS.Signed-off-by David Herrmann <[email protected]>
Quoted 14 lines
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_buffer.c | 181 ---------------------------------- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/drm_buffer.c | 177 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/drm_buffer.h | 148 +++++++++++++++++++++++++++ drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 2 +- include/drm/drm_buffer.h | 148 --------------------------- 8 files changed, 329 insertions(+), 333 deletions(-) delete mode 100644 drivers/gpu/drm/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.h delete mode 100644 include/drm/drm_buffer.h
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/20] drm/radeon: move drm_buffer to drm/radeon/
In reply to David HerrmannQuoted 4 lines · David Herrmann
Radeon UMS is the last user of
drm_buffer. Move it out of sight so radeon can drop it together with UMS.Signed-off-by David Herrmann <[email protected]>
We can probably dump radeon UMS support as well at this point.
Alex
Quoted 753 lines
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_buffer.c | 181 ---------------------------------- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/drm_buffer.c | 177 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/drm_buffer.h | 148 +++++++++++++++++++++++++++ drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 2 +- include/drm/drm_buffer.h | 148 --------------------------- 8 files changed, 329 insertions(+), 333 deletions(-) delete mode 100644 drivers/gpu/drm/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.h delete mode 100644 include/drm/drm_buffer.hdrivers/gpu/drm/Makefile +1
-1@@ -4,7 +4,7 @@ ccflags-y := -Iinclude/drm -drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ +drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o drm_vm.o \drivers/gpu/drm/drm_buffer.c deleted +0
-181@@ -1,181 +0,0 @@ -/************************************************************************** -* -* Copyright 2010 Pauli Nieminen. -* All Rights Reserved. -* -* 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL -* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. -* -* -**************************************************************************/ -/* -* Multipart buffer for coping data which is larger than the page size. -* -* Authors: -* Pauli Nieminen <suokkos-at-gmail-dot-com> -*/ - -#include <linux/export.h> -#include <drm/drm_buffer.h> - -/** -* Allocate the drm buffer object. -* -* buf: Pointer to a pointer where the object is stored. -* size: The number of bytes to allocate. -*/ -int drm_buffer_alloc (struct drm_buffer **buf,int size) -{ -int nr_pages = size /PAGE_SIZE +1 ; -int idx; - -/* Allocating pointer table to end of structure makes drm_buffer -* variable sized */ - *buf =kzalloc (sizeof (struct drm_buffer ) + nr_pages*sizeof (char *), -GFP_KERNEL ); - -if (*buf ==NULL ) { -DRM_ERROR ("Failed to allocate drm buffer object to hold" -" %d bytes in %d pages.\n" , - size, nr_pages); -return -ENOMEM ; - } - - (*buf)->size = size; - -for (idx =0 ; idx < nr_pages; ++idx) { - - (*buf)->data[idx] = -kmalloc (min (PAGE_SIZE , size - idx *PAGE_SIZE ), -GFP_KERNEL ); - - -if ((*buf)->data[idx] ==NULL ) { -DRM_ERROR ("Failed to allocate %dth page for drm" -" buffer with %d bytes and %d pages.\n" , - idx +1 , size, nr_pages); - goto error_out; - } - - } - -return 0 ; - -error_out: - -for (; idx >=0 ; --idx) -kfree ((*buf)->data[idx]); - -kfree (*buf); -return -ENOMEM ; -} -EXPORT_SYMBOL (drm_buffer_alloc); - -/** -* Copy the user data to the begin of the buffer and reset the processing -* iterator. -* -* user_data: A pointer the data that is copied to the buffer. -* size: The Number of bytes to copy. -*/ -int drm_buffer_copy_from_user (struct drm_buffer *buf, -void __user *user_data,int size) -{ -int nr_pages = size /PAGE_SIZE +1 ; -int idx; - -if (size > buf->size) { -DRM_ERROR ("Requesting to copy %d bytes to a drm buffer with" -" %d bytes space\n" , - size, buf->size); -return -EFAULT ; - } - -for (idx =0 ; idx < nr_pages; ++idx) { - -if (copy_from_user (buf->data[idx], - user_data + idx *PAGE_SIZE , -min (PAGE_SIZE , size - idx *PAGE_SIZE ))) { -DRM_ERROR ("Failed to copy user data (%p) to drm buffer" -" (%p) %dth page.\n" , - user_data, buf, idx); -return -EFAULT ; - - } - } - buf->iterator =0 ; -return 0 ; -} -EXPORT_SYMBOL (drm_buffer_copy_from_user); - -/** -* Free the drm buffer object -*/ -void drm_buffer_free (struct drm_buffer *buf) -{ - -if (buf !=NULL ) { - -int nr_pages = buf->size /PAGE_SIZE +1 ; -int idx; -for (idx =0 ; idx < nr_pages; ++idx) -kfree (buf->data[idx]); - -kfree (buf); - } -} -EXPORT_SYMBOL (drm_buffer_free); - -/** -* Read an object from buffer that may be split to multiple parts. If object -* is not split function just returns the pointer to object in buffer. But in -* case of split object data is copied to given stack object that is suplied -* by caller. -* -* The processing location of the buffer is also advanced to the next byte -* after the object. -* -* objsize: The size of the objet in bytes. -* stack_obj: A pointer to a memory location where object can be copied. -*/ -void *drm_buffer_read_object (struct drm_buffer *buf, -int objsize,void *stack_obj) -{ -int idx =drm_buffer_index (buf); -int page =drm_buffer_page (buf); -void *obj =NULL ; - -if (idx + objsize <=PAGE_SIZE ) { - obj = &buf->data[page][idx]; - }else { -/* The object is split which forces copy to temporary object.*/ -int beginsz =PAGE_SIZE - idx; -memcpy (stack_obj, &buf->data[page][idx], beginsz); - -memcpy (stack_obj + beginsz, &buf->data[page +1 ][0 ], - objsize - beginsz); - - obj = stack_obj; - } - -drm_buffer_advance (buf, objsize); -return obj; -} -EXPORT_SYMBOL (drm_buffer_read_object);drivers/gpu/drm/radeon/Makefile +1
-1@@ -60,7 +60,7 @@ radeon-y := radeon_drv.o # add UMS driver radeon-$(CONFIG_DRM_RADEON_UMS)+= radeon_cp.o radeon_state.o radeon_mem.o \ - radeon_irq.o r300_cmdbuf.o r600_cp.o r600_blit.o + radeon_irq.o r300_cmdbuf.o r600_cp.o r600_blit.o drm_buffer.o # add KMS driver radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \drivers/gpu/drm/radeon/drm_buffer.c new file +177
-0@@ -0,0 +1,177 @@ +/************************************************************************** +* +* Copyright 2010 Pauli Nieminen. +* All Rights Reserved. +* +* 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. +* +* +**************************************************************************/ +/* +* Multipart buffer for coping data which is larger than the page size. +* +* Authors: +* Pauli Nieminen <suokkos-at-gmail-dot-com> +*/ + +#include <linux/export.h> +#include "drm_buffer.h" + +/** +* Allocate the drm buffer object. +* +* buf: Pointer to a pointer where the object is stored. +* size: The number of bytes to allocate. +*/ +int drm_buffer_alloc (struct drm_buffer **buf,int size) +{ +int nr_pages = size /PAGE_SIZE +1 ; +int idx; + +/* Allocating pointer table to end of structure makes drm_buffer +* variable sized */ + *buf =kzalloc (sizeof (struct drm_buffer ) + nr_pages*sizeof (char *), +GFP_KERNEL ); + +if (*buf ==NULL ) { +DRM_ERROR ("Failed to allocate drm buffer object to hold" +" %d bytes in %d pages.\n" , + size, nr_pages); +return -ENOMEM ; + } + + (*buf)->size = size; + +for (idx =0 ; idx < nr_pages; ++idx) { + + (*buf)->data[idx] = +kmalloc (min (PAGE_SIZE , size - idx *PAGE_SIZE ), +GFP_KERNEL ); + + +if ((*buf)->data[idx] ==NULL ) { +DRM_ERROR ("Failed to allocate %dth page for drm" +" buffer with %d bytes and %d pages.\n" , + idx +1 , size, nr_pages); + goto error_out; + } + + } + +return 0 ; + +error_out: + +for (; idx >=0 ; --idx) +kfree ((*buf)->data[idx]); + +kfree (*buf); +return -ENOMEM ; +} + +/** +* Copy the user data to the begin of the buffer and reset the processing +* iterator. +* +* user_data: A pointer the data that is copied to the buffer. +* size: The Number of bytes to copy. +*/ +int drm_buffer_copy_from_user (struct drm_buffer *buf, +void __user *user_data,int size) +{ +int nr_pages = size /PAGE_SIZE +1 ; +int idx; + +if (size > buf->size) { +DRM_ERROR ("Requesting to copy %d bytes to a drm buffer with" +" %d bytes space\n" , + size, buf->size); +return -EFAULT ; + } + +for (idx =0 ; idx < nr_pages; ++idx) { + +if (copy_from_user (buf->data[idx], + user_data + idx *PAGE_SIZE , +min (PAGE_SIZE , size - idx *PAGE_SIZE ))) { +DRM_ERROR ("Failed to copy user data (%p) to drm buffer" +" (%p) %dth page.\n" , + user_data, buf, idx); +return -EFAULT ; + + } + } + buf->iterator =0 ; +return 0 ; +} + +/** +* Free the drm buffer object +*/ +void drm_buffer_free (struct drm_buffer *buf) +{ + +if (buf !=NULL ) { + +int nr_pages = buf->size /PAGE_SIZE +1 ; +int idx; +for (idx =0 ; idx < nr_pages; ++idx) +kfree (buf->data[idx]); + +kfree (buf); + } +} + +/** +* Read an object from buffer that may be split to multiple parts. If object +* is not split function just returns the pointer to object in buffer. But in +* case of split object data is copied to given stack object that is suplied +* by caller. +* +* The processing location of the buffer is also advanced to the next byte +* after the object. +* +* objsize: The size of the objet in bytes. +* stack_obj: A pointer to a memory location where object can be copied. +*/ +void *drm_buffer_read_object (struct drm_buffer *buf, +int objsize,void *stack_obj) +{ +int idx =drm_buffer_index (buf); +int page =drm_buffer_page (buf); +void *obj =NULL ; + +if (idx + objsize <=PAGE_SIZE ) { + obj = &buf->data[page][idx]; + }else { +/* The object is split which forces copy to temporary object.*/ +int beginsz =PAGE_SIZE - idx; +memcpy (stack_obj, &buf->data[page][idx], beginsz); + +memcpy (stack_obj + beginsz, &buf->data[page +1 ][0 ], + objsize - beginsz); + + obj = stack_obj; + } + +drm_buffer_advance (buf, objsize); +return obj; +}drivers/gpu/drm/radeon/drm_buffer.h new file +148
-0@@ -0,0 +1,148 @@ +/************************************************************************** +* +* Copyright 2010 Pauli Nieminen. +* All Rights Reserved. +* +* 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. +* +* +**************************************************************************/ +/* +* Multipart buffer for coping data which is larger than the page size. +* +* Authors: +* Pauli Nieminen <suokkos-at-gmail-dot-com> +*/ + +#ifndef _DRM_BUFFER_H_ +#define _DRM_BUFFER_H_ + +#include <drm/drmP.h> + +struct drm_buffer { +int iterator; +int size; +char *data[]; +}; + + +/** +* Return the index of page that buffer is currently pointing at. +*/ +static inline int drm_buffer_page (struct drm_buffer *buf) +{ +return buf->iterator /PAGE_SIZE ; +} +/** +* Return the index of the current byte in the page +*/ +static inline int drm_buffer_index (struct drm_buffer *buf) +{ +return buf->iterator & (PAGE_SIZE -1 ); +} +/** +* Return number of bytes that is left to process +*/ +static inline int drm_buffer_unprocessed (struct drm_buffer *buf) +{ +return buf->size - buf->iterator; +} + +/** +* Advance the buffer iterator number of bytes that is given. +*/ +static inline void drm_buffer_advance (struct drm_buffer *buf,int bytes) +{ + buf->iterator += bytes; +} + +/** +* Allocate the drm buffer object. +* +* buf: A pointer to a pointer where the object is stored. +* size: The number of bytes to allocate. +*/ +extern int drm_buffer_alloc (struct drm_buffer **buf,int size); + +/** +* Copy the user data to the begin of the buffer and reset the processing +* iterator. +* +* user_data: A pointer the data that is copied to the buffer. +* size: The Number of bytes to copy. +*/ +extern int drm_buffer_copy_from_user (struct drm_buffer *buf, +void __user *user_data,int size); + +/** +* Free the drm buffer object +*/ +extern void drm_buffer_free (struct drm_buffer *buf); + +/** +* Read an object from buffer that may be split to multiple parts. If object +* is not split function just returns the pointer to object in buffer. But in +* case of split object data is copied to given stack object that is suplied +* by caller. +* +* The processing location of the buffer is also advanced to the next byte +* after the object. +* +* objsize: The size of the objet in bytes. +* stack_obj: A pointer to a memory location where object can be copied. +*/ +extern void *drm_buffer_read_object (struct drm_buffer *buf, +int objsize,void *stack_obj); + +/** +* Returns the pointer to the dword which is offset number of elements from the +* current processing location. +* +* Caller must make sure that dword is not split in the buffer. This +* requirement is easily met if all the sizes of objects in buffer are +* multiples of dword and PAGE_SIZE is multiple dword. +* +* Call to this function doesn't change the processing location. +* +* offset: The index of the dword relative to the internat iterator. +*/ +static inline void *drm_buffer_pointer_to_dword (struct drm_buffer *buffer, +int offset) +{ +int iter = buffer->iterator + offset *4 ; +return &buffer->data[iter /PAGE_SIZE ][iter & (PAGE_SIZE -1 )]; +} +/** +* Returns the pointer to the dword which is offset number of elements from +* the current processing location. +* +* Call to this function doesn't change the processing location. +* +* offset: The index of the byte relative to the internat iterator. +*/ +static inline void *drm_buffer_pointer_to_byte (struct drm_buffer *buffer, +int offset) +{ +int iter = buffer->iterator + offset; +return &buffer->data[iter /PAGE_SIZE ][iter & (PAGE_SIZE -1 )]; +} + +#endif drivers/gpu/drm/radeon/r300_cmdbuf.c +1
-1@@ -34,10 +34,10 @@*/ #include <drm/drmP.h> -#include <drm/drm_buffer.h> #include <drm/radeon_drm.h> #include "radeon_drv.h" #include "r300_reg.h" +#include "drm_buffer.h" #include <asm/unaligned.h> drivers/gpu/drm/radeon/radeon_state.c +1
-1@@ -30,9 +30,9 @@*/ #include <drm/drmP.h> -#include <drm/drm_buffer.h> #include <drm/radeon_drm.h> #include "radeon_drv.h" +#include "drm_buffer.h" /* ================================================================ * Helper functions for client state checking and fixup include/drm/drm_buffer.h deleted +0
-149@@ -1,148 +0,0 @@ -/************************************************************************** -* -* Copyright 2010 Pauli Nieminen. -* All Rights Reserved. -* -* 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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL -* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. -* -* -**************************************************************************/ -/* -* Multipart buffer for coping data which is larger than the page size. -* -* Authors: -* Pauli Nieminen <suokkos-at-gmail-dot-com> -*/ - -#ifndef _DRM_BUFFER_H_ -#define _DRM_BUFFER_H_ - -#include <drm/drmP.h> - -struct drm_buffer { -int iterator; -int size; -char *data[]; -}; - - -/** -* Return the index of page that buffer is currently pointing at. -*/ -static inline int drm_buffer_page (struct drm_buffer *buf) -{ -return buf->iterator /PAGE_SIZE ; -} -/** -* Return the index of the current byte in the page -*/ -static inline int drm_buffer_index (struct drm_buffer *buf) -{ -return buf->iterator & (PAGE_SIZE -1 ); -} -/** -* Return number of bytes that is left to process -*/ -static inline int drm_buffer_unprocessed (struct drm_buffer *buf) -{ -return buf->size - buf->iterator; -} - -/** -* Advance the buffer iterator number of bytes that is given. -*/ -static inline void drm_buffer_advance (struct drm_buffer *buf,int bytes) -{ - buf->iterator += bytes; -} - -/** -* Allocate the drm buffer object. -* -* buf: A pointer to a pointer where the object is stored. -* size: The number of bytes to allocate. -*/ -extern int drm_buffer_alloc (struct drm_buffer **buf,int size); - -/** -* Copy the user data to the begin of the buffer and reset the processing -* iterator. -* -* user_data: A pointer the data that is copied to the buffer. -* size: The Number of bytes to copy. -*/ -extern int drm_buffer_copy_from_user (struct drm_buffer *buf, -void __user *user_data,int size); - -/** -* Free the drm buffer object -*/ -extern void drm_buffer_free (struct drm_buffer *buf); - -/** -* Read an object from buffer that may be split to multiple parts. If object -* is not split function just returns the pointer to object in buffer. But in -* case of split object data is copied to given stack object that is suplied -* by caller. -* -* The processing location of the buffer is also advanced to the next byte -* after the object. -* -* objsize: The size of the objet in bytes. -* stack_obj: A pointer to a memory location where object can be copied. -*/ -extern void *drm_buffer_read_object (struct drm_buffer *buf, -int objsize,void *stack_obj); - -/** -* Returns the pointer to the dword which is offset number of elements from the -* current processing location. -* -* Caller must make sure that dword is not split in the buffer. This -* requirement is easily met if all the sizes of objects in buffer are -* multiples of dword and PAGE_SIZE is multiple dword. -* -* Call to this function doesn't change the processing location. -* -* offset: The index of the dword relative to the internat iterator. -*/ -static inline void *drm_buffer_pointer_to_dword (struct drm_buffer *buffer, -int offset) -{ -int iter = buffer->iterator + offset *4 ; -return &buffer->data[iter /PAGE_SIZE ][iter & (PAGE_SIZE -1 )]; -} -/** -* Returns the pointer to the dword which is offset number of elements from -* the current processing location. -* -* Call to this function doesn't change the processing location. -* -* offset: The index of the byte relative to the internat iterator. -*/ -static inline void *drm_buffer_pointer_to_byte (struct drm_buffer *buffer, -int offset) -{ -int iter = buffer->iterator + offset; -return &buffer->data[iter /PAGE_SIZE ][iter & (PAGE_SIZE -1 )]; -} - -#endif --2.1.0
PATCH 2/20 drm: mark drm_buf and drm_map as legacy
In reply to David HerrmannMove internal declarations to drm_legacy.h and add drm_legacy_*() prefix to all legacy functions.
--- drivers/gpu/drm/drm_bufs.c | 89 ++++++++++++++++++------------------- drivers/gpu/drm/drm_drv.c | 4 +- drivers/gpu/drm/drm_ioctl.c | 16 +++---- drivers/gpu/drm/drm_legacy.h | 15 +++++++ drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/mga/mga_dma.c | 49 ++++++++++---------- drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/radeon/r600_cp.c | 2 +- drivers/gpu/drm/radeon/radeon_cp.c | 22 ++++----- drivers/gpu/drm/savage/savage_bci.c | 19 ++++---- drivers/gpu/drm/via/via_map.c | 2 +- include/drm/drmP.h | 41 +++++------------ 12 files changed, 131 insertions(+), 132 deletions(-)
drivers/gpu/drm/drm_bufs.c +44 -45
@@ -1,18 +1,13 @@ -/** -* \file drm_bufs.c -* Generic buffer template -* -* \author Rickard E. (Rik) Faith <[email protected]> -* \author Gareth Hughes <[email protected]> -*/ -/* -* Created: Thu Nov 23 03:10:50 2000 by [email protected] +* Legacy: Generic DRM Buffer Management * * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * +* Author: Rickard E. (Rik) Faith <[email protected]> +* Author: Gareth Hughes <[email protected]> +* * 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
@@ -39,6 +34,7 @@#include <linux/export.h> #include <asm/shmparam.h> #include <drm/drmP.h> +#include "drm_legacy.h" static struct drm_map_list *drm_find_matching_map (struct drm_device *dev,struct drm_local_map *map)
@@ -365,9 +361,9 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,return 0 ; } -int drm_addmap (struct drm_device * dev,resource_size_t offset, -unsigned int size,enum drm_map_type type, -enum drm_map_flags flags,struct drm_local_map ** map_ptr) +int drm_legacy_addmap (struct drm_device * dev,resource_size_t offset, +unsigned int size,enum drm_map_type type, +enum drm_map_flags flags,struct drm_local_map **map_ptr) {struct drm_map_list *list;int rc;
@@ -378,7 +374,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset,return rc; } -EXPORT_SYMBOL (drm_addmap); +EXPORT_SYMBOL (drm_legacy_addmap);/** * Ioctl to specify a range of memory that is available for mapping by a
@@ -391,8 +387,8 @@ EXPORT_SYMBOL(drm_addmap);* \return zero on success or a negative value on error. * */ -int drm_addmap_ioctl (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_addmap_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_map *map = data;struct drm_map_list *maplist;
@@ -429,9 +425,9 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data,* its being used, and free any associate resource (such as MTRR's) if it's not * being on use. * -* \sa drm_addmap +* \sa drm_legacy_addmap */ -int drm_rmmap_locked (struct drm_device *dev,struct drm_local_map *map) +int drm_legacy_rmmap_locked (struct drm_device *dev,struct drm_local_map *map) {struct drm_map_list *r_list =NULL , *list_t;drm_dma_handle_t dmah;
@@ -485,19 +481,19 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)return 0 ; } -EXPORT_SYMBOL (drm_rmmap_locked); +EXPORT_SYMBOL (drm_legacy_rmmap_locked); -int drm_rmmap (struct drm_device *dev,struct drm_local_map *map) +int drm_legacy_rmmap (struct drm_device *dev,struct drm_local_map *map) {int ret;mutex_lock (&dev->struct_mutex); - ret =drm_rmmap_locked (dev, map); + ret =drm_legacy_rmmap_locked (dev, map);mutex_unlock (&dev->struct_mutex);return ret; } -EXPORT_SYMBOL (drm_rmmap); +EXPORT_SYMBOL (drm_legacy_rmmap);/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on * the last close of the device, and this is necessary for cleanup when things
@@ -514,8 +510,8 @@ EXPORT_SYMBOL(drm_rmmap);* \param arg pointer to a struct drm_map structure. * \return zero on success or a negative value on error. */ -int drm_rmmap_ioctl (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_rmmap_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_map *request = data;struct drm_local_map *map =NULL ;
@@ -546,7 +542,7 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data,return 0 ; } - ret =drm_rmmap_locked (dev, map); + ret =drm_legacy_rmmap_locked (dev, map);mutex_unlock (&dev->struct_mutex);
@@ -599,7 +595,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev,* reallocates the buffer list of the same size order to accommodate the new * buffers. */ -int drm_addbufs_agp (struct drm_device * dev,struct drm_buf_desc * request) +int drm_legacy_addbufs_agp (struct drm_device *dev, +struct drm_buf_desc *request) {struct drm_device_dma *dma = dev->dma;struct drm_buf_entry *entry;
@@ -759,10 +756,11 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)atomic_dec (&dev->buf_alloc); return 0; } -EXPORT_SYMBOL (drm_addbufs_agp); +EXPORT_SYMBOL (drm_legacy_addbufs_agp);#endif /* __OS_HAS_AGP */ -int drm_addbufs_pci (struct drm_device * dev,struct drm_buf_desc * request) +int drm_legacy_addbufs_pci (struct drm_device *dev, +struct drm_buf_desc *request) {struct drm_device_dma *dma = dev->dma;int count;
@@ -964,9 +962,10 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)return 0 ; } -EXPORT_SYMBOL (drm_addbufs_pci); +EXPORT_SYMBOL (drm_legacy_addbufs_pci); -static int drm_addbufs_sg (struct drm_device * dev,struct drm_buf_desc * request) +static int drm_legacy_addbufs_sg (struct drm_device *dev, +struct drm_buf_desc *request) {struct drm_device_dma *dma = dev->dma;struct drm_buf_entry *entry;
@@ -1135,8 +1134,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request* addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent * PCI memory respectively. */ -int drm_addbufs (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_addbufs (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_buf_desc *request = data;int ret;
@@ -1149,15 +1148,15 @@ int drm_addbufs(struct drm_device *dev, void *data,#if __OS_HAS_AGPif (request->flags & _DRM_AGP_BUFFER) - ret =drm_addbufs_agp (dev, request); + ret =drm_legacy_addbufs_agp (dev, request); else#endif if (request->flags & _DRM_SG_BUFFER) - ret =drm_addbufs_sg (dev, request); + ret =drm_legacy_addbufs_sg (dev, request);else if (request->flags & _DRM_FB_BUFFER) ret = -EINVAL ;else - ret =drm_addbufs_pci (dev, request); + ret =drm_legacy_addbufs_pci (dev, request);return ret; }
@@ -1179,8 +1178,8 @@ int drm_addbufs(struct drm_device *dev, void *data,* lock, preventing of allocating more buffers after this call. Information * about each requested buffer is then copied into user space. */ -int drm_infobufs (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_infobufs (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_device_dma *dma = dev->dma;struct drm_buf_info *request = data;
@@ -1260,8 +1259,8 @@ int drm_infobufs(struct drm_device *dev, void *data,* * \note This ioctl is deprecated and mostly never used. */ -int drm_markbufs (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_markbufs (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_device_dma *dma = dev->dma;struct drm_buf_desc *request = data;
@@ -1307,8 +1306,8 @@ int drm_markbufs(struct drm_device *dev, void *data,* Calls free_buffer() for each used buffer. * This function is primarily used for debugging. */ -int drm_freebufs (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_freebufs (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_device_dma *dma = dev->dma;struct drm_buf_free *request = data;
@@ -1360,8 +1359,8 @@ int drm_freebufs(struct drm_device *dev, void *data,* offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls * drm_mmap_dma(). */ -int drm_mapbufs (struct drm_device *dev,void *data, -struct drm_file *file_priv) +int drm_legacy_mapbufs (struct drm_device *dev,void *data, +struct drm_file *file_priv) {struct drm_device_dma *dma = dev->dma;int retcode =0 ;
@@ -1448,7 +1447,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,return retcode; } -int drm_dma_ioctl (struct drm_device *dev,void *data, +int drm_legacy_dma_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) {if (drm_core_check_feature (dev,DRIVER_MODESET ))
@@ -1460,7 +1459,7 @@ int drm_dma_ioctl(struct drm_device *dev, void *data,return -EINVAL ; } -struct drm_local_map *drm_getsarea (struct drm_device *dev) +struct drm_local_map *drm_legacy_getsarea (struct drm_device *dev) {struct drm_map_list *entry;
@@ -1472,4 +1471,4 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev) }return NULL ; } -EXPORT_SYMBOL (drm_getsarea); +EXPORT_SYMBOL (drm_legacy_getsarea);
drivers/gpu/drm/drm_drv.c +2 -2
@@ -143,7 +143,7 @@ static void drm_master_destroy(struct kref *kref)list_for_each_entry_safe (r_list, list_temp, &dev->maplist, head) {if (r_list->master == master) { -drm_rmmap_locked (dev, r_list->map); +drm_legacy_rmmap_locked (dev, r_list->map); r_list =NULL ; } }
@@ -779,7 +779,7 @@ void drm_dev_unregister(struct drm_device *dev)drm_vblank_cleanup (dev);list_for_each_entry_safe (r_list, list_temp, &dev->maplist, head) -drm_rmmap (dev, r_list->map); +drm_legacy_rmmap (dev, r_list->map);drm_minor_unregister (dev,DRM_MINOR_LEGACY );drm_minor_unregister (dev,DRM_MINOR_RENDER );
drivers/gpu/drm/drm_ioctl.c +8 -8
@@ -62,8 +62,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_UNBLOCK , drm_noop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF (DRM_IOCTL_AUTH_MAGIC , drm_authmagic,DRM_AUTH |DRM_MASTER ), -DRM_IOCTL_DEF (DRM_IOCTL_ADD_MAP , drm_addmap_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_RM_MAP , drm_rmmap_ioctl,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_ADD_MAP , drm_legacy_addmap_ioctl,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_IOCTL_DEF (DRM_IOCTL_RM_MAP , drm_legacy_rmmap_ioctl,DRM_AUTH ),DRM_IOCTL_DEF (DRM_IOCTL_SET_SAREA_CTX , drm_legacy_setsareactx,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_legacy_getsareactx, DRM_AUTH),
@@ -87,12 +87,12 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_FINISH , drm_noop,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_ADD_BUFS , drm_addbufs,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_MARK_BUFS , drm_markbufs,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_INFO_BUFS , drm_infobufs,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_MAP_BUFS , drm_mapbufs,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_FREE_BUFS , drm_freebufs,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_DMA , drm_dma_ioctl,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_ADD_BUFS , drm_legacy_addbufs,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_IOCTL_DEF (DRM_IOCTL_MARK_BUFS , drm_legacy_markbufs,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), +DRM_IOCTL_DEF (DRM_IOCTL_INFO_BUFS , drm_legacy_infobufs,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_MAP_BUFS , drm_legacy_mapbufs,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_FREE_BUFS , drm_legacy_freebufs,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_DMA , drm_legacy_dma_ioctl,DRM_AUTH ), DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
drivers/gpu/drm/drm_legacy.h +15 -0
@@ -48,4 +48,19 @@ int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);int drm_legacy_setsareactx (struct drm_device *d,void *v,struct drm_file *f);int drm_legacy_getsareactx (struct drm_device *d,void *v,struct drm_file *f); +/* +* Generic Buffer Management +*/ + +#define DRM_MAP_HASH_OFFSET 0x10000000 + +int drm_legacy_addmap_ioctl (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_rmmap_ioctl (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_addbufs (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_infobufs (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_markbufs (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_freebufs (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_mapbufs (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_dma_ioctl (struct drm_device *d,void *v,struct drm_file *f); +#endif /* __DRM_LEGACY_H__ */
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -196,7 +196,7 @@ static int i915_initialize(struct drm_device *dev, drm_i915_init_t *init)struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;int ret; - master_priv->sarea =drm_getsarea (dev); + master_priv->sarea =drm_legacy_getsarea (dev);if (master_priv->sarea) { master_priv->sarea_priv = (drm_i915_sarea_t *) ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
drivers/gpu/drm/mga/mga_dma.c +25 -24
130 lines not on this page · raw message
drivers/gpu/drm/r128/r128_cce.c +1 -1
@@ -452,7 +452,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch /8 ) <<21 ) | (dev_priv->span_offset >>5 )); - dev_priv->sarea =drm_getsarea (dev); + dev_priv->sarea =drm_legacy_getsarea (dev);if (!dev_priv->sarea) {DRM_ERROR ("could not find sarea!\n" ); dev->dev_private = (void *)dev_priv;
drivers/gpu/drm/radeon/r600_cp.c +1 -1
@@ -2052,7 +2052,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, dev_priv->buffers_offset = init->buffers_offset; dev_priv->gart_textures_offset = init->gart_textures_offset; - master_priv->sarea =drm_getsarea (dev); + master_priv->sarea =drm_legacy_getsarea (dev);if (!master_priv->sarea) {DRM_ERROR ("could not find sarea!\n" );r600_do_cleanup_cp (dev);
drivers/gpu/drm/radeon/radeon_cp.c +11 -11
@@ -1298,7 +1298,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, dev_priv->buffers_offset = init->buffers_offset; dev_priv->gart_textures_offset = init->gart_textures_offset; - master_priv->sarea =drm_getsarea (dev); + master_priv->sarea =drm_legacy_getsarea (dev);if (!master_priv->sarea) {DRM_ERROR ("could not find sarea!\n" );radeon_do_cleanup_cp (dev);
@@ -2106,9 +2106,9 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)else dev_priv->flags |=RADEON_IS_PCI ; - ret =drm_addmap (dev,pci_resource_start (dev->pdev,2 ), -pci_resource_len (dev->pdev,2 ), _DRM_REGISTERS, - _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio); + ret =drm_legacy_addmap (dev,pci_resource_start (dev->pdev,2 ), +pci_resource_len (dev->pdev,2 ), _DRM_REGISTERS, + _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);if (ret !=0 )return ret;
@@ -2135,8 +2135,8 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)/* prebuild the SAREA */ sareapage = max_t(unsigned long, SAREA_MAX, PAGE_SIZE); - ret =drm_addmap (dev,0 , sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, - &master_priv->sarea); + ret =drm_legacy_addmap (dev,0 , sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, + &master_priv->sarea);if (ret) {DRM_ERROR ("SAREA setup failed\n" );kfree (master_priv);
@@ -2162,7 +2162,7 @@ void radeon_master_destroy(struct drm_device *dev, struct drm_master *master) master_priv->sarea_priv =NULL ;if (master_priv->sarea) -drm_rmmap_locked (dev, master_priv->sarea); +drm_legacy_rmmap_locked (dev, master_priv->sarea);kfree (master_priv);
@@ -2181,9 +2181,9 @@ int radeon_driver_firstopen(struct drm_device *dev) dev_priv->gart_info.table_size =RADEON_PCIGART_TABLE_SIZE ; dev_priv->fb_aper_offset =pci_resource_start (dev->pdev,0 ); - ret =drm_addmap (dev, dev_priv->fb_aper_offset, -pci_resource_len (dev->pdev,0 ), _DRM_FRAME_BUFFER, - _DRM_WRITE_COMBINING, &map); + ret =drm_legacy_addmap (dev, dev_priv->fb_aper_offset, +pci_resource_len (dev->pdev,0 ), + _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, &map);if (ret !=0 )return ret;
@@ -2196,7 +2196,7 @@ int radeon_driver_unload(struct drm_device *dev)DRM_DEBUG ("\n" ); -drm_rmmap (dev, dev_priv->mmio); +drm_legacy_rmmap (dev, dev_priv->mmio);kfree (dev_priv);
drivers/gpu/drm/savage/savage_bci.c +10 -9
@@ -556,7 +556,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)/* * Initialize mappings. On Savage4 and SavageIX the alignment * and size of the aperture is not suitable for automatic MTRR setup -* in drm_addmap. Therefore we add them manually before the maps are +* in drm_legacy_addmap. Therefore we add them manually before the maps are * initialized, and tear them down on last close. */ int savage_driver_firstopen (struct drm_device *dev)
@@ -624,19 +624,20 @@ int savage_driver_firstopen(struct drm_device *dev)/* Automatic MTRR setup will do the right thing. */ } - ret =drm_addmap (dev, mmio_base,SAVAGE_MMIO_SIZE , _DRM_REGISTERS, - _DRM_READ_ONLY, &dev_priv->mmio); + ret =drm_legacy_addmap (dev, mmio_base,SAVAGE_MMIO_SIZE , + _DRM_REGISTERS, _DRM_READ_ONLY, + &dev_priv->mmio);if (ret)return ret; - ret =drm_addmap (dev, fb_base, fb_size, _DRM_FRAME_BUFFER, - _DRM_WRITE_COMBINING, &dev_priv->fb); + ret =drm_legacy_addmap (dev, fb_base, fb_size, _DRM_FRAME_BUFFER, + _DRM_WRITE_COMBINING, &dev_priv->fb);if (ret)return ret; - ret =drm_addmap (dev, aperture_base,SAVAGE_APERTURE_SIZE , - _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, - &dev_priv->aperture); + ret =drm_legacy_addmap (dev, aperture_base,SAVAGE_APERTURE_SIZE , + _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, + &dev_priv->aperture);return ret; }
@@ -698,7 +699,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) dev_priv->texture_offset = init->texture_offset; dev_priv->texture_size = init->texture_size; - dev_priv->sarea =drm_getsarea (dev); + dev_priv->sarea =drm_legacy_getsarea (dev);if (!dev_priv->sarea) {DRM_ERROR ("could not find sarea!\n" );savage_do_cleanup_bci (dev);
drivers/gpu/drm/via/via_map.c +1 -1
@@ -31,7 +31,7 @@ static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init)DRM_DEBUG ("\n" ); - dev_priv->sarea =drm_getsarea (dev); + dev_priv->sarea =drm_legacy_getsarea (dev);if (!dev_priv->sarea) {DRM_ERROR ("could not find sarea!\n" ); dev->dev_private = (void *)dev_priv;
include/drm/drmP.h +12 -29
65 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 02/20] drm: mark drm_buf and drm_map as legacy
Quoted 2 lines · David Herrmann
Move internal declarations to
drm_legacy.hand add drm_legacy_*() prefix to all legacy functions.
Perhaps this could give a short explanation of why they are marked as legacy and what the plan is to get rid of them.
[...]
Quoted 1 line
drivers/gpu/drm/drm_bufs.c +0
-0
[...]
drivers/gpu/drm/drm_bufs.c int drm_addmap(struct drm_device * dev, resource_size_t offset, · line 377
Quoted 6 lines
drivers/gpu/drm/drm_bufs.c +1
-1@@ -378,7 +374,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset,return rc; } -EXPORT_SYMBOL (drm_addmap); +EXPORT_SYMBOL (drm_legacy_addmap);
Nit: might as well remove the unusual blank line between the closing brace and the EXPORT_SYMBOL while at it.
Quoted 1 line
drivers/gpu/drm/mga/mga_dma.c +0
-0
[...]
drivers/gpu/drm/mga/mga_dma.c static int mga_do_agp_dma_bootstrap(struct drm_device *dev, · line 513
Quoted 5 lines
drivers/gpu/drm/mga/mga_dma.c +2
-2offset =0 ; - err =drm_addmap (dev, offset, warp_size, - _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); + err =drm_legacy_addmap (dev, offset, warp_size, + _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp);
The parameters are somewhat oddly wrapped here. Nothing that the patch introduces, but perhaps low-hanging fruit while at it. There are a few other occurrences in this file.
I found only minor whitespace nits, feel free to ignore those.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/20 drm: move "struct drm_vma_entry" to drm_vm.c
In reply to David HerrmannMake all the drm_vma_entry handling local to drm_vm.c and hide it from global headers. This requires to extract the inlined legacy drm_vma_entry cleanup into a small helper and also move a weirdly placed drm_vma_info helper into drm_vm.c.
--- drivers/gpu/drm/drm_fops.c | 10 +----- drivers/gpu/drm/drm_info.c | 59 ----------------------------------- drivers/gpu/drm/drm_vm.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ include/drm/drmP.h | 8 ++--- 4 files changed, 79 insertions(+), 74 deletions(-)
drivers/gpu/drm/drm_fops.c +1 -9
@@ -330,8 +330,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)*/ int drm_lastclose (struct drm_device * dev) { -struct drm_vma_entry *vma, *vma_temp; -DRM_DEBUG ("\n" );if (dev->driver->lastclose)
@@ -346,13 +344,7 @@ int drm_lastclose(struct drm_device * dev)drm_agp_clear (dev);drm_legacy_sg_cleanup (dev); - -/* Clear vma list (only built for debugging) */ -list_for_each_entry_safe (vma, vma_temp, &dev->vmalist, head) { -list_del (&vma->head); -kfree (vma); - } - +drm_legacy_vma_flush (dev);drm_legacy_dma_takedown (dev);mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/drm_info.c +0 -59
62 lines not on this page · raw message
drivers/gpu/drm/drm_vm.c +76 -0
90 lines not on this page · raw message
include/drm/drmP.h +2 -6
@@ -296,12 +296,6 @@ struct drm_magic_entry {struct drm_file *priv; }; -struct drm_vma_entry { -struct list_head head; -struct vm_area_struct *vma; -pid_t pid; -}; -/** * DMA buffer. */
@@ -1449,6 +1443,8 @@ struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);int drm_legacy_addbufs_agp (struct drm_device *d,struct drm_buf_desc *req);int drm_legacy_addbufs_pci (struct drm_device *d,struct drm_buf_desc *req); +void drm_legacy_vma_flush (struct drm_device *d); +/* sysfs support (drm_sysfs.c) */ struct drm_sysfs_class ;extern struct class *drm_sysfs_create (struct module *owner,char *name);
Signature · 1 line
2.1.0
Re: [PATCH 03/20] drm: move "struct drm_vma_entry" to drm_vm.c
Quoted 5 lines · David Herrmann
Make all the
drm_vma_entryhandling local todrm_vm.cand hide it from global headers. This requires to extract the inlined legacydrm_vma_entrycleanup into a small helper and also move a weirdly placeddrm_vma_infohelper intodrm_vm.c.
Quoted 7 lines
Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_fops.c | 10 +----- drivers/gpu/drm/drm_info.c | 59 ----------------------------------- drivers/gpu/drm/drm_vm.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ include/drm/drmP.h | 8 ++--- 4 files changed, 79 insertions(+), 74 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/20 drm: move "struct drm_magic_entry" to drm_auth.c
In reply to David HerrmannIn drm_release(), we currently call drm_remove_magic() if the drm_file has a drm-magic attached. Therefore, once drm_master_release() is called, the magic-list _must_ be empty.
By dropping the no-op cleanup, we can move "struct drm_magic_entry" to drm_auth.c and avoid exposing it to all of DRM.
--- drivers/gpu/drm/drm_auth.c | 6 ++++++ drivers/gpu/drm/drm_drv.c | 7 ------- include/drm/drmP.h | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_auth.c +6 -0
@@ -35,6 +35,12 @@#include <drm/drmP.h> +struct drm_magic_entry { +struct list_head head; +struct drm_hash_item hash_item; +struct drm_file *priv; +}; +/** * Find the file with the given magic number. *
drivers/gpu/drm/drm_drv.c +0 -7
@@ -133,7 +133,6 @@ EXPORT_SYMBOL(drm_master_get);static void drm_master_destroy (struct kref *kref) { struct drm_master *master = container_of(kref, struct drm_master, refcount); -struct drm_magic_entry *pt, *next;struct drm_device *dev = master->minor->dev;struct drm_map_list *r_list, *list_temp;
@@ -154,12 +153,6 @@ static void drm_master_destroy(struct kref *kref) master->unique_len =0 ; } -list_for_each_entry_safe (pt, next, &master->magicfree, head) { -list_del (&pt->head); -drm_ht_remove_item (&master->magiclist, &pt->hash_item); -kfree (pt); - } -drm_ht_remove (&master->magiclist);mutex_unlock (&dev->struct_mutex);
include/drm/drmP.h +0 -6
@@ -290,12 +290,6 @@ struct drm_ioctl_desc {#define DRM_IOCTL_DEF_DRV (ioctl, _func, _flags) \ [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} -struct drm_magic_entry { -struct list_head head; -struct drm_hash_item hash_item; -struct drm_file *priv; -}; -/** * DMA buffer. */
Signature · 1 line
2.1.0
Re: [PATCH 04/20] drm: move "struct drm_magic_entry" to drm_auth.c
Quoted 7 lines · David Herrmann
In
drm_release(), we currently calldrm_remove_magic()if thedrm_filehas a drm-magic attached. Therefore, oncedrm_master_release()is called, the magic-list _must_ be empty.By dropping the no-op cleanup, we can move "struct
drm_magic_entry" todrm_auth.cand avoid exposing it to all of DRM.
Quoted 6 lines
Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_auth.c | 6 ++++++ drivers/gpu/drm/drm_drv.c | 7 ------- include/drm/drmP.h | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/20 drm: drop unused "struct drm_waitlist"
In reply to David HerrmannThis structure is unused, drop it.
--- include/drm/drmP.h | 11 ----------- 1 file changed, 11 deletions(-)
include/drm/drmP.h +0 -11
@@ -320,17 +320,6 @@ struct drm_buf {void *dev_private;/**< Per-buffer private storage */ }; -/** bufs is one longer than it has to be */ -struct drm_waitlist { -int count;/**< Number of possible buffers */ -struct drm_buf **bufs;/**< List of pointers to buffers */ -struct drm_buf **rp;/**< Read pointer */ -struct drm_buf **wp;/**< Write pointer */ -struct drm_buf **end;/**< End pointer */ -spinlock_t read_lock; -spinlock_t write_lock; -}; - typedef struct drm_dma_handle { dma_addr_t busaddr; void *vaddr;
Signature · 1 line
2.1.0
Re: [PATCH 05/20] drm: drop unused "struct drm_waitlist"
Quoted 6 lines · David Herrmann
This structure is unused, drop it.
Signed-off-by David Herrmann <[email protected]>--- include/drm/drmP.h | 11 ----------- 1 file changed, 11 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/20 drm: move AGP definitions harder
In reply to David HerrmannMove drm_agp_head to drm_agpsupport.h and drm_agp_mem into drm_legacy.h. Unfortunately, drivers still heavily access drm_agp_head so we cannot move it to drm_legacy.h. However, at least it's no longer visible in drmP.h now (it's directly included from it, though).
--- drivers/gpu/drm/drm_agpsupport.c | 1 + drivers/gpu/drm/drm_legacy.h | 15 +++++++++++++++ drivers/gpu/drm/drm_memory.c | 1 + drivers/gpu/drm/drm_vm.c | 1 + include/drm/drmP.h | 30 +----------------------------- include/drm/drm_agpsupport.h | 13 +++++++++++++ 6 files changed, 32 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +1 -0
@@ -34,6 +34,7 @@#include <drm/drmP.h> #include <linux/module.h> #include <linux/slab.h> +#include "drm_legacy.h" #if __OS_HAS_AGP
drivers/gpu/drm/drm_legacy.h +15 -0
@@ -23,6 +23,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#include <linux/list.h> + +struct agp_memory ;struct drm_device ;struct drm_file ;
@@ -63,4 +66,16 @@ int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);int drm_legacy_mapbufs (struct drm_device *d,void *v,struct drm_file *f);int drm_legacy_dma_ioctl (struct drm_device *d,void *v,struct drm_file *f); +/* +* AGP Support +*/ + +struct drm_agp_mem { +unsigned long handle; +struct agp_memory *memory; +unsigned long bound; +int pages; +struct list_head head; +}; +#endif /* __DRM_LEGACY_H__ */
drivers/gpu/drm/drm_memory.c +1 -0
@@ -36,6 +36,7 @@#include <linux/highmem.h> #include <linux/export.h> #include <drm/drmP.h> +#include "drm_legacy.h" #if __OS_HAS_AGP static void *agp_remap(unsigned long offset, unsigned long size,
drivers/gpu/drm/drm_vm.c +1 -0
@@ -40,6 +40,7 @@#include <linux/efi.h> #include <linux/slab.h> #endif +#include "drm_legacy.h" struct drm_vma_entry {struct list_head head;
include/drm/drmP.h +1 -29
@@ -80,6 +80,7 @@ struct module;struct drm_file ;struct drm_device ; +struct drm_agp_head ;struct device_node ;struct videomode ;
@@ -440,35 +441,6 @@ struct drm_device_dma { };/** -* AGP memory entry. Stored as a doubly linked list. -*/ -struct drm_agp_mem { -unsigned long handle;/**< handle */ -struct agp_memory *memory; -unsigned long bound;/**< address */ -int pages; -struct list_head head; -}; - -/** -* AGP data. -* -* \sa drm_agp_init() and drm_device::agp. -*/ -struct drm_agp_head { -struct agp_kern_info agp_info;/**< AGP device information */ -struct list_head memory; -unsigned long mode;/**< AGP mode */ -struct agp_bridge_data *bridge; -int enabled;/**< whether the AGP bus as been enabled */ -int acquired;/**< whether the AGP device has been acquired */ -unsigned long base; -int agp_mtrr; -int cant_use_aperture; -unsigned long page_mask; -}; - -/** * Scatter-gather memory. */ struct drm_sg_mem {
include/drm/drm_agpsupport.h +13 -0
@@ -8,6 +8,19 @@#include <linux/agp_backend.h> #include <drm/drmP.h> +struct drm_agp_head { +struct agp_kern_info agp_info; +struct list_head memory; +unsigned long mode; +struct agp_bridge_data *bridge; +int enabled; +int acquired; +unsigned long base; +int agp_mtrr; +int cant_use_aperture; +unsigned long page_mask; +}; +#if __OS_HAS_AGPvoid drm_free_agp (struct agp_memory * handle,int pages);
Signature · 1 line
2.1.0
Re: [PATCH 06/20] drm: move AGP definitions harder
Quoted 6 lines · David Herrmann
Move
drm_agp_headtodrm_agpsupport.handdrm_agp_memintodrm_legacy.h. Unfortunately, drivers still heavily accessdrm_agp_headso we cannot move it todrm_legacy.h. However, at least it's no longer visible indrmP.hnow (it's directly included from it, though).Signed-off-by David Herrmann <[email protected]>
Quoted 8 lines
--- drivers/gpu/drm/drm_agpsupport.c | 1 + drivers/gpu/drm/drm_legacy.h | 15 +++++++++++++++ drivers/gpu/drm/drm_memory.c | 1 + drivers/gpu/drm/drm_vm.c | 1 + include/drm/drmP.h | 30 +----------------------------- include/drm/drm_agpsupport.h | 13 +++++++++++++ 6 files changed, 32 insertions(+), 29 deletions(-)
I don't know exactly what you mean by "move harder" in the subject, but other than that this looks good, so with a better subject this is:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 06/20] drm: move AGP definitions harder
Quoted 16 lines · Thierry Reding
Quoted 6 lines · David Herrmann
Move
drm_agp_headtodrm_agpsupport.handdrm_agp_memintodrm_legacy.h. Unfortunately, drivers still heavily accessdrm_agp_headso we cannot move it todrm_legacy.h. However, at least it's no longer visible indrmP.hnow (it's directly included from it, though).Signed-off-by David Herrmann <[email protected]>Quoted 8 lines
--- drivers/gpu/drm/drm_agpsupport.c | 1 + drivers/gpu/drm/drm_legacy.h | 15 +++++++++++++++ drivers/gpu/drm/drm_memory.c | 1 + drivers/gpu/drm/drm_vm.c | 1 + include/drm/drmP.h | 30 +----------------------------- include/drm/drm_agpsupport.h | 13 +++++++++++++ 6 files changed, 32 insertions(+), 29 deletions(-)
Quoted 2 lines
I don't know exactly what you mean by "move harder" in the subject, but other than that this looks good, so with a better subject this is:
I guess "Try to hide AGP definitions harder" would be more accurate. -Daniel
Quoted 2 lines
Reviewed-by Thierry Reding <[email protected]>
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 7/20 drm: replace weird conditional includes
In reply to David Herrmannpte_wrprotect() is only used by drm_vm.c, so move the include there. Also include it unconditionally, all architectures provide this header!
Furthermore, replace asm/current.h with sched.h, which includes asm/current.h unconditionally. This way we get the same effect and avoid direct asm/ includes. Furthermore, drop the weird __alpha__ protection. It's safe to include sched.h everywhere (and the wait.h comment doesn't apply, anyway).
--- drivers/gpu/drm/drm_vm.c | 1 + include/drm/drmP.h | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_vm.c +1 -0
@@ -40,6 +40,7 @@#include <linux/efi.h> #include <linux/slab.h> #endif +#include <asm/pgtable.h> #include "drm_legacy.h" struct drm_vma_entry {
include/drm/drmP.h +1 -9
@@ -36,12 +36,7 @@#define _DRM_P_H_#ifdef __KERNEL__ -#ifdef __alpha__ -/* add include of current.h so that "current" is defined -* before static inline funcs in wait.h. Doing this so we -* can build the DRM (part of PI DRI). 4/21/2000 S + B */ -#include <asm/current.h> -#endif /* __alpha__ */ +#include <linux/sched.h> #include <linux/kernel.h> #include <linux/kref.h> #include <linux/miscdevice.h>
@@ -58,9 +53,6 @@#include <linux/io.h> #include <linux/slab.h> #include <linux/ratelimit.h> -#if defined(__alpha__) || defined(__powerpc__) -#include <asm/pgtable.h> /* For pte_wrprotect */ -#endif #include <asm/mman.h> #include <asm/uaccess.h> #include <linux/types.h>
Signature · 1 line
2.1.0
Re: [PATCH 07/20] drm: replace weird conditional includes
Quoted 9 lines · David Herrmann
pte_wrprotect()is only used bydrm_vm.c, so move the include there. Also include it unconditionally, all architectures provide this header!Furthermore, replace
asm/current.hwithsched.h, which includesasm/current.hunconditionally. This way we get the same effect and avoid direct asm/ includes. Furthermore, drop the weird__alpha__protection. It's safe to includesched.heverywhere (and thewait.hcomment doesn't apply, anyway).
Quoted 5 lines
Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_vm.c | 1 + include/drm/drmP.h | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/20 drm: drop __KERNEL__ protection in drmP.h
In reply to David HerrmanndrmP.h is internal to the kernel. No need to keep the __KERNEL__ protection.
--- include/drm/drmP.h | 2 -- 1 file changed, 2 deletions(-)
include/drm/drmP.h +0 -2
@@ -35,7 +35,6 @@#ifndef _DRM_P_H_#define _DRM_P_H_ -#ifdef __KERNEL__#include <linux/sched.h> #include <linux/kernel.h> #include <linux/kref.h>
@@ -1544,5 +1543,4 @@ static __inline__ bool drm_can_sleep(void) return true; } -#endif /* __KERNEL__ */ #endif
Signature · 1 line
2.1.0
Re: [PATCH 08/20] drm: drop __KERNEL__ protection in drmP.h
Quoted 7 lines · David Herrmann
drmP.his internal to the kernel. No need to keep the__KERNEL__protection.Signed-off-by David Herrmann <[email protected]>--- include/drm/drmP.h | 2 -- 1 file changed, 2 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/20 drm: merge drm_memory.h into drm_memory.c
In reply to David HerrmannThe drm_memory.h header is only used to define PAGE_AGP, which is only used in drm_memory.c. Fold the header into drm_memory.c and drop it.
--- drivers/gpu/drm/drm_memory.c | 11 +++++++++ include/drm/drmP.h | 6 ++--- include/drm/drm_memory.h | 59 -------------------------------------------- 3 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 include/drm/drm_memory.h
drivers/gpu/drm/drm_memory.c +11 -0
@@ -39,6 +39,17 @@#include "drm_legacy.h" #if __OS_HAS_AGP + +#ifdef HAVE_PAGE_AGP +# include <asm/agp.h> +#else +# ifdef __powerpc__ +# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE) +# else +# define PAGE_AGP PAGE_KERNEL +# endif +#endif +static void *agp_remap (unsigned long offset,unsigned long size,struct drm_device * dev) {
include/drm/drmP.h +2 -4
@@ -58,6 +58,8 @@#include <linux/agp_backend.h> #include <linux/workqueue.h> #include <linux/poll.h> +#include <linux/highmem.h> +#include <linux/vmalloc.h> #include <asm/pgalloc.h> #include <drm/drm.h> #include <drm/drm_sarea.h>
@@ -1127,10 +1129,6 @@ extern void drm_vm_open_locked(struct drm_device *dev, struct vm_area_struct *vmextern void drm_vm_close_locked (struct drm_device *dev,struct vm_area_struct *vma);extern unsigned int drm_poll (struct file *filp,struct poll_table_struct *wait); -/* Memory management support (drm_memory.h) */ -#include <drm/drm_memory.h> - -/* Misc. IOCTL support (drm_ioctl.h) */ extern int drm_irq_by_busid (struct drm_device *dev,void *data,struct drm_file *file_priv);
include/drm/drm_memory.h deleted +0 -59
59 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 09/20] drm: merge drm_memory.h into drm_memory.c
Quoted 16 lines · David Herrmann
The
drm_memory.hheader is only used to definePAGE_AGP, which is only used indrm_memory.c. Fold the header intodrm_memory.cand drop it.Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_memory.c | 11 +++++++++ include/drm/drmP.h | 6 ++--- include/drm/drm_memory.h | 59 -------------------------------------------- 3 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 include/drm/drm_memory.hdrivers/gpu/drm/drm_memory.c +0
-0
drivers/gpu/drm/drm_memory.c line 45
Quoted 7 lines
drivers/gpu/drm/drm_memory.c +4
-0@@ -39,6 +39,17 @@#include "drm_legacy.h" #if __OS_HAS_AGP + +#ifdef HAVE_PAGE_AGP +# include <asm/agp.h> +#else
This check seems to be redundant. All architectures that support AGP provide this header.
drivers/gpu/drm/drm_memory.c line 47
Quoted 2 lines
drivers/gpu/drm/drm_memory.c +2
-0+# ifdef __powerpc__ +# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
Is this even necessary? It seems like PowerPC always defines HAVE_PAGE_AGP.
drivers/gpu/drm/drm_memory.c line 51
Quoted 4 lines
drivers/gpu/drm/drm_memory.c +4
-0+# else +# define PAGE_AGP PAGE_KERNEL +# endif +#endif
Shouldn't this simply be moved into the asm/agp.h header for each of the architectures that has AGP?
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
Reviewed-byRe: [PATCH 09/20] drm: merge drm_memory.h into drm_memory.c
Quoted 28 lines · Thierry Reding
Quoted 16 lines · David Herrmann
The
drm_memory.hheader is only used to definePAGE_AGP, which is only used indrm_memory.c. Fold the header intodrm_memory.cand drop it.Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_memory.c | 11 +++++++++ include/drm/drmP.h | 6 ++--- include/drm/drm_memory.h | 59 -------------------------------------------- 3 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 include/drm/drm_memory.hdrivers/gpu/drm/drm_memory.c +0
-0drivers/gpu/drm/drm_memory.c line 45
Quoted 7 lines
drivers/gpu/drm/drm_memory.c +4
-0@@ -39,6 +39,17 @@#include "drm_legacy.h" #if __OS_HAS_AGP + +#ifdef HAVE_PAGE_AGP +# include <asm/agp.h> +#else This check seems to be redundant. All architectures that support AGP provide this header.
Quoted 5 lines
drivers/gpu/drm/drm_memory.c line 47
Quoted 2 lines
drivers/gpu/drm/drm_memory.c +2
-0+# ifdef __powerpc__ +# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)Is this even necessary? It seems like PowerPC always defines
HAVE_PAGE_AGP.
Iirc I've tried to untangle this before and I'm not 100% this is actually the case on all ppc platforms. It looked like there's some crazy include header depency stuff going on.
But given how popular drm on ppc and that the few platforms where people actually use gpus are the saner ones (hopefully) I think we can just move ahead with this change and fixup any compile breakage once it's reported. If there is any.
Quoted 7 lines
drivers/gpu/drm/drm_memory.c line 51
Quoted 4 lines
drivers/gpu/drm/drm_memory.c +4
-0+# else +# define PAGE_AGP PAGE_KERNEL +# endif +#endif Shouldn't this simply be moved into the
asm/agp.hheader for each of the architectures that has AGP?
Same comment really, I think the include mess is to hard to untangle. At least I've failed. So with the #ifdef HAVE_PAGE_AGP dropped around the include as Thierry suggested this is
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 09/20] drm: merge drm_memory.h into drm_memory.c
Quoted 35 lines · Daniel Vetter
Quoted 28 lines · Thierry Reding
Quoted 16 lines · David Herrmann
The
drm_memory.hheader is only used to definePAGE_AGP, which is only used indrm_memory.c. Fold the header intodrm_memory.cand drop it.Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_memory.c | 11 +++++++++ include/drm/drmP.h | 6 ++--- include/drm/drm_memory.h | 59 -------------------------------------------- 3 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 include/drm/drm_memory.hdrivers/gpu/drm/drm_memory.c +0
-0drivers/gpu/drm/drm_memory.c line 45
Quoted 7 lines
drivers/gpu/drm/drm_memory.c +4
-0@@ -39,6 +39,17 @@#include "drm_legacy.h" #if __OS_HAS_AGP + +#ifdef HAVE_PAGE_AGP +# include <asm/agp.h> +#else This check seems to be redundant. All architectures that support AGP provide this header.
Quoted 5 lines
drivers/gpu/drm/drm_memory.c line 47
Quoted 2 lines
drivers/gpu/drm/drm_memory.c +2
-0+# ifdef __powerpc__ +# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)Is this even necessary? It seems like PowerPC always defines
HAVE_PAGE_AGP.
Quoted 3 lines
Iirc I've tried to untangle this before and I'm not 100% this is actually the case on all ppc platforms. It looked like there's some crazy include header depency stuff going on.
Interestingly, I don't even see _PAGE_KERNEL defined on PowerPC...
Quoted 4 lines
But given how popular drm on ppc and that the few platforms where people actually use gpus are the saner ones (hopefully) I think we can just move ahead with this change and fixup any compile breakage once it's reported. If there is any.
I'm not objecting to this change since it's merely reorganizing code. This is just more possible future cleanup.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/20 drm: move __OS_HAS_AGP into drm_agpsupport.h
In reply to David HerrmannWith drm_memory.h gone, there is no header left that uses __OS_HAS_AGP. Move it into drm_agpsupport.h (which is itself included from drmP.h) to hide it harder from public eyes.
--- include/drm/drmP.h | 2 -- include/drm/drm_agpsupport.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
include/drm/drmP.h +0 -2
@@ -67,8 +67,6 @@#include <linux/idr.h> -#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) -struct module ;struct drm_file ;
include/drm/drm_agpsupport.h +3 -0
@@ -8,6 +8,9 @@#include <linux/agp_backend.h> #include <drm/drmP.h> +#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \ + defined(MODULE))) +struct drm_agp_head {struct agp_kern_info agp_info;struct list_head memory;
Signature · 1 line
2.1.0
Re: [PATCH 10/20] drm: move __OS_HAS_AGP into drm_agpsupport.h
Quoted 28 lines · David Herrmann
With
drm_memory.hgone, there is no header left that uses__OS_HAS_AGP. Move it intodrm_agpsupport.h(which is itself included fromdrmP.h) to hide it harder from public eyes.Signed-off-by David Herrmann <[email protected]>--- include/drm/drmP.h | 2 -- include/drm/drm_agpsupport.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)include/drm/drmP.h +0
-2@@ -67,8 +67,6 @@#include <linux/idr.h> -#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) -struct module ;struct drm_file ;include/drm/drm_agpsupport.h +0
-0
include/drm/drm_agpsupport.h line 12
Quoted 5 lines
include/drm/drm_agpsupport.h +2
-0@@ -8,6 +8,9 @@#include <linux/agp_backend.h> #include <drm/drmP.h> +#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \ + defined(MODULE)))
I'm not really sure what the intent was of the final defined(MODULE). Surely the fact whether a driver is being built as a module or not does not influence whether or not the OS supports AGP.
And if this is merely meant to make sure that drivers that are built-in don't break to build if AGP is a module, then that should be a job for Kconfig rather than some macro.
So I think the above could simply become:
#define __OS_HAS_AGP IS_ENABLED(CONFIG_AGP)
And once we have that I think we could even easily get rid of the custom __OS_HAS_AGP macro and use IS_ENABLED(CONFIG_AGP) directly.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/20] drm: move __OS_HAS_AGP into drm_agpsupport.h
Quoted 32 lines · Thierry Reding
Quoted 31 lines · David Herrmann
With
drm_memory.hgone, there is no header left that uses__OS_HAS_AGP. Move it intodrm_agpsupport.h(which is itself included fromdrmP.h) to hide it harder from public eyes.Signed-off-by David Herrmann <[email protected]>--- include/drm/drmP.h | 2 -- include/drm/drm_agpsupport.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)include/drm/drmP.h +0
-2@@ -67,8 +67,6 @@#include <linux/idr.h> -#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) -struct module ;struct drm_file ;include/drm/drm_agpsupport.h +0
-0@@ -8,6 +8,9 @@#include <linux/agp_backend.h> #include <drm/drmP.h>
Quoted 6 lines
include/drm/drm_agpsupport.h line 12
Quoted 2 lines
include/drm/drm_agpsupport.h +2
-0+#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \ + defined(MODULE)))I'm not really sure what the intent was of the final defined(MODULE). Surely the fact whether a driver is being built as a module or not does not influence whether or not the OS supports AGP.
I think this was to make sure agp drivers are loaded before the drm drivers. But since ages we can build the different agp drivers indidivudally as modules, so this stopped making any sense at all.
Quoted 10 lines
And if this is merely meant to make sure that drivers that are built-in don't break to build if AGP is a module, then that should be a job for
Kconfigrather than some macro.So I think the above could simply become:
#define __OS_HAS_AGP IS_ENABLED(CONFIG_AGP)And once we have that I think we could even easily get rid of the custom
__OS_HAS_AGPmacro and useIS_ENABLED(CONFIG_AGP)directly.
Yeah, I think a simple IS_ENABLED(CONFIG_AGP) sould be good enough. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 11/20 drm: order includes alphabetically in drmP.h
In reply to David HerrmannIt is hardly possible to review the drmP.h includes, anymore. Order them alphabetically, linux/ first, then asm/ and then local drm/ includes.
Since a long time ago, kernel headers have been converted to include required headers themselves. No-one cares whether that means the compiler has to include a header multiple times. In fact, GCC already does some optimization regarding multiple inclusions if a sorrounding #ifndef is present.
--- include/drm/drmP.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
include/drm/drmP.h +23 -23
@@ -35,38 +35,42 @@#ifndef _DRM_P_H_#define _DRM_P_H_ -#include <linux/sched.h> -#include <linux/kernel.h> -#include <linux/kref.h> -#include <linux/miscdevice.h> +#include <linux/agp_backend.h> +#include <linux/cdev.h> +#include <linux/dma-mapping.h> +#include <linux/file.h> #include <linux/fs.h> +#include <linux/highmem.h> +#include <linux/idr.h> #include <linux/init.h> -#include <linux/file.h> -#include <linux/platform_device.h> -#include <linux/pci.h> +#include <linux/io.h> #include <linux/jiffies.h> -#include <linux/dma-mapping.h> +#include <linux/kernel.h> +#include <linux/kref.h> +#include <linux/miscdevice.h> #include <linux/mm.h> -#include <linux/cdev.h> #include <linux/mutex.h> -#include <linux/io.h> -#include <linux/slab.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/poll.h> #include <linux/ratelimit.h> -#include <asm/mman.h> -#include <asm/uaccess.h> +#include <linux/sched.h> +#include <linux/slab.h> #include <linux/types.h> -#include <linux/agp_backend.h> -#include <linux/workqueue.h> -#include <linux/poll.h> -#include <linux/highmem.h> #include <linux/vmalloc.h> +#include <linux/workqueue.h> + +#include <asm/mman.h> #include <asm/pgalloc.h> +#include <asm/uaccess.h> +#include <drm/drm.h> +#include <drm/drm_hashtab.h> +#include <drm/drm_mm.h> +#include <drm/drm_os_linux.h> #include <drm/drm_sarea.h> #include <drm/drm_vma_manager.h> -#include <linux/idr.h> -struct module ;struct drm_file ;
@@ -77,10 +81,6 @@ struct device_node;struct videomode ;struct reservation_object ; -#include <drm/drm_os_linux.h> -#include <drm/drm_hashtab.h> -#include <drm/drm_mm.h> -/* * 4 debug categories are defined: *
Signature · 1 line
2.1.0
Re: [PATCH 11/20] drm: order includes alphabetically in drmP.h
Quoted 9 lines · David Herrmann
It is hardly possible to review the
drmP.hincludes, anymore. Order them alphabetically, linux/ first, then asm/ and then local drm/ includes.Since a long time ago, kernel headers have been converted to include required headers themselves. No-one cares whether that means the compiler has to include a header multiple times. In fact, GCC already does some optimization regarding multiple inclusions if a sorrounding #ifndef is present.
Quoted 4 lines
Signed-off-by David Herrmann <[email protected]>--- include/drm/drmP.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
This looks good, but I don't think I'm going to bother manually checking each of those. Provided everything still complies, this is at least:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 12/20 drm: drop DRM_DEBUG_CODE
In reply to David HerrmannDRM_DEBUG_CODE is currently always set, so distributions enable it. The only reason to keep support in code is if developers wanted to disable debug support. Sounds unlikely.
All the DRM_DEBUG() printks are still guarded by a drm_debug read. So if its cacheline is read once, they're discarded pretty fast.. There should hardly be any performance penalty, it's even guarded by unlikely().
--- drivers/gpu/drm/drm_debugfs.c | 2 -- drivers/gpu/drm/drm_vm.c | 4 ---- drivers/gpu/drm/radeon/radeon.h | 17 ++++++++++++----- drivers/gpu/drm/radeon/radeon_ring.c | 21 --------------------- include/drm/drmP.h | 12 ------------ 5 files changed, 12 insertions(+), 44 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -2
@@ -49,9 +49,7 @@ static const struct drm_info_list drm_debugfs_list[] = { {"clients", drm_clients_info, 0}, {"bufs", drm_bufs_info, 0}, {"gem_names", drm_gem_name_info, DRIVER_GEM}, -#if DRM_DEBUG_CODE {"vma", drm_vma_info, 0}, -#endif };#define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list)
drivers/gpu/drm/drm_vm.c +0 -4
@@ -683,8 +683,6 @@ void drm_legacy_vma_flush(struct drm_device *dev) } } -#if DRM_DEBUG_CODE -int drm_vma_info (struct seq_file *m,void *data) {struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -738,5 +736,3 @@ int drm_vma_info(struct seq_file *m, void *data)mutex_unlock (&dev->struct_mutex);return 0 ; } - -#endif
drivers/gpu/drm/radeon/radeon.h +12 -5
@@ -2761,18 +2761,25 @@ void radeon_atombios_fini(struct radeon_device *rdev);/* * RING helpers. */ -#if DRM_DEBUG_CODE ==0 + +/** +* radeon_ring_write - write a value to the ring +* +* @ring: radeon_ring structure holding ring information +* @v: dword (dw) value to write +* +* Write a value to the requested ring buffer (all asics). +*/ static inline void radeon_ring_write (struct radeon_ring *ring,uint32_t v) { +if (ring->count_dw <=0 ) +DRM_ERROR ("radeon: writing more dwords to the ring than expected!\n" ); + ring->ring[ring->wptr++] = v; ring->wptr &= ring->ptr_mask; ring->count_dw--; ring->ring_free_dw--; } -#else -/* With debugging this is just too big to inline */ -void radeon_ring_write (struct radeon_ring *ring,uint32_t v); -#endif /* * ASICs macro.
drivers/gpu/drm/radeon/radeon_ring.c +0 -21
@@ -45,27 +45,6 @@static int radeon_debugfs_ring_init (struct radeon_device *rdev,struct radeon_ring *ring);/** -* radeon_ring_write - write a value to the ring -* -* @ring: radeon_ring structure holding ring information -* @v: dword (dw) value to write -* -* Write a value to the requested ring buffer (all asics). -*/ -void radeon_ring_write (struct radeon_ring *ring,uint32_t v) -{ -#if DRM_DEBUG_CODE -if (ring->count_dw <=0 ) { -DRM_ERROR ("radeon: writing more dwords to the ring than expected!\n" ); - } -#endif - ring->ring[ring->wptr++] = v; - ring->wptr &= ring->ptr_mask; - ring->count_dw--; - ring->ring_free_dw--; -} - -/** * radeon_ring_supports_scratch_reg - check if the ring supports * writing to scratch registers *
include/drm/drmP.h +0 -12
@@ -140,9 +140,6 @@ int drm_err(const char *func, const char *format, ...);/** \name Begin the DRM... */ /*@{*/ -#define DRM_DEBUG_CODE 2/**< Include debugging code if > 1, then -also include looping detection. */ -#define DRM_MAGIC_HASH_ORDER 4/**< Size of key hash table. Must be power of 2. */ /*@}*/
@@ -188,7 +185,6 @@ int drm_err(const char *func, const char *format, ...);* \param fmt printf() like format string. * \param arg arguments */ -#if DRM_DEBUG_CODE #define DRM_DEBUG(fmt, args...) \ do { \ if (unlikely(drm_debug & DRM_UT_CORE)) \
@@ -210,12 +206,6 @@ int drm_err(const char *func, const char *format, ...);if (unlikely (drm_debug &DRM_UT_PRIME )) \ drm_ut_debug_printk(__func__, fmt, ##args); \ }while (0 ) -#else -#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) -#define DRM_DEBUG_KMS(fmt, args...) do { } while (0) -#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) -#define DRM_DEBUG(fmt, arg...) do { } while (0) -#endif /*@}*/
@@ -1348,9 +1338,7 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);void drm_prime_destroy_file_private (struct drm_prime_file_private *prime_fpriv);void drm_prime_remove_buf_handle_locked (struct drm_prime_file_private *prime_fpriv,struct dma_buf *dma_buf); -#if DRM_DEBUG_CODE extern int drm_vma_info (struct seq_file *m,void *data); -#endif /* Scatter Gather Support (drm_scatter.h) */ extern void drm_legacy_sg_cleanup (struct drm_device *dev);
Signature · 1 line
2.1.0
Re: [PATCH 12/20] drm: drop DRM_DEBUG_CODE
On Fri, Aug 29, 2014 at 12:12:38PM +0200, David Herrmann wrote:
[...]
Quoted 52 lines
drivers/gpu/drm/radeon/radeon.h +12
-5@@ -2761,18 +2761,25 @@ void radeon_atombios_fini(struct radeon_device *rdev);/* * RING helpers. */ -#if DRM_DEBUG_CODE ==0 + +/** +* radeon_ring_write - write a value to the ring +* +* @ring: radeon_ring structure holding ring information +* @v: dword (dw) value to write +* +* Write a value to the requested ring buffer (all asics). +*/ static inline void radeon_ring_write (struct radeon_ring *ring,uint32_t v) { +if (ring->count_dw <=0 ) +DRM_ERROR ("radeon: writing more dwords to the ring than expected!\n" ); + ring->ring[ring->wptr++] = v; ring->wptr &= ring->ptr_mask; ring->count_dw--; ring->ring_free_dw--; } -#else -/* With debugging this is just too big to inline */ -void radeon_ring_write (struct radeon_ring *ring,uint32_t v); -#endif /* * ASICs macro. drivers/gpu/drm/radeon/radeon_ring.c +0
-9@@ -45,27 +45,6 @@static int radeon_debugfs_ring_init (struct radeon_device *rdev,struct radeon_ring *ring);/** -* radeon_ring_write - write a value to the ring -* -* @ring: radeon_ring structure holding ring information -* @v: dword (dw) value to write -* -* Write a value to the requested ring buffer (all asics). -*/ -void radeon_ring_write (struct radeon_ring *ring,uint32_t v) -{
drivers/gpu/drm/radeon/radeon_ring.c line 66
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ring.c +0
-10-#if DRM_DEBUG_CODE -if (ring->count_dw <=0 ) { -DRM_ERROR ("radeon: writing more dwords to the ring than expected!\n" ); - } -#endif - ring->ring[ring->wptr++] = v; - ring->wptr &= ring->ptr_mask; - ring->count_dw--; - ring->ring_free_dw--; -}
The original was clearly never tested with DRM_DEBUG_CODE != 0. I don't see how it could've built given that the header protects the complete function whereas the implementation protects only part of the function.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/20 drm: inline "struct drm_sigdata"
In reply to David HerrmannThe sigdata structure is only used to group two fields in drm_device. Inline it and make it an unnamed object.
--- drivers/gpu/drm/drm_lock.c | 15 ++++++++------- include/drm/drmP.h | 12 +++++------- 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_lock.c +8 -7
@@ -120,7 +120,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)sigaddset (&dev->sigmask,SIGTTOU ); dev->sigdata.context = lock->context; dev->sigdata.lock = master->lock.hw_lock; -block_all_signals (drm_notifier, &dev->sigdata, &dev->sigmask); +block_all_signals (drm_notifier, dev, &dev->sigmask); }if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
@@ -286,26 +286,27 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)* If the lock is not held, then let the signal proceed as usual. If the lock * is held, then set the contended flag and keep the signal blocked. * -* \param priv pointer to a drm_sigdata structure. +* \param priv pointer to a drm_device structure. * \return one if the signal should be delivered normally, or zero if the * signal should be blocked. */ static int drm_notifier (void *priv) { -struct drm_sigdata *s = (struct drm_sigdata *) priv; +struct drm_device *dev = priv; +struct drm_hw_lock *lock = dev->sigdata.lock;unsigned int old, new, prev;/* Allow signal delivery if lock isn't held */ -if (!s->lock || !_DRM_LOCK_IS_HELD (s->lock->lock) - ||_DRM_LOCKING_CONTEXT (s->lock->lock) != s->context) +if (!lock || !_DRM_LOCK_IS_HELD (lock->lock) + ||_DRM_LOCKING_CONTEXT (lock->lock) != dev->sigdata.context)return 1 ;/* Otherwise, set flag to force call to drmUnlock */ do { - old = s->lock->lock; + old = lock->lock; new = old | _DRM_LOCK_CONT; - prev =cmpxchg (&s->lock->lock, old, new); + prev =cmpxchg (&lock->lock, old, new); }while (prev != old);return 0 ; }
include/drm/drmP.h +5 -7
@@ -432,12 +432,6 @@ struct drm_sg_mem {dma_addr_t *busaddr; }; -struct drm_sigdata { -int context; -struct drm_hw_lock *lock; -}; - -/** * Kernel side of a mapping */
@@ -1035,9 +1029,13 @@ struct drm_device {struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ -struct drm_sigdata sigdata;/**< For block_all_signals */ sigset_t sigmask; +struct { +int context; +struct drm_hw_lock *lock; + } sigdata; +struct drm_local_map *agp_buffer_map;unsigned int agp_buffer_token;
Signature · 1 line
2.1.0
Re: [PATCH 13/20] drm: inline "struct drm_sigdata"
Quoted 2 lines · David Herrmann
The sigdata structure is only used to group two fields in
drm_device. Inline it and make it an unnamed object.
I'm not sure what unnamed object means.
Quoted 1 line
include/drm/drmP.h +0
-0
[...]
include/drm/drmP.h struct drm_device { · line 1035
Quoted 9 lines
include/drm/drmP.h +2
-1@@ -1035,9 +1029,13 @@ struct drm_device {struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ -struct drm_sigdata sigdata;/**< For block_all_signals */ sigset_t sigmask; +struct { +int context;
Your patch doesn't introduce this, but shouldn't context here be unsigned given that it's compared to drm_hw_lock's .lock field?
I guess struct drm_lock could have that same change. I suppose it might not be all that important since presumably the code works, but it's still inconsistent use of types.
Anyway, if you could clarify the "unnamed object" in the commit description, this patch:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 14/20 drm: move remaining includes in drmP.h to the top
In reply to David HerrmannIncluding headers somewhere else but at the top is ugly, deprecated and was used in early days only to speed up compile-times. Those days are over. Make headers independent and then move the inclusions to the top.
--- include/drm/drmP.h | 31 ++++++++++++------------------- include/drm/drm_agpsupport.h | 10 ++++++++-- include/drm/drm_crtc.h | 4 ++-- 3 files changed, 22 insertions(+), 23 deletions(-)
include/drm/drmP.h +12 -19
@@ -1,17 +1,14 @@ -/** -* \file drmP.h -* Private header for Direct Rendering Manager -* -* \author Rickard E. (Rik) Faith <[email protected]> -* \author Gareth Hughes <[email protected]> -*/ -/* +* Internal Header for the Direct Rendering Manager +* * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright (c) 2009-2010, Code Aurora Forum. * All rights reserved. * +* Author: Rickard E. (Rik) Faith <[email protected]> +* Author: Gareth Hughes <[email protected]> +* * 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
@@ -64,8 +61,14 @@#include <asm/pgalloc.h> #include <asm/uaccess.h> -#include <drm/drm.h> +#include <uapi/drm/drm.h> +#include <uapi/drm/drm_mode.h> + +#include <drm/drm_agpsupport.h> +#include <drm/drm_crtc.h> +#include <drm/drm_global.h> #include <drm/drm_hashtab.h> +#include <drm/drm_mem_util.h> #include <drm/drm_mm.h> #include <drm/drm_os_linux.h> #include <drm/drm_sarea.h>
@@ -564,8 +567,6 @@ struct drm_gem_object {struct dma_buf_attachment *import_attach; }; -#include <drm/drm_crtc.h> -/** * struct drm_master - drm master structure *
@@ -1228,10 +1229,6 @@ extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);extern int drm_modeset_ctl (struct drm_device *dev,void *data,struct drm_file *file_priv); -/* AGP/GART support (drm_agpsupport.h) */ - -#include <drm/drm_agpsupport.h> -/* Stub support (drm_stub.h) */ extern int drm_setmaster_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv);
@@ -1397,8 +1394,6 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, struct vm_area_struct *vma);int drm_gem_mmap (struct file *filp,struct vm_area_struct *vma); -#include <drm/drm_global.h> -static inline void drm_gem_object_reference (struct drm_gem_object *obj) {
@@ -1472,8 +1467,6 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map) { } -#include <drm/drm_mem_util.h> -struct drm_device *drm_dev_alloc (struct drm_driver *driver,struct device *parent);void drm_dev_ref (struct drm_device *dev);
include/drm/drm_agpsupport.h +8 -2
@@ -1,12 +1,16 @@#ifndef _DRM_AGPSUPPORT_H_#define _DRM_AGPSUPPORT_H_ +#include <linux/agp_backend.h> #include <linux/kernel.h> +#include <linux/list.h> #include <linux/mm.h> #include <linux/mutex.h> #include <linux/types.h> -#include <linux/agp_backend.h> -#include <drm/drmP.h> +#include <uapi/drm/drm.h> + +struct drm_device ; +struct drm_file ;#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \ defined(MODULE)))
@@ -61,6 +65,7 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,int drm_agp_bind (struct drm_device *dev,struct drm_agp_binding *request);int drm_agp_bind_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +#else /* __OS_HAS_AGP */ static inline void drm_free_agp (struct agp_memory * handle,int pages)
@@ -188,6 +193,7 @@ static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, {return -ENODEV ; } +#endif /* __OS_HAS_AGP */ #endif /* _DRM_AGPSUPPORT_H_ */
include/drm/drm_crtc.h +2 -2
@@ -31,8 +31,8 @@#include <linux/idr.h> #include <linux/fb.h> #include <linux/hdmi.h> -#include <drm/drm_mode.h> -#include <drm/drm_fourcc.h> +#include <uapi/drm/drm_mode.h> +#include <uapi/drm/drm_fourcc.h> #include <drm/drm_modeset_lock.h> struct drm_device ;
Signature · 1 line
2.1.0
Re: [PATCH 14/20] drm: move remaining includes in drmP.h to the top
On Fri, Aug 29, 2014 at 12:12:40PM +0200, David Herrmann wrote:
[...]
Quoted 1 line
include/drm/drmP.h +0
-0
[...]
include/drm/drmP.h line 65
Quoted 7 lines
include/drm/drmP.h +2
-1@@ -64,8 +61,14 @@#include <asm/pgalloc.h> #include <asm/uaccess.h> -#include <drm/drm.h> +#include <uapi/drm/drm.h> +#include <uapi/drm/drm_mode.h>
The uapi/ prefix is not strictly necessary since include/uapi is in the include path, but I guess it can't hurt to be explicit, so:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 15/20 drm: simplify drm_*_set_unique()
In reply to David HerrmannLets use kasprintf() to avoid pre-allocating the buffer. This is really nothing to optimize for speed and the input is trusted, so kasprintf() is just fine.
--- drivers/gpu/drm/drm_pci.c | 30 ++++++++---------------------- drivers/gpu/drm/drm_platform.c | 31 ++++++++----------------------- 2 files changed, 16 insertions(+), 45 deletions(-)
drivers/gpu/drm/drm_pci.c +8 -22
@@ -129,31 +129,17 @@ static int drm_get_pci_domain(struct drm_device *dev)static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) { -int len, ret; - master->unique_len =40 ; - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_size,GFP_KERNEL ); -if (master->unique ==NULL ) + master->unique =kasprintf (GFP_KERNEL ,"pci:%04x:%02x:%02x.%d" , +drm_get_pci_domain (dev), + dev->pdev->bus->number, +PCI_SLOT (dev->pdev->devfn), +PCI_FUNC (dev->pdev->devfn)); +if (!master->unique)return -ENOMEM ; - - len =snprintf (master->unique, master->unique_len, -"pci:%04x:%02x:%02x.%d" , -drm_get_pci_domain (dev), - dev->pdev->bus->number, -PCI_SLOT (dev->pdev->devfn), -PCI_FUNC (dev->pdev->devfn)); - -if (len >= master->unique_len) { -DRM_ERROR ("buffer overflow" ); - ret = -EINVAL ; - goto err; - }else - master->unique_len = len; - + master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len +1 ;return 0 ; -err: -return ret; } int drm_pci_set_unique(struct drm_device *dev,
drivers/gpu/drm/drm_platform.c +8 -23
@@ -70,35 +70,20 @@ err_free:static int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) { -int len, ret, id; - - master->unique_len =13 +strlen (dev->platformdev->name); - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_len +1 ,GFP_KERNEL ); - -if (master->unique ==NULL ) -return -ENOMEM ; +int id; id = dev->platformdev->id; - -/* if only a single instance of the platform device, id will be -* set to -1.. use 0 instead to avoid a funny looking bus-id: -*/ -if (id ==-1 ) +if (id <0 ) id =0 ; - len =snprintf (master->unique, master->unique_len, -"platform:%s:%02d" , dev->platformdev->name, id); - -if (len > master->unique_len) { -DRM_ERROR ("Unique buffer overflowed\n" ); - ret = -EINVAL ; - goto err; - } + master->unique =kasprintf (GFP_KERNEL ,"platform:%s:%02d" , + dev->platformdev->name, id); +if (!master->unique) +return -ENOMEM ; + master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len;return 0 ; -err: -return ret; }static struct drm_bus drm_platform_bus = {
Signature · 1 line
2.1.0
Re: [PATCH 15/20] drm: simplify drm_*_set_unique()
Quoted 18 lines · David Herrmann
Lets use
kasprintf()to avoid pre-allocating the buffer. This is really nothing to optimize for speed and the input is trusted, sokasprintf()is just fine.Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_pci.c | 30 ++++++++---------------------- drivers/gpu/drm/drm_platform.c | 31 ++++++++----------------------- 2 files changed, 16 insertions(+), 45 deletions(-)drivers/gpu/drm/drm_pci.c +0
-0@@ -129,31 +129,17 @@ static int drm_get_pci_domain(struct drm_device *dev)static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) {
drivers/gpu/drm/drm_pci.c static int drm_get_pci_domain(struct drm_device *dev) · line 136
Quoted 10 lines
drivers/gpu/drm/drm_pci.c +5
-5-int len, ret; - master->unique_len =40 ; - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_size,GFP_KERNEL ); -if (master->unique ==NULL ) + master->unique =kasprintf (GFP_KERNEL ,"pci:%04x:%02x:%02x.%d" , +drm_get_pci_domain (dev), + dev->pdev->bus->number, +PCI_SLOT (dev->pdev->devfn), +PCI_FUNC (dev->pdev->devfn));
I think we've been trying to standardize on aligning parameters on subsequent lines with the first parameter on the first line.
[...]
Quoted 2 lines
drivers/gpu/drm/drm_pci.c +2
-0+ master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len +1 ;
[...]
Quoted 1 line
drivers/gpu/drm/drm_platform.c +0
-0
[...]
Quoted 10 lines
static int
drm_platform_set_busid(struct drm_device *dev, struct drm_master *master){drivers/gpu/drm/drm_platform.c +0
-8-int len, ret, id; - - master->unique_len =13 +strlen (dev->platformdev->name); - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_len +1 ,GFP_KERNEL ); - -if (master->unique ==NULL ) -return -ENOMEM ;
drivers/gpu/drm/drm_platform.c err_free: · line 77
Quoted 10 lines
drivers/gpu/drm/drm_platform.c +2
-5+int id; id = dev->platformdev->id; - -/* if only a single instance of the platform device, id will be -* set to -1.. use 0 instead to avoid a funny looking bus-id: -*/ -if (id ==-1 ) +if (id <0 ) id =0 ;
Perhaps collapse all of the above into:
int id = (dev->platformdev->id < 0) ? 0 : dev->platformdev->id;
? Not that it matters much. I suspect we could easily remove all traces of this particular function in a next step.
Quoted 5 lines
drivers/gpu/drm/drm_platform.c +0
-5- len =snprintf (master->unique, master->unique_len, -"platform:%s:%02d" , dev->platformdev->name, id); - -if (len > master->unique_len) { -DRM_ERROR ("Unique buffer overflowed\n" );
drivers/gpu/drm/drm_platform.c err_free: · line 85
Quoted 10 lines
drivers/gpu/drm/drm_platform.c +6
-3- ret = -EINVAL ; - goto err; - } + master->unique =kasprintf (GFP_KERNEL ,"platform:%s:%02d" , + dev->platformdev->name, id); +if (!master->unique) +return -ENOMEM ; + master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len;
unique_size is weird. It seems to me like it should always be unique_len
+ 1. Why drm_platform_bus should be special escapes me. Also, after this patch it seems to be completely unused, so perhaps we should just drop it.
All of those comments can either be addressed in a separate patch (or ignored), though, so:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 15/20] drm: simplify drm_*_set_unique()
In reply to David HerrmannQuoted 5 lines · David Herrmann
Lets use
kasprintf()to avoid pre-allocating the buffer. This is really nothing to optimize for speed and the input is trusted, sokasprintf()is just fine.Signed-off-by David Herrmann <[email protected]>
Quoted 100 lines
--- drivers/gpu/drm/drm_pci.c | 30 ++++++++---------------------- drivers/gpu/drm/drm_platform.c | 31 ++++++++----------------------- 2 files changed, 16 insertions(+), 45 deletions(-)drivers/gpu/drm/drm_pci.c +8
-22@@ -129,31 +129,17 @@ static int drm_get_pci_domain(struct drm_device *dev)static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) { -int len, ret; - master->unique_len =40 ; - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_size,GFP_KERNEL ); -if (master->unique ==NULL ) + master->unique =kasprintf (GFP_KERNEL ,"pci:%04x:%02x:%02x.%d" , +drm_get_pci_domain (dev), + dev->pdev->bus->number, +PCI_SLOT (dev->pdev->devfn), +PCI_FUNC (dev->pdev->devfn)); +if (!master->unique)return -ENOMEM ; - - len =snprintf (master->unique, master->unique_len, -"pci:%04x:%02x:%02x.%d" , -drm_get_pci_domain (dev), - dev->pdev->bus->number, -PCI_SLOT (dev->pdev->devfn), -PCI_FUNC (dev->pdev->devfn)); - -if (len >= master->unique_len) { -DRM_ERROR ("buffer overflow" ); - ret = -EINVAL ; - goto err; - }else - master->unique_len = len; - + master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len +1 ;return 0 ; -err: -return ret; } int drm_pci_set_unique(struct drm_device *dev,drivers/gpu/drm/drm_platform.c +8
-23@@ -70,35 +70,20 @@ err_free:static int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) { -int len, ret, id; - - master->unique_len =13 +strlen (dev->platformdev->name); - master->unique_size = master->unique_len; - master->unique =kmalloc (master->unique_len +1 ,GFP_KERNEL ); - -if (master->unique ==NULL ) -return -ENOMEM ; +int id; id = dev->platformdev->id; - -/* if only a single instance of the platform device, id will be -* set to -1.. use 0 instead to avoid a funny looking bus-id: -*/ -if (id ==-1 ) +if (id <0 ) id =0 ; - len =snprintf (master->unique, master->unique_len, -"platform:%s:%02d" , dev->platformdev->name, id); - -if (len > master->unique_len) { -DRM_ERROR ("Unique buffer overflowed\n" ); - ret = -EINVAL ; - goto err; - } + master->unique =kasprintf (GFP_KERNEL ,"platform:%s:%02d" , + dev->platformdev->name, id); +if (!master->unique) +return -ENOMEM ; + master->unique_len =strlen (master->unique); + master->unique_size = master->unique_len;return 0 ; -err: -return ret; }static struct drm_bus drm_platform_bus = {Signature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 16/20 drm: drop unused drm_master->unique_size
In reply to David HerrmannThis field is unused and there is really no reason to optimize unique-allocations. Drop it.
--- drivers/gpu/drm/drm_ioctl.c | 1 - drivers/gpu/drm/drm_pci.c | 4 +--- drivers/gpu/drm/drm_platform.c | 1 - include/drm/drmP.h | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/drm_ioctl.c +0 -1
@@ -189,7 +189,6 @@ drm_unset_busid(struct drm_device *dev,kfree (master->unique); master->unique =NULL ; master->unique_len =0 ; - master->unique_size =0 ; }/**
drivers/gpu/drm/drm_pci.c +1 -3
@@ -138,7 +138,6 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)return -ENOMEM ; master->unique_len =strlen (master->unique); - master->unique_size = master->unique_len +1 ;return 0 ; }
@@ -149,8 +148,7 @@ int drm_pci_set_unique(struct drm_device *dev,int domain, bus, slot, func, ret; master->unique_len = u->unique_len; - master->unique_size = u->unique_len +1 ; - master->unique =kmalloc (master->unique_size,GFP_KERNEL ); + master->unique =kmalloc (master->unique_len +1 ,GFP_KERNEL );if (!master->unique) { ret = -ENOMEM ; goto err;
drivers/gpu/drm/drm_platform.c +0 -1
@@ -82,7 +82,6 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *masreturn -ENOMEM ; master->unique_len =strlen (master->unique); - master->unique_size = master->unique_len;return 0 ; }
include/drm/drmP.h +0 -2
@@ -574,7 +574,6 @@ struct drm_gem_object {* @minor: Link back to minor char device we are master for. Immutable. * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. * @unique_len: Length of unique field. Protected by drm_global_mutex. -* @unique_size: Amount allocated. Protected by drm_global_mutex. * @magiclist: Hash of used authentication tokens. Protected by struct_mutex. * @magicfree: List of used authentication tokens. Protected by struct_mutex. * @lock: DRI lock information.
@@ -585,7 +584,6 @@ struct drm_master {struct drm_minor *minor;char *unique;int unique_len; -int unique_size;struct drm_open_hash magiclist;struct list_head magicfree;struct drm_lock_data lock;
Signature · 1 line
2.1.0
Re: [PATCH 16/20] drm: drop unused drm_master->unique_size
Quoted 10 lines · David Herrmann
This field is unused and there is really no reason to optimize unique-allocations. Drop it.
Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_ioctl.c | 1 - drivers/gpu/drm/drm_pci.c | 4 +--- drivers/gpu/drm/drm_platform.c | 1 - include/drm/drmP.h | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-)
Now that's what I get for not reading mails in advance. Anyway I'm glad we agree on the uselessness of unique_size. =)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 16/20] drm: drop unused drm_master->unique_size
In reply to David HerrmannQuoted 4 lines · David Herrmann
This field is unused and there is really no reason to optimize unique-allocations. Drop it.
Signed-off-by David Herrmann <[email protected]>
Quoted 76 lines
--- drivers/gpu/drm/drm_ioctl.c | 1 - drivers/gpu/drm/drm_pci.c | 4 +--- drivers/gpu/drm/drm_platform.c | 1 - include/drm/drmP.h | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-)drivers/gpu/drm/drm_ioctl.c +0
-1@@ -189,7 +189,6 @@ drm_unset_busid(struct drm_device *dev,kfree (master->unique); master->unique =NULL ; master->unique_len =0 ; - master->unique_size =0 ; }/** drivers/gpu/drm/drm_pci.c +1
-3@@ -138,7 +138,6 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)return -ENOMEM ; master->unique_len =strlen (master->unique); - master->unique_size = master->unique_len +1 ;return 0 ; }@@ -149,8 +148,7 @@ int drm_pci_set_unique(struct drm_device *dev,int domain, bus, slot, func, ret; master->unique_len = u->unique_len; - master->unique_size = u->unique_len +1 ; - master->unique =kmalloc (master->unique_size,GFP_KERNEL ); + master->unique =kmalloc (master->unique_len +1 ,GFP_KERNEL );if (!master->unique) { ret = -ENOMEM ; goto err;drivers/gpu/drm/drm_platform.c +0
-1@@ -82,7 +82,6 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *masreturn -ENOMEM ; master->unique_len =strlen (master->unique); - master->unique_size = master->unique_len;return 0 ; }include/drm/drmP.h +0
-2@@ -574,7 +574,6 @@ struct drm_gem_object {* @minor: Link back to minor char device we are master for. Immutable. * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. * @unique_len: Length of unique field. Protected by drm_global_mutex. -* @unique_size: Amount allocated. Protected by drm_global_mutex. * @magiclist: Hash of used authentication tokens. Protected by struct_mutex. * @magicfree: List of used authentication tokens. Protected by struct_mutex. * @lock: DRI lock information. @@ -585,7 +584,6 @@ struct drm_master {struct drm_minor *minor;char *unique;int unique_len; -int unique_size;struct drm_open_hash magiclist;struct list_head magicfree;struct drm_lock_data lock;Signature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 17/20 drm: add driver->set_busid() callback
In reply to David HerrmannOne step closer to dropping all the drm_bus_* code:
Add a driver->set_busid() callback and make all drivers use the generic helpers. Nouveau is the only driver that uses two different bus-types with the same drm_driver. This is totally broken if both buses are available on the same machine (unlikely, but lets be safe). Therefore, we create two different drivers for each platform during module_init() and set the set_busid() callback respectively.
--- drivers/gpu/drm/armada/armada_drv.c | 1 + drivers/gpu/drm/ast/ast_drv.c | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 8 +++++++- drivers/gpu/drm/drm_pci.c | 3 ++- drivers/gpu/drm/drm_platform.c | 3 ++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/i810/i810_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/mga/mga_drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 19 +++++++++++++------ drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/qxl/qxl_drv.c | 1 + drivers/gpu/drm/r128/r128_drv.c | 1 + drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 + drivers/gpu/drm/savage/savage_drv.c | 1 + drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 + drivers/gpu/drm/sis/sis_drv.c | 1 + drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 + drivers/gpu/drm/udl/udl_drv.c | 6 ++++++ drivers/gpu/drm/via/via_drv.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + drivers/staging/imx-drm/imx-drm-core.c | 1 + include/drm/drmP.h | 3 +++ 30 files changed, 58 insertions(+), 9 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +1 -0
@@ -308,6 +308,7 @@ static struct drm_driver armada_drm_driver = { .postclose = NULL, .lastclose = armada_drm_lastclose, .unload = armada_drm_unload, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = armada_drm_enable_vblank, .disable_vblank = armada_drm_disable_vblank,
drivers/gpu/drm/ast/ast_drv.c +1 -0
@@ -199,6 +199,7 @@ static struct drm_driver driver = { .load = ast_driver_load, .unload = ast_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &ast_fops, .name = DRIVER_NAME,
drivers/gpu/drm/bochs/bochs_drv.c +1 -0
@@ -82,6 +82,7 @@ static struct drm_driver bochs_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET, .load = bochs_load, .unload = bochs_unload, + .set_busid = drm_pci_set_busid, .fops = &bochs_fops, .name = "bochs-drm", .desc = "bochs dispi vga interface (qemu stdvga)",
drivers/gpu/drm/cirrus/cirrus_drv.c +1 -0
@@ -128,6 +128,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM, .load = cirrus_driver_load, .unload = cirrus_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &cirrus_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,
drivers/gpu/drm/drm_ioctl.c +7 -1
@@ -244,7 +244,13 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)if (master->unique !=NULL )drm_unset_busid (dev, master); -if (dev->driver->bus && dev->driver->bus->set_busid) { +if (dev->driver->set_busid) { + ret = dev->driver->set_busid (dev, master); +if (ret) { +drm_unset_busid (dev, master); +return ret; + } + }else if (dev->driver->bus && dev->driver->bus->set_busid) { ret = dev->driver->bus->set_busid (dev, master);if (ret) {drm_unset_busid (dev, master);
drivers/gpu/drm/drm_pci.c +2 -1
@@ -127,7 +127,7 @@ static int drm_get_pci_domain(struct drm_device *dev)return pci_domain_nr (dev->pdev->bus); } -static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) +int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) { master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d", drm_get_pci_domain(dev),
@@ -140,6 +140,7 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) master->unique_len =strlen (master->unique);return 0 ; } +EXPORT_SYMBOL (drm_pci_set_busid); int drm_pci_set_unique(struct drm_device *dev, struct drm_master *master,
drivers/gpu/drm/drm_platform.c +2 -1
@@ -68,7 +68,7 @@ err_free:return ret; } -static int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) +int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) {int id;
@@ -84,6 +84,7 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas master->unique_len =strlen (master->unique);return 0 ; } +EXPORT_SYMBOL (drm_platform_set_busid);static struct drm_bus drm_platform_bus = { .set_busid = drm_platform_set_busid,
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -0
@@ -330,6 +330,7 @@ static struct drm_driver exynos_drm_driver = { .preclose = exynos_drm_preclose, .lastclose = exynos_drm_lastclose, .postclose = exynos_drm_postclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = exynos_drm_crtc_enable_vblank, .disable_vblank = exynos_drm_crtc_disable_vblank,
drivers/gpu/drm/gma500/psb_drv.c +1 -0
@@ -476,6 +476,7 @@ static struct drm_driver driver = { .unload = psb_driver_unload, .lastclose = psb_driver_lastclose, .preclose = psb_driver_preclose, + .set_busid = drm_pci_set_busid, .num_ioctls = ARRAY_SIZE(psb_ioctls), .device_is_agp = psb_driver_device_is_agp,
drivers/gpu/drm/i810/i810_drv.c +1 -0
@@ -63,6 +63,7 @@ static struct drm_driver driver = { .load = i810_driver_load, .lastclose = i810_driver_lastclose, .preclose = i810_driver_preclose, + .set_busid = drm_pci_set_busid, .device_is_agp = i810_driver_device_is_agp, .dma_quiescent = i810_driver_dma_quiescent, .ioctls = i810_ioctls,
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -1572,6 +1572,7 @@ static struct drm_driver driver = { .lastclose = i915_driver_lastclose, .preclose = i915_driver_preclose, .postclose = i915_driver_postclose, + .set_busid = drm_pci_set_busid,/* Used in place of i915_pm_ops for non-DRIVER_MODESET */ .suspend = i915_suspend,
drivers/gpu/drm/mga/mga_drv.c +1 -0
@@ -64,6 +64,7 @@ static struct drm_driver driver = { .load = mga_driver_load, .unload = mga_driver_unload, .lastclose = mga_driver_lastclose, + .set_busid = drm_pci_set_busid, .dma_quiescent = mga_driver_dma_quiescent, .device_is_agp = mga_driver_device_is_agp, .get_vblank_counter = mga_get_vblank_counter,
drivers/gpu/drm/mgag200/mgag200_drv.c +1 -0
@@ -91,6 +91,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET, .load = mgag200_driver_load, .unload = mgag200_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &mgag200_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,
drivers/gpu/drm/msm/msm_drv.c +1 -0
@@ -836,6 +836,7 @@ static struct drm_driver msm_driver = { .open = msm_open, .preclose = msm_preclose, .lastclose = msm_lastclose, + .set_busid = drm_platform_set_busid, .irq_handler = msm_irq, .irq_preinstall = msm_irq_preinstall, .irq_postinstall = msm_irq_postinstall,
drivers/gpu/drm/nouveau/nouveau_drm.c +13 -6
@@ -73,7 +73,9 @@ MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1int nouveau_runtime_pm =-1 ;module_param_named (runpm, nouveau_runtime_pm, int,0400 ); -static struct drm_driver driver; +static struct drm_driver driver_stub; +static struct drm_driver driver_pci; +static struct drm_driver driver_platform;static u64 nouveau_pci_name (struct pci_dev *pdev)
@@ -322,7 +324,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,pci_set_master (pdev); - ret =drm_get_pci_dev (pdev, pent, &driver); + ret =drm_get_pci_dev (pdev, pent, &driver_pci);if (ret) {nouveau_object_ref (NULL , (struct nouveau_object **)&device);return ret;
@@ -855,7 +857,7 @@ nouveau_driver_fops = { };static struct drm_driver -driver = { +driver_stub = { .driver_features =DRIVER_USE_AGP |DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_RENDER ,
@@ -1061,7 +1063,7 @@ nouveau_platform_device_create_(struct platform_device *pdev, int size,if (err)return ERR_PTR (err); - drm =drm_dev_alloc (&driver, &pdev->dev); + drm =drm_dev_alloc (&driver_platform, &pdev->dev);if (!drm) { err = -ENOMEM ; goto err_free;
@@ -1086,6 +1088,11 @@ EXPORT_SYMBOL(nouveau_platform_device_create_);static int __init nouveau_drm_init (void ) { + driver_pci = driver_stub; + driver_pci.set_busid = drm_pci_set_busid; + driver_platform = driver_stub; + driver_platform.set_busid = drm_platform_set_busid; +if (nouveau_modeset ==-1 ) {#ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force ())
@@ -1097,7 +1104,7 @@ nouveau_drm_init(void)return 0 ;nouveau_register_dsm_handler (); -return drm_pci_init (&driver, &nouveau_drm_pci_driver); +return drm_pci_init (&driver_pci, &nouveau_drm_pci_driver); }static void __exit
@@ -1106,7 +1113,7 @@ nouveau_drm_exit(void)if (!nouveau_modeset)return ; -drm_pci_exit (&driver, &nouveau_drm_pci_driver); +drm_pci_exit (&driver_pci, &nouveau_drm_pci_driver);nouveau_unregister_dsm_handler (); }
drivers/gpu/drm/omapdrm/omap_drv.c +1 -0
@@ -629,6 +629,7 @@ static struct drm_driver omap_drm_driver = { .lastclose = dev_lastclose, .preclose = dev_preclose, .postclose = dev_postclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = omap_irq_enable_vblank, .disable_vblank = omap_irq_disable_vblank,
drivers/gpu/drm/qxl/qxl_drv.c +1 -0
@@ -216,6 +216,7 @@ static struct drm_driver qxl_driver = { DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, .load = qxl_driver_load, .unload = qxl_driver_unload, + .set_busid = drm_pci_set_busid, .dumb_create = qxl_mode_dumb_create, .dumb_map_offset = qxl_mode_dumb_mmap,
drivers/gpu/drm/r128/r128_drv.c +1 -0
@@ -62,6 +62,7 @@ static struct drm_driver driver = { .load = r128_driver_load, .preclose = r128_driver_preclose, .lastclose = r128_driver_lastclose, + .set_busid = drm_pci_set_busid, .get_vblank_counter = r128_get_vblank_counter, .enable_vblank = r128_enable_vblank, .disable_vblank = r128_disable_vblank,
drivers/gpu/drm/radeon/radeon_drv.c +2 -0
@@ -328,6 +328,7 @@ static struct drm_driver driver_old = { .preclose = radeon_driver_preclose, .postclose = radeon_driver_postclose, .lastclose = radeon_driver_lastclose, + .set_busid = drm_pci_set_busid, .unload = radeon_driver_unload, .suspend = radeon_suspend, .resume = radeon_resume,
@@ -551,6 +552,7 @@ static struct drm_driver kms_driver = { .preclose = radeon_driver_preclose_kms, .postclose = radeon_driver_postclose_kms, .lastclose = radeon_driver_lastclose_kms, + .set_busid = drm_pci_set_busid, .unload = radeon_driver_unload_kms, .get_vblank_counter = radeon_get_vblank_counter_kms, .enable_vblank = radeon_enable_vblank_kms,
drivers/gpu/drm/rcar-du/rcar_du_drv.c +1 -0
@@ -158,6 +158,7 @@ static struct drm_driver rcar_du_driver = { .unload = rcar_du_unload, .preclose = rcar_du_preclose, .lastclose = rcar_du_lastclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = rcar_du_enable_vblank, .disable_vblank = rcar_du_disable_vblank,
drivers/gpu/drm/savage/savage_drv.c +1 -0
@@ -57,6 +57,7 @@ static struct drm_driver driver = { .preclose = savage_reclaim_buffers, .lastclose = savage_driver_lastclose, .unload = savage_driver_unload, + .set_busid = drm_pci_set_busid, .ioctls = savage_ioctls, .dma_ioctl = savage_bci_buffers, .fops = &savage_driver_fops,
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1 -0
@@ -267,6 +267,7 @@ static struct drm_driver shmob_drm_driver = { .load = shmob_drm_load, .unload = shmob_drm_unload, .preclose = shmob_drm_preclose, + .set_busid = drm_platform_set_busid, .irq_handler = shmob_drm_irq, .get_vblank_counter = drm_vblank_count, .enable_vblank = shmob_drm_enable_vblank,
drivers/gpu/drm/sis/sis_drv.c +1 -0
@@ -108,6 +108,7 @@ static struct drm_driver driver = { .open = sis_driver_open, .preclose = sis_reclaim_buffers_locked, .postclose = sis_driver_postclose, + .set_busid = drm_pci_set_busid, .dma_quiescent = sis_idle, .lastclose = sis_lastclose, .ioctls = sis_ioctls,
drivers/gpu/drm/tdfx/tdfx_drv.c +1 -0
@@ -55,6 +55,7 @@ static const struct file_operations tdfx_driver_fops = { };static struct drm_driver driver = { + .set_busid = drm_pci_set_busid, .fops = &tdfx_driver_fops, .name =DRIVER_NAME , .desc =DRIVER_DESC ,
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -0
@@ -502,6 +502,7 @@ static struct drm_driver tilcdc_driver = { .unload = tilcdc_unload, .preclose = tilcdc_preclose, .lastclose = tilcdc_lastclose, + .set_busid = drm_platform_set_busid, .irq_handler = tilcdc_irq, .irq_preinstall = tilcdc_irq_preinstall, .irq_postinstall = tilcdc_irq_postinstall,
drivers/gpu/drm/udl/udl_drv.c +6 -0
@@ -34,6 +34,11 @@ MODULE_DEVICE_TABLE(usb, id_table);MODULE_LICENSE ("GPL" ); +static int udl_driver_set_busid (struct drm_device *d,struct drm_master *m) +{ +return 0 ; +} +static int udl_usb_probe (struct usb_interface *interface,const struct usb_device_id *id) {
@@ -75,6 +80,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, .load = udl_driver_load, .unload = udl_driver_unload, + .set_busid = udl_driver_set_busid,/* gem hooks */ .gem_free_object = udl_gem_free_object,
drivers/gpu/drm/via/via_drv.c +1 -0
@@ -79,6 +79,7 @@ static struct drm_driver driver = { .open = via_driver_open, .preclose = via_reclaim_buffers_locked, .postclose = via_driver_postclose, + .set_busid = drm_pci_set_busid, .context_dtor = via_final_context, .get_vblank_counter = via_get_vblank_counter, .enable_vblank = via_enable_vblank,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -0
@@ -1418,6 +1418,7 @@ static struct drm_driver driver = { .open = vmw_driver_open, .preclose = vmw_preclose, .postclose = vmw_postclose, + .set_busid = drm_pci_set_busid, .dumb_create = vmw_dumb_create, .dumb_map_offset = vmw_dumb_map_offset,
drivers/staging/imx-drm/imx-drm-core.c +1 -0
@@ -528,6 +528,7 @@ static struct drm_driver imx_drm_driver = { .unload = imx_drm_driver_unload, .lastclose = imx_drm_driver_lastclose, .preclose = imx_drm_driver_preclose, + .set_busid = drm_platform_set_busid, .gem_free_object = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create,
include/drm/drmP.h +3 -0
@@ -627,6 +627,7 @@ struct drm_driver {int (*dma_ioctl) (struct drm_device *dev,void *data,struct drm_file *file_priv);int (*dma_quiescent) (struct drm_device *);int (*context_dtor) (struct drm_device *dev,int context); +int (*set_busid)(struct drm_device *dev,struct drm_master *master);/** * get_vblank_counter - get raw hardware vblank counter
@@ -1498,6 +1499,7 @@ extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);extern int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent,struct drm_driver *driver); +extern int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master);#define DRM_PCIE_SPEED_25 1#define DRM_PCIE_SPEED_50 2
@@ -1507,6 +1509,7 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);/* platform section */ extern int drm_platform_init (struct drm_driver *driver,struct platform_device *platform_device); +extern int drm_platform_set_busid (struct drm_device *d,struct drm_master *m);/* returns true if currently okay to sleep */ static __inline__bool drm_can_sleep (void )
Signature · 1 line
2.1.0
Re: [PATCH 17/20] drm: add driver->set_busid() callback
Quoted 5 lines · David Herrmann
One step closer to dropping all the drm_bus_* code:
Add adriver->set_busid()callback and make all drivers use the generic helpers. Nouveau is the only driver that uses two different bus-types with the samedrm_driver. This is totally broken if both buses are available on the same machine (unlikely, but lets be safe).
It's not at all unlikely. There are quite a few people using nouveau to drive an discrete GPU over PCIe on Tegra K1.
I've also been noticing lately (and I'm not sure why I didn't see it earlier, possibly because the relevant patches weren't in nouveau yet) that the nouveau kernel driver crashes when running X on Tegra K1 with nouveau (and the gk20a GPU) enabled. The reason being that the device is wrongfully marked as drm_pci_bus.
Quoted 3 lines
Therefore, we create two
different drivers for each platform duringmodule_init()and set theset_busid()callback respectively.
From what I can tell this patch should fix the above-mentioned issue, so thanks for that. =) I do have local changes that do mostly the same thing, but slightly less elegantly.
Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_drm.c +0
-0
[...]
drivers/gpu/drm/nouveau/nouveau_drm.c EXPORT_SYMBOL(nouveau_platform_device_create_); · line 1094
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +4
-0@@ -1086,6 +1088,11 @@ EXPORT_SYMBOL(nouveau_platform_device_create_);static int __init nouveau_drm_init (void ) { + driver_pci = driver_stub; + driver_pci.set_busid = drm_pci_set_busid; + driver_platform = driver_stub; + driver_platform.set_busid = drm_platform_set_busid;
I think at some point we may also want to remove the DRIVER_MODESET flag here. It probably won't be that easy because DRIVER_MODESET still implies !legacy. I thought I had submitted a patch series at some point to fix that (and got rid of the useless /dev/dri/cardX for render-only devices), but I don't quite remember what became of it. I seem to remember that Daniel didn't like it, but I can't recall the reason.
Quoted 1 line
include/drm/drmP.h +0
-0
[...]
include/drm/drmP.h extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask); · line 1512
Quoted 5 lines
include/drm/drmP.h +1
-0@@ -1507,6 +1509,7 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);/* platform section */ extern int drm_platform_init (struct drm_driver *driver,struct platform_device *platform_device); +extern int drm_platform_set_busid (struct drm_device *d,struct drm_master *m);
One step closer to getting rid of this altogether.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 17/20] drm: add driver->set_busid() callback
In reply to David HerrmannQuoted 9 lines · David Herrmann
One step closer to dropping all the drm_bus_* code:
Add adriver->set_busid()callback and make all drivers use the generic helpers. Nouveau is the only driver that uses two different bus-types with the samedrm_driver. This is totally broken if both buses are available on the same machine (unlikely, but lets be safe). Therefore, we create two different drivers for each platform duringmodule_init()and set theset_busid()callback respectively.Signed-off-by David Herrmann <[email protected]>
This has a bit a midlayer smell to it tbh, we don't really need a set_busid callback I think. Instead there's just two cases:
- The crazy implementation for pci devices. But we already have dev->pdev, so the core can figure this out itself.
- Everyone else just sets a static name. For those I think we should just add a drm_dev_set_busid function which they can call in their driver-load function. Well maybe different versions for platform drivers and stuff.
Thanks, Daniel
Quoted 517 lines
--- drivers/gpu/drm/armada/armada_drv.c | 1 + drivers/gpu/drm/ast/ast_drv.c | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 8 +++++++- drivers/gpu/drm/drm_pci.c | 3 ++- drivers/gpu/drm/drm_platform.c | 3 ++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/i810/i810_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/mga/mga_drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 19 +++++++++++++------ drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/qxl/qxl_drv.c | 1 + drivers/gpu/drm/r128/r128_drv.c | 1 + drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 + drivers/gpu/drm/savage/savage_drv.c | 1 + drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 + drivers/gpu/drm/sis/sis_drv.c | 1 + drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 + drivers/gpu/drm/udl/udl_drv.c | 6 ++++++ drivers/gpu/drm/via/via_drv.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + drivers/staging/imx-drm/imx-drm-core.c | 1 + include/drm/drmP.h | 3 +++ 30 files changed, 58 insertions(+), 9 deletions(-)drivers/gpu/drm/armada/armada_drv.c +1
-0@@ -308,6 +308,7 @@ static struct drm_driver armada_drm_driver = { .postclose = NULL, .lastclose = armada_drm_lastclose, .unload = armada_drm_unload, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = armada_drm_enable_vblank, .disable_vblank = armada_drm_disable_vblank,drivers/gpu/drm/ast/ast_drv.c +1
-0@@ -199,6 +199,7 @@ static struct drm_driver driver = { .load = ast_driver_load, .unload = ast_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &ast_fops, .name = DRIVER_NAME,drivers/gpu/drm/bochs/bochs_drv.c +1
-0@@ -82,6 +82,7 @@ static struct drm_driver bochs_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET, .load = bochs_load, .unload = bochs_unload, + .set_busid = drm_pci_set_busid, .fops = &bochs_fops, .name = "bochs-drm", .desc = "bochs dispi vga interface (qemu stdvga)",drivers/gpu/drm/cirrus/cirrus_drv.c +1
-0@@ -128,6 +128,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM, .load = cirrus_driver_load, .unload = cirrus_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &cirrus_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,drivers/gpu/drm/drm_ioctl.c +7
-1@@ -244,7 +244,13 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)if (master->unique !=NULL )drm_unset_busid (dev, master); -if (dev->driver->bus && dev->driver->bus->set_busid) { +if (dev->driver->set_busid) { + ret = dev->driver->set_busid (dev, master); +if (ret) { +drm_unset_busid (dev, master); +return ret; + } + }else if (dev->driver->bus && dev->driver->bus->set_busid) { ret = dev->driver->bus->set_busid (dev, master);if (ret) {drm_unset_busid (dev, master);drivers/gpu/drm/drm_pci.c +2
-1@@ -127,7 +127,7 @@ static int drm_get_pci_domain(struct drm_device *dev)return pci_domain_nr (dev->pdev->bus); } -static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) +int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) { master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d", drm_get_pci_domain(dev),@@ -140,6 +140,7 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) master->unique_len =strlen (master->unique);return 0 ; } +EXPORT_SYMBOL (drm_pci_set_busid); int drm_pci_set_unique(struct drm_device *dev, struct drm_master *master,drivers/gpu/drm/drm_platform.c +2
-1@@ -68,7 +68,7 @@ err_free:return ret; } -static int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) +int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) {int id;@@ -84,6 +84,7 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas master->unique_len =strlen (master->unique);return 0 ; } +EXPORT_SYMBOL (drm_platform_set_busid);static struct drm_bus drm_platform_bus = { .set_busid = drm_platform_set_busid,drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-0@@ -330,6 +330,7 @@ static struct drm_driver exynos_drm_driver = { .preclose = exynos_drm_preclose, .lastclose = exynos_drm_lastclose, .postclose = exynos_drm_postclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = exynos_drm_crtc_enable_vblank, .disable_vblank = exynos_drm_crtc_disable_vblank,drivers/gpu/drm/gma500/psb_drv.c +1
-0@@ -476,6 +476,7 @@ static struct drm_driver driver = { .unload = psb_driver_unload, .lastclose = psb_driver_lastclose, .preclose = psb_driver_preclose, + .set_busid = drm_pci_set_busid, .num_ioctls = ARRAY_SIZE(psb_ioctls), .device_is_agp = psb_driver_device_is_agp,drivers/gpu/drm/i810/i810_drv.c +1
-0@@ -63,6 +63,7 @@ static struct drm_driver driver = { .load = i810_driver_load, .lastclose = i810_driver_lastclose, .preclose = i810_driver_preclose, + .set_busid = drm_pci_set_busid, .device_is_agp = i810_driver_device_is_agp, .dma_quiescent = i810_driver_dma_quiescent, .ioctls = i810_ioctls,drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -1572,6 +1572,7 @@ static struct drm_driver driver = { .lastclose = i915_driver_lastclose, .preclose = i915_driver_preclose, .postclose = i915_driver_postclose, + .set_busid = drm_pci_set_busid,/* Used in place of i915_pm_ops for non-DRIVER_MODESET */ .suspend = i915_suspend,drivers/gpu/drm/mga/mga_drv.c +1
-0@@ -64,6 +64,7 @@ static struct drm_driver driver = { .load = mga_driver_load, .unload = mga_driver_unload, .lastclose = mga_driver_lastclose, + .set_busid = drm_pci_set_busid, .dma_quiescent = mga_driver_dma_quiescent, .device_is_agp = mga_driver_device_is_agp, .get_vblank_counter = mga_get_vblank_counter,drivers/gpu/drm/mgag200/mgag200_drv.c +1
-0@@ -91,6 +91,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET, .load = mgag200_driver_load, .unload = mgag200_driver_unload, + .set_busid = drm_pci_set_busid, .fops = &mgag200_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,drivers/gpu/drm/msm/msm_drv.c +1
-0@@ -836,6 +836,7 @@ static struct drm_driver msm_driver = { .open = msm_open, .preclose = msm_preclose, .lastclose = msm_lastclose, + .set_busid = drm_platform_set_busid, .irq_handler = msm_irq, .irq_preinstall = msm_irq_preinstall, .irq_postinstall = msm_irq_postinstall,drivers/gpu/drm/nouveau/nouveau_drm.c +13
-6@@ -73,7 +73,9 @@ MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1int nouveau_runtime_pm =-1 ;module_param_named (runpm, nouveau_runtime_pm, int,0400 ); -static struct drm_driver driver; +static struct drm_driver driver_stub; +static struct drm_driver driver_pci; +static struct drm_driver driver_platform;static u64 nouveau_pci_name (struct pci_dev *pdev)@@ -322,7 +324,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,pci_set_master (pdev); - ret =drm_get_pci_dev (pdev, pent, &driver); + ret =drm_get_pci_dev (pdev, pent, &driver_pci);if (ret) {nouveau_object_ref (NULL , (struct nouveau_object **)&device);return ret;@@ -855,7 +857,7 @@ nouveau_driver_fops = { };static struct drm_driver -driver = { +driver_stub = { .driver_features =DRIVER_USE_AGP |DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_RENDER ,@@ -1061,7 +1063,7 @@ nouveau_platform_device_create_(struct platform_device *pdev, int size,if (err)return ERR_PTR (err); - drm =drm_dev_alloc (&driver, &pdev->dev); + drm =drm_dev_alloc (&driver_platform, &pdev->dev);if (!drm) { err = -ENOMEM ; goto err_free;@@ -1086,6 +1088,11 @@ EXPORT_SYMBOL(nouveau_platform_device_create_);static int __init nouveau_drm_init (void ) { + driver_pci = driver_stub; + driver_pci.set_busid = drm_pci_set_busid; + driver_platform = driver_stub; + driver_platform.set_busid = drm_platform_set_busid; +if (nouveau_modeset ==-1 ) {#ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force ())@@ -1097,7 +1104,7 @@ nouveau_drm_init(void)return 0 ;nouveau_register_dsm_handler (); -return drm_pci_init (&driver, &nouveau_drm_pci_driver); +return drm_pci_init (&driver_pci, &nouveau_drm_pci_driver); }static void __exit@@ -1106,7 +1113,7 @@ nouveau_drm_exit(void)if (!nouveau_modeset)return ; -drm_pci_exit (&driver, &nouveau_drm_pci_driver); +drm_pci_exit (&driver_pci, &nouveau_drm_pci_driver);nouveau_unregister_dsm_handler (); }drivers/gpu/drm/omapdrm/omap_drv.c +1
-0@@ -629,6 +629,7 @@ static struct drm_driver omap_drm_driver = { .lastclose = dev_lastclose, .preclose = dev_preclose, .postclose = dev_postclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = omap_irq_enable_vblank, .disable_vblank = omap_irq_disable_vblank,drivers/gpu/drm/qxl/qxl_drv.c +1
-0@@ -216,6 +216,7 @@ static struct drm_driver qxl_driver = { DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, .load = qxl_driver_load, .unload = qxl_driver_unload, + .set_busid = drm_pci_set_busid, .dumb_create = qxl_mode_dumb_create, .dumb_map_offset = qxl_mode_dumb_mmap,drivers/gpu/drm/r128/r128_drv.c +1
-0@@ -62,6 +62,7 @@ static struct drm_driver driver = { .load = r128_driver_load, .preclose = r128_driver_preclose, .lastclose = r128_driver_lastclose, + .set_busid = drm_pci_set_busid, .get_vblank_counter = r128_get_vblank_counter, .enable_vblank = r128_enable_vblank, .disable_vblank = r128_disable_vblank,drivers/gpu/drm/radeon/radeon_drv.c +2
-0@@ -328,6 +328,7 @@ static struct drm_driver driver_old = { .preclose = radeon_driver_preclose, .postclose = radeon_driver_postclose, .lastclose = radeon_driver_lastclose, + .set_busid = drm_pci_set_busid, .unload = radeon_driver_unload, .suspend = radeon_suspend, .resume = radeon_resume,@@ -551,6 +552,7 @@ static struct drm_driver kms_driver = { .preclose = radeon_driver_preclose_kms, .postclose = radeon_driver_postclose_kms, .lastclose = radeon_driver_lastclose_kms, + .set_busid = drm_pci_set_busid, .unload = radeon_driver_unload_kms, .get_vblank_counter = radeon_get_vblank_counter_kms, .enable_vblank = radeon_enable_vblank_kms,drivers/gpu/drm/rcar-du/rcar_du_drv.c +1
-0@@ -158,6 +158,7 @@ static struct drm_driver rcar_du_driver = { .unload = rcar_du_unload, .preclose = rcar_du_preclose, .lastclose = rcar_du_lastclose, + .set_busid = drm_platform_set_busid, .get_vblank_counter = drm_vblank_count, .enable_vblank = rcar_du_enable_vblank, .disable_vblank = rcar_du_disable_vblank,drivers/gpu/drm/savage/savage_drv.c +1
-0@@ -57,6 +57,7 @@ static struct drm_driver driver = { .preclose = savage_reclaim_buffers, .lastclose = savage_driver_lastclose, .unload = savage_driver_unload, + .set_busid = drm_pci_set_busid, .ioctls = savage_ioctls, .dma_ioctl = savage_bci_buffers, .fops = &savage_driver_fops,drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-0@@ -267,6 +267,7 @@ static struct drm_driver shmob_drm_driver = { .load = shmob_drm_load, .unload = shmob_drm_unload, .preclose = shmob_drm_preclose, + .set_busid = drm_platform_set_busid, .irq_handler = shmob_drm_irq, .get_vblank_counter = drm_vblank_count, .enable_vblank = shmob_drm_enable_vblank,drivers/gpu/drm/sis/sis_drv.c +1
-0@@ -108,6 +108,7 @@ static struct drm_driver driver = { .open = sis_driver_open, .preclose = sis_reclaim_buffers_locked, .postclose = sis_driver_postclose, + .set_busid = drm_pci_set_busid, .dma_quiescent = sis_idle, .lastclose = sis_lastclose, .ioctls = sis_ioctls,drivers/gpu/drm/tdfx/tdfx_drv.c +1
-0@@ -55,6 +55,7 @@ static const struct file_operations tdfx_driver_fops = { };static struct drm_driver driver = { + .set_busid = drm_pci_set_busid, .fops = &tdfx_driver_fops, .name =DRIVER_NAME , .desc =DRIVER_DESC ,drivers/gpu/drm/tilcdc/tilcdc_drv.c +1
-0@@ -502,6 +502,7 @@ static struct drm_driver tilcdc_driver = { .unload = tilcdc_unload, .preclose = tilcdc_preclose, .lastclose = tilcdc_lastclose, + .set_busid = drm_platform_set_busid, .irq_handler = tilcdc_irq, .irq_preinstall = tilcdc_irq_preinstall, .irq_postinstall = tilcdc_irq_postinstall,drivers/gpu/drm/udl/udl_drv.c +6
-0@@ -34,6 +34,11 @@ MODULE_DEVICE_TABLE(usb, id_table);MODULE_LICENSE ("GPL" ); +static int udl_driver_set_busid (struct drm_device *d,struct drm_master *m) +{ +return 0 ; +} +static int udl_usb_probe (struct usb_interface *interface,const struct usb_device_id *id) {@@ -75,6 +80,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, .load = udl_driver_load, .unload = udl_driver_unload, + .set_busid = udl_driver_set_busid,/* gem hooks */ .gem_free_object = udl_gem_free_object,drivers/gpu/drm/via/via_drv.c +1
-0@@ -79,6 +79,7 @@ static struct drm_driver driver = { .open = via_driver_open, .preclose = via_reclaim_buffers_locked, .postclose = via_driver_postclose, + .set_busid = drm_pci_set_busid, .context_dtor = via_final_context, .get_vblank_counter = via_get_vblank_counter, .enable_vblank = via_enable_vblank,drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1
-0@@ -1418,6 +1418,7 @@ static struct drm_driver driver = { .open = vmw_driver_open, .preclose = vmw_preclose, .postclose = vmw_postclose, + .set_busid = drm_pci_set_busid, .dumb_create = vmw_dumb_create, .dumb_map_offset = vmw_dumb_map_offset,drivers/staging/imx-drm/imx-drm-core.c +1
-0@@ -528,6 +528,7 @@ static struct drm_driver imx_drm_driver = { .unload = imx_drm_driver_unload, .lastclose = imx_drm_driver_lastclose, .preclose = imx_drm_driver_preclose, + .set_busid = drm_platform_set_busid, .gem_free_object = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create,include/drm/drmP.h +3
-0@@ -627,6 +627,7 @@ struct drm_driver {int (*dma_ioctl) (struct drm_device *dev,void *data,struct drm_file *file_priv);int (*dma_quiescent) (struct drm_device *);int (*context_dtor) (struct drm_device *dev,int context); +int (*set_busid)(struct drm_device *dev,struct drm_master *master);/** * get_vblank_counter - get raw hardware vblank counter @@ -1498,6 +1499,7 @@ extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);extern int drm_get_pci_dev (struct pci_dev *pdev,const struct pci_device_id *ent,struct drm_driver *driver); +extern int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master);#define DRM_PCIE_SPEED_25 1#define DRM_PCIE_SPEED_50 2@@ -1507,6 +1509,7 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);/* platform section */ extern int drm_platform_init (struct drm_driver *driver,struct platform_device *platform_device); +extern int drm_platform_set_busid (struct drm_device *d,struct drm_master *m);/* returns true if currently okay to sleep */ static __inline__bool drm_can_sleep (void )Signature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 17/20] drm: add driver->set_busid() callback
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · David Herrmann
One step closer to dropping all the drm_bus_* code:
Add adriver->set_busid()callback and make all drivers use the generic helpers. Nouveau is the only driver that uses two different bus-types with the samedrm_driver. This is totally broken if both buses are available on the same machine (unlikely, but lets be safe). Therefore, we create two different drivers for each platform duringmodule_init()and set theset_busid()callback respectively.Signed-off-by David Herrmann <[email protected]>
Quoted 8 lines
This has a bit a midlayer smell to it tbh, we don't really need a
set_busidcallback I think. Instead there's just two cases:
- The crazy implementation for pci devices. But we already havedev->pdev, so the core can figure this out itself.
- Everyone else just sets a static name. For those I think we should just add adrm_dev_set_busidfunction which they can call in their driver-load function. Well maybe different versions for platform drivers and stuff.
We already have drm_dev_set_unique() for exactly this purpose. I think drivers can just be converted to use that one at a time and when no users are left we can drop drm_*_set_busid().
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 18/20 drm: Goody bye, drm_bus!
In reply to David Herrmann..we will not miss you..
--- drivers/gpu/drm/drm_ioctl.c | 8 +------- drivers/gpu/drm/drm_pci.c | 6 ------ drivers/gpu/drm/drm_platform.c | 5 ----- drivers/gpu/drm/drm_usb.c | 12 ------------ include/drm/drmP.h | 5 ----- 5 files changed, 1 insertion(+), 35 deletions(-)
drivers/gpu/drm/drm_ioctl.c +1 -7
@@ -250,15 +250,9 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)drm_unset_busid (dev, master);return ret; } - }else if (dev->driver->bus && dev->driver->bus->set_busid) { - ret = dev->driver->bus->set_busid (dev, master); -if (ret) { -drm_unset_busid (dev, master); -return ret; - } }else {if (WARN (dev->unique ==NULL , -"No drm_bus.set_busid() implementation provided by " +"No drm_driver.set_busid() implementation provided by " "%ps. Use drm_dev_set_unique() to set the unique " "name explicitly." , dev->driver))return -EINVAL ;
drivers/gpu/drm/drm_pci.c +0 -6
@@ -254,10 +254,6 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -static struct drm_bus drm_pci_bus = { - .set_busid = drm_pci_set_busid, -}; -/** * drm_get_pci_dev - Register a PCI device with the DRM subsystem * @pdev: PCI device
@@ -338,8 +334,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)DRM_DEBUG ("\n" ); - driver->bus = &drm_pci_bus; -if (driver->driver_features &DRIVER_MODESET )return pci_register_driver (pdriver);
drivers/gpu/drm/drm_platform.c +0 -5
@@ -86,10 +86,6 @@ int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master) }EXPORT_SYMBOL (drm_platform_set_busid); -static struct drm_bus drm_platform_bus = { - .set_busid = drm_platform_set_busid, -}; -/** * drm_platform_init - Register a platform device with the DRM subsystem * @driver: DRM device driver
@@ -105,7 +101,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor {DRM_DEBUG ("\n" ); - driver->bus = &drm_platform_bus;return drm_get_platform_dev (platform_device, driver); }EXPORT_SYMBOL (drm_platform_init);
drivers/gpu/drm/drm_usb.c +0 -12
@@ -36,16 +36,6 @@ err_free: }EXPORT_SYMBOL (drm_get_usb_dev); -static int drm_usb_set_busid (struct drm_device *dev, -struct drm_master *master) -{ -return 0 ; -} - -static struct drm_bus drm_usb_bus = { - .set_busid = drm_usb_set_busid, -}; -/** * drm_usb_init - Register matching USB devices with the DRM subsystem * @driver: DRM device driver
@@ -61,8 +51,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)int res;DRM_DEBUG ("\n" ); - driver->bus = &drm_usb_bus; - res =usb_register (udriver);return res; }
include/drm/drmP.h +0 -5
@@ -605,10 +605,6 @@ struct drm_master {#define DRM_SCANOUTPOS_INVBL (1 << 1)#define DRM_SCANOUTPOS_ACCURATE (1 << 2) -struct drm_bus { -int (*set_busid)(struct drm_device *dev,struct drm_master *master); -}; -/** * DRM driver structure. This structure represent the common code for * a family of cards. There will one drm_device for each card present
@@ -846,7 +842,6 @@ struct drm_driver {const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops; -struct drm_bus *bus;/* List of devices hanging off this driver with stealth attach. */ struct list_head legacy_dev_list;
Signature · 1 line
2.1.0
Re: [PATCH 18/20] drm: Goody bye, drm_bus!
Quoted 10 lines · David Herrmann
..we will not miss you..
Signed-off-by David Herrmann <[email protected]>--- drivers/gpu/drm/drm_ioctl.c | 8 +------- drivers/gpu/drm/drm_pci.c | 6 ------ drivers/gpu/drm/drm_platform.c | 5 ----- drivers/gpu/drm/drm_usb.c | 12 ------------ include/drm/drmP.h | 5 ----- 5 files changed, 1 insertion(+), 35 deletions(-)
\o/
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 18/20] drm: Goody bye, drm_bus!
In reply to David HerrmannQuoted 3 lines · David Herrmann
..we will not miss you..
Signed-off-by David Herrmann <[email protected]>
Since this is independant of how we'll get rid of bus->set_busid:
Quoted 132 lines
--- drivers/gpu/drm/drm_ioctl.c | 8 +------- drivers/gpu/drm/drm_pci.c | 6 ------ drivers/gpu/drm/drm_platform.c | 5 ----- drivers/gpu/drm/drm_usb.c | 12 ------------ include/drm/drmP.h | 5 ----- 5 files changed, 1 insertion(+), 35 deletions(-)drivers/gpu/drm/drm_ioctl.c +1
-7@@ -250,15 +250,9 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)drm_unset_busid (dev, master);return ret; } - }else if (dev->driver->bus && dev->driver->bus->set_busid) { - ret = dev->driver->bus->set_busid (dev, master); -if (ret) { -drm_unset_busid (dev, master); -return ret; - } }else {if (WARN (dev->unique ==NULL , -"No drm_bus.set_busid() implementation provided by " +"No drm_driver.set_busid() implementation provided by " "%ps. Use drm_dev_set_unique() to set the unique " "name explicitly." , dev->driver))return -EINVAL ;drivers/gpu/drm/drm_pci.c +0
-6@@ -254,10 +254,6 @@ void drm_pci_agp_destroy(struct drm_device *dev) } } -static struct drm_bus drm_pci_bus = { - .set_busid = drm_pci_set_busid, -}; -/** * drm_get_pci_dev - Register a PCI device with the DRM subsystem * @pdev: PCI device @@ -338,8 +334,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)DRM_DEBUG ("\n" ); - driver->bus = &drm_pci_bus; -if (driver->driver_features &DRIVER_MODESET )return pci_register_driver (pdriver);drivers/gpu/drm/drm_platform.c +0
-5@@ -86,10 +86,6 @@ int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master) }EXPORT_SYMBOL (drm_platform_set_busid); -static struct drm_bus drm_platform_bus = { - .set_busid = drm_platform_set_busid, -}; -/** * drm_platform_init - Register a platform device with the DRM subsystem * @driver: DRM device driver @@ -105,7 +101,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor {DRM_DEBUG ("\n" ); - driver->bus = &drm_platform_bus;return drm_get_platform_dev (platform_device, driver); }EXPORT_SYMBOL (drm_platform_init);drivers/gpu/drm/drm_usb.c +0
-12@@ -36,16 +36,6 @@ err_free: }EXPORT_SYMBOL (drm_get_usb_dev); -static int drm_usb_set_busid (struct drm_device *dev, -struct drm_master *master) -{ -return 0 ; -} - -static struct drm_bus drm_usb_bus = { - .set_busid = drm_usb_set_busid, -}; -/** * drm_usb_init - Register matching USB devices with the DRM subsystem * @driver: DRM device driver @@ -61,8 +51,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)int res;DRM_DEBUG ("\n" ); - driver->bus = &drm_usb_bus; - res =usb_register (udriver);return res; }include/drm/drmP.h +0
-5@@ -605,10 +605,6 @@ struct drm_master {#define DRM_SCANOUTPOS_INVBL (1 << 1)#define DRM_SCANOUTPOS_ACCURATE (1 << 2) -struct drm_bus { -int (*set_busid)(struct drm_device *dev,struct drm_master *master); -}; -/** * DRM driver structure. This structure represent the common code for * a family of cards. There will one drm_device for each card present @@ -846,7 +842,6 @@ struct drm_driver {const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops; -struct drm_bus *bus;/* List of devices hanging off this driver with stealth attach. */ struct list_head legacy_dev_list;Signature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 19/20 drm: merge drm_usb into udl
In reply to David HerrmannThis merges all the remains of drm_usb into its only user, udl. We can then drop all the drm_usb stuff, including dev->usbdev.
--- Documentation/DocBook/drm.tmpl | 3 +- drivers/gpu/drm/Kconfig | 6 --- drivers/gpu/drm/Makefile | 3 -- drivers/gpu/drm/drm_usb.c | 76 --------------------------- drivers/gpu/drm/udl/Kconfig | 3 +- drivers/gpu/drm/udl/udl_connector.c | 4 +- drivers/gpu/drm/udl/udl_drv.c | 102 +++++++++++++++++++++--------------- drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 8 +-- include/drm/drmP.h | 1 - include/drm/drm_usb.h | 15 ------ 11 files changed, 70 insertions(+), 152 deletions(-) delete mode 100644 drivers/gpu/drm/drm_usb.c delete mode 100644 include/drm/drm_usb.h
Documentation/DocBook/drm.tmpl +1 -2
@@ -291,10 +291,9 @@ char *date;</synopsis> <title>Device Registration</title> <para> A number of functions are provided to help with device registration. - The functions deal with PCI, USB and platform devices, respectively. + The functions deal with PCI and platform devices, respectively. </para> !Edrivers/gpu/drm/drm_pci.c -!Edrivers/gpu/drm/drm_usb.c !Edrivers/gpu/drm/drm_platform.c <para> New drivers that no longer rely on the services provided by the
drivers/gpu/drm/Kconfig +0 -6
@@ -25,12 +25,6 @@ config DRM_MIPI_DSI bool depends on DRM -config DRM_USB - tristate - depends on DRM - depends on USB_SUPPORT && USB_ARCH_HAS_HCD - select USB - config DRM_KMS_HELPER tristate depends on DRM
drivers/gpu/drm/Makefile +0 -3
@@ -22,8 +22,6 @@ drm-$(CONFIG_PCI) += ati_pcigart.o drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_OF) += drm_of.o -drm-usb-y := drm_usb.o - drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
@@ -36,7 +34,6 @@ CFLAGS_drm_trace_points.o := -I$(src) obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o -obj-$(CONFIG_DRM_USB) += drm_usb.o obj-$(CONFIG_DRM_TTM) += ttm/ obj-$(CONFIG_DRM_TDFX) += tdfx/ obj-$(CONFIG_DRM_R128) += r128/
drivers/gpu/drm/drm_usb.c deleted +0 -76
76 lines not on this page · raw message
drivers/gpu/drm/udl/Kconfig +2 -1
@@ -1,8 +1,9 @@ config DRM_UDL tristate "DisplayLink" depends on DRM + depends on USB_SUPPORT depends on USB_ARCH_HAS_HCD - select DRM_USB + select USB select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT
drivers/gpu/drm/udl/udl_connector.c +2 -2
@@ -34,8 +34,8 @@ static u8 *udl_get_edid(struct udl_device *udl) goto error;for (i =0 ; i <EDID_LENGTH ; i++) { - ret =usb_control_msg (udl->ddev->usbdev, -usb_rcvctrlpipe (udl->ddev->usbdev,0 ), (0x02 ), + ret =usb_control_msg (udl->udev, +usb_rcvctrlpipe (udl->udev,0 ), (0x02 ), (0x80 | (0x02 <<5 )), i <<8 ,0xA1 , rbuf,2 ,HZ );if (ret <1 ) {
drivers/gpu/drm/udl/udl_drv.c +59 -43
133 lines not on this page · raw message
drivers/gpu/drm/udl/udl_drv.h +1 -0
@@ -47,6 +47,7 @@ struct udl_fbdev;struct udl_device {struct device *dev;struct drm_device *ddev; +struct usb_device *udev;int sku_pixel_limit;
drivers/gpu/drm/udl/udl_main.c +5 -3
@@ -202,7 +202,7 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size) } unode->urb = urb; - buf =usb_alloc_coherent (udl->ddev->usbdev,MAX_TRANSFER ,GFP_KERNEL , + buf =usb_alloc_coherent (udl->udev,MAX_TRANSFER ,GFP_KERNEL , &urb->transfer_dma);if (!buf) {kfree (unode);
@@ -211,7 +211,7 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size) }/* urb->transfer_buffer_length set to actual before submit */ -usb_fill_bulk_urb (urb, udl->ddev->usbdev,usb_sndbulkpipe (udl->ddev->usbdev,1 ), +usb_fill_bulk_urb (urb, udl->udev,usb_sndbulkpipe (udl->udev,1 ), buf, size, udl_urb_completion, unode); urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;
@@ -282,6 +282,7 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len)int udl_driver_load (struct drm_device *dev,unsigned long flags) { +struct usb_device *udev = (void *)flags;struct udl_device *udl;int ret = -ENOMEM ;
@@ -290,10 +291,11 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags)if (!udl)return -ENOMEM ; + udl->udev = udev; udl->ddev = dev; dev->dev_private = udl; -if (!udl_parse_vendor_descriptor (dev, dev->usbdev)) { +if (!udl_parse_vendor_descriptor (dev, udl->udev)) { ret = -ENODEV ;DRM_ERROR ("firmware not recognized. Assume incompatible device\n" ); goto err;
include/drm/drmP.h +0 -1
@@ -1020,7 +1020,6 @@ struct drm_device {#endif struct platform_device *platformdev;/**< Platform device struture */ -struct usb_device *usbdev;struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */
include/drm/drm_usb.h deleted +0 -15
@@ -1,15 +0,0 @@ -#ifndef DRM_USB_H -#define DRM_USB_H - -#include <drmP.h> - -#include <linux/usb.h> - -extern int drm_usb_init (struct drm_driver *driver,struct usb_driver *udriver); -extern void drm_usb_exit (struct drm_driver *driver,struct usb_driver *udriver); - -int drm_get_usb_dev (struct usb_interface *interface, -const struct usb_device_id *id, -struct drm_driver *driver); - -#endif
Signature · 1 line
2.1.0
Re: [PATCH 19/20] drm: merge drm_usb into udl
On Fri, Aug 29, 2014 at 12:12:45PM +0200, David Herrmann wrote:
[...]
Quoted 1 line
drivers/gpu/drm/udl/udl_drv.c +0
-0
[...]
Quoted 3 lines
module_init(udl_init);
module_exit(udl_exit);
+MODULE_LICENSE("GPL");
According to the header file the license is GPL v2 only, so this should be "GPL v2".
Might also be good to add MODULE_AUTHOR and MODULE_DESCRIPTION here.
Other than that:
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/20] drm: merge drm_usb into udl
In reply to David HerrmannQuoted 4 lines · David Herrmann
This merges all the remains of
drm_usbinto its only user, udl. We can then drop all thedrm_usbstuff, includingdev->usbdev.Signed-off-by David Herrmann <[email protected]>
A bit of (seemingly) unecessary code movement (the probe/disconnect functions and id table). With or without that fixed this is
And it looks really, really pretty ;-)
Quoted 413 lines
--- Documentation/DocBook/drm.tmpl | 3 +- drivers/gpu/drm/Kconfig | 6 --- drivers/gpu/drm/Makefile | 3 -- drivers/gpu/drm/drm_usb.c | 76 --------------------------- drivers/gpu/drm/udl/Kconfig | 3 +- drivers/gpu/drm/udl/udl_connector.c | 4 +- drivers/gpu/drm/udl/udl_drv.c | 102 +++++++++++++++++++++--------------- drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 8 +-- include/drm/drmP.h | 1 - include/drm/drm_usb.h | 15 ------ 11 files changed, 70 insertions(+), 152 deletions(-) delete mode 100644 drivers/gpu/drm/drm_usb.c delete mode 100644 include/drm/drm_usb.hDocumentation/DocBook/drm.tmpl +1
-2@@ -291,10 +291,9 @@ char *date;</synopsis> <title>Device Registration</title> <para> A number of functions are provided to help with device registration. - The functions deal with PCI, USB and platform devices, respectively. + The functions deal with PCI and platform devices, respectively. </para> !Edrivers/gpu/drm/drm_pci.c -!Edrivers/gpu/drm/drm_usb.c !Edrivers/gpu/drm/drm_platform.c <para> New drivers that no longer rely on the services provided by thedrivers/gpu/drm/Kconfig +0
-6@@ -25,12 +25,6 @@ config DRM_MIPI_DSI bool depends on DRM -config DRM_USB - tristate - depends on DRM - depends on USB_SUPPORT && USB_ARCH_HAS_HCD - select USB - config DRM_KMS_HELPER tristate depends on DRMdrivers/gpu/drm/Makefile +0
-3@@ -22,8 +22,6 @@ drm-$(CONFIG_PCI) += ati_pcigart.o drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_OF) += drm_of.o -drm-usb-y := drm_usb.o - drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o@@ -36,7 +34,6 @@ CFLAGS_drm_trace_points.o := -I$(src) obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o -obj-$(CONFIG_DRM_USB) += drm_usb.o obj-$(CONFIG_DRM_TTM) += ttm/ obj-$(CONFIG_DRM_TDFX) += tdfx/ obj-$(CONFIG_DRM_R128) += r128/drivers/gpu/drm/drm_usb.c deleted +0
-76@@ -1,76 +0,0 @@ -#include <drm/drmP.h> -#include <drm/drm_usb.h> -#include <linux/usb.h> -#include <linux/module.h> - -int drm_get_usb_dev (struct usb_interface *interface, -const struct usb_device_id *id, -struct drm_driver *driver) -{ -struct drm_device *dev; -int ret; - -DRM_DEBUG ("\n" ); - - dev =drm_dev_alloc (driver, &interface->dev); -if (!dev) -return -ENOMEM ; - - dev->usbdev =interface_to_usbdev (interface); -usb_set_intfdata (interface, dev); - - ret =drm_dev_register (dev,0 ); -if (ret) - goto err_free; - -DRM_INFO ("Initialized %s %d.%d.%d %s on minor %d\n" , - driver->name, driver->major, driver->minor, driver->patchlevel, - driver->date, dev->primary->index); - -return 0 ; - -err_free: -drm_dev_unref (dev); -return ret; - -} -EXPORT_SYMBOL (drm_get_usb_dev); - -/** -* drm_usb_init - Register matching USB devices with the DRM subsystem -* @driver: DRM device driver -* @udriver: USB device driver -* -* Registers one or more devices matched by a USB driver with the DRM -* subsystem. -* -* Return: 0 on success or a negative error code on failure. -*/ -int drm_usb_init (struct drm_driver *driver,struct usb_driver *udriver) -{ -int res; -DRM_DEBUG ("\n" ); - - res =usb_register (udriver); -return res; -} -EXPORT_SYMBOL (drm_usb_init); - -/** -* drm_usb_exit - Unregister matching USB devices from the DRM subsystem -* @driver: DRM device driver -* @udriver: USB device driver -* -* Unregisters one or more devices matched by a USB driver from the DRM -* subsystem. -*/ -void drm_usb_exit (struct drm_driver *driver, -struct usb_driver *udriver) -{ -usb_deregister (udriver); -} -EXPORT_SYMBOL (drm_usb_exit); - -MODULE_AUTHOR ("David Airlie" ); -MODULE_DESCRIPTION ("USB DRM support" ); -MODULE_LICENSE ("GPL and additional rights" );drivers/gpu/drm/udl/Kconfig +2
-1@@ -1,8 +1,9 @@ config DRM_UDL tristate "DisplayLink" depends on DRM + depends on USB_SUPPORT depends on USB_ARCH_HAS_HCD - select DRM_USB + select USB select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLITdrivers/gpu/drm/udl/udl_connector.c +2
-2@@ -34,8 +34,8 @@ static u8 *udl_get_edid(struct udl_device *udl) goto error;for (i =0 ; i <EDID_LENGTH ; i++) { - ret =usb_control_msg (udl->ddev->usbdev, -usb_rcvctrlpipe (udl->ddev->usbdev,0 ), (0x02 ), + ret =usb_control_msg (udl->udev, +usb_rcvctrlpipe (udl->udev,0 ), (0x02 ), (0x80 | (0x02 <<5 )), i <<8 ,0xA1 , rbuf,2 ,HZ );if (ret <1 ) {drivers/gpu/drm/udl/udl_drv.c +59
-43@@ -7,55 +7,15 @@*/ #include <linux/module.h> -#include <drm/drm_usb.h> +#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include "udl_drv.h" -static struct drm_driver driver; - -/* -* There are many DisplayLink-based graphics products, all with unique PIDs. -* So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff) -* We also require a match on SubClass (0x00) and Protocol (0x00), -* which is compatible with all known USB 2.0 era graphics chips and firmware, -* but allows DisplayLink to increment those for any future incompatible chips -*/ -static struct usb_device_id id_table[] = { - {.idVendor =0x17e9 , .bInterfaceClass =0xff , - .bInterfaceSubClass =0x00 , - .bInterfaceProtocol =0x00 , - .match_flags =USB_DEVICE_ID_MATCH_VENDOR | -USB_DEVICE_ID_MATCH_INT_CLASS | -USB_DEVICE_ID_MATCH_INT_SUBCLASS | -USB_DEVICE_ID_MATCH_INT_PROTOCOL ,}, - {}, -}; -MODULE_DEVICE_TABLE (usb, id_table); - -MODULE_LICENSE ("GPL" ); -static int udl_driver_set_busid (struct drm_device *d,struct drm_master *m) {return 0 ; } -static int udl_usb_probe (struct usb_interface *interface, -const struct usb_device_id *id) -{ -return drm_get_usb_dev (interface, id, &driver); -} - -static void udl_usb_disconnect (struct usb_interface *interface) -{ -struct drm_device *dev =usb_get_intfdata (interface); - -drm_kms_helper_poll_disable (dev); -drm_connector_unplug_all (dev); -udl_fbdev_unplug (dev); -udl_drop_usb (dev); -drm_unplug_dev (dev); -} -static const struct vm_operations_struct udl_gem_vm_ops = { .fault = udl_gem_fault, .open = drm_gem_vm_open,@@ -102,6 +62,61 @@ static struct drm_driver driver = { .patchlevel = DRIVER_PATCHLEVEL, }; +static int udl_usb_probe (struct usb_interface *interface, +const struct usb_device_id *id) +{ +struct usb_device *udev =interface_to_usbdev (interface); +struct drm_device *dev; +int r; + + dev =drm_dev_alloc (&driver, &interface->dev); +if (!dev) +return -ENOMEM ; + + r =drm_dev_register (dev, (unsigned long )udev); +if (r) + goto err_free; + +usb_set_intfdata (interface, dev); +DRM_INFO ("Initialized udl on minor %d\n" , dev->primary->index); + +return 0 ; + +err_free: +drm_dev_unref (dev); +return r; +} + +static void udl_usb_disconnect (struct usb_interface *interface) +{ +struct drm_device *dev =usb_get_intfdata (interface); + +drm_kms_helper_poll_disable (dev); +drm_connector_unplug_all (dev); +udl_fbdev_unplug (dev); +udl_drop_usb (dev); +drm_unplug_dev (dev); +} + +/* +* There are many DisplayLink-based graphics products, all with unique PIDs. +* So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff) +* We also require a match on SubClass (0x00) and Protocol (0x00), +* which is compatible with all known USB 2.0 era graphics chips and firmware, +* but allows DisplayLink to increment those for any future incompatible chips +*/ +static struct usb_device_id id_table[] = { + {.idVendor =0x17e9 , .bInterfaceClass =0xff , + .bInterfaceSubClass =0x00 , + .bInterfaceProtocol =0x00 , + .match_flags =USB_DEVICE_ID_MATCH_VENDOR | +USB_DEVICE_ID_MATCH_INT_CLASS | +USB_DEVICE_ID_MATCH_INT_SUBCLASS | +USB_DEVICE_ID_MATCH_INT_PROTOCOL ,}, + {}, +}; +MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver udl_driver = { .name ="udl" , .probe = udl_usb_probe,@@ -111,13 +126,14 @@ static struct usb_driver udl_driver = {static int __init udl_init (void ) { -return drm_usb_init (&driver, &udl_driver); +return usb_register (&udl_driver); } static void __exit udl_exit(void) { -drm_usb_exit (&driver, &udl_driver); +usb_deregister (&udl_driver); }module_init (udl_init);module_exit (udl_exit); +MODULE_LICENSE ("GPL" );drivers/gpu/drm/udl/udl_drv.h +1
-0@@ -47,6 +47,7 @@ struct udl_fbdev;struct udl_device {struct device *dev;struct drm_device *ddev; +struct usb_device *udev;int sku_pixel_limit;drivers/gpu/drm/udl/udl_main.c +5
-3@@ -202,7 +202,7 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size) } unode->urb = urb; - buf =usb_alloc_coherent (udl->ddev->usbdev,MAX_TRANSFER ,GFP_KERNEL , + buf =usb_alloc_coherent (udl->udev,MAX_TRANSFER ,GFP_KERNEL , &urb->transfer_dma);if (!buf) {kfree (unode);@@ -211,7 +211,7 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size) }/* urb->transfer_buffer_length set to actual before submit */ -usb_fill_bulk_urb (urb, udl->ddev->usbdev,usb_sndbulkpipe (udl->ddev->usbdev,1 ), +usb_fill_bulk_urb (urb, udl->udev,usb_sndbulkpipe (udl->udev,1 ), buf, size, udl_urb_completion, unode); urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;@@ -282,6 +282,7 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len)int udl_driver_load (struct drm_device *dev,unsigned long flags) { +struct usb_device *udev = (void *)flags;struct udl_device *udl;int ret = -ENOMEM ;@@ -290,10 +291,11 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags)if (!udl)return -ENOMEM ; + udl->udev = udev; udl->ddev = dev; dev->dev_private = udl; -if (!udl_parse_vendor_descriptor (dev, dev->usbdev)) { +if (!udl_parse_vendor_descriptor (dev, udl->udev)) { ret = -ENODEV ;DRM_ERROR ("firmware not recognized. Assume incompatible device\n" ); goto err;include/drm/drmP.h +0
-1@@ -1020,7 +1020,6 @@ struct drm_device {#endif struct platform_device *platformdev;/**< Platform device struture */ -struct usb_device *usbdev;struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ include/drm/drm_usb.h deleted +0
-15@@ -1,15 +0,0 @@ -#ifndef DRM_USB_H -#define DRM_USB_H - -#include <drmP.h> - -#include <linux/usb.h> - -extern int drm_usb_init (struct drm_driver *driver,struct usb_driver *udriver); -extern void drm_usb_exit (struct drm_driver *driver,struct usb_driver *udriver); - -int drm_get_usb_dev (struct usb_interface *interface, -const struct usb_device_id *id, -struct drm_driver *driver); - -#endif Signature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 20/20 drm: move drm-lock API to drm_legacy.h
In reply to David HerrmannSame as the other legacy APIs, most of this is internal, so prefix it with drm_legacy_* and move into drm_legacy.h.
--- drivers/gpu/drm/drm_fops.c | 6 +++--- drivers/gpu/drm/drm_ioctl.c | 4 ++-- drivers/gpu/drm/drm_legacy.h | 9 +++++++++ drivers/gpu/drm/drm_lock.c | 20 +++++++++++--------- drivers/gpu/drm/i810/i810_dma.c | 4 ++-- drivers/gpu/drm/savage/savage_bci.c | 4 ++-- drivers/gpu/drm/sis/sis_mm.c | 6 +++--- drivers/gpu/drm/via/via_mm.c | 6 +++--- include/drm/drmP.h | 14 +++----------- 9 files changed, 38 insertions(+), 35 deletions(-)
drivers/gpu/drm/drm_fops.c +3 -3
@@ -268,11 +268,11 @@ static void drm_master_release(struct drm_device *dev, struct file *filp) {struct drm_file *file_priv = filp->private_data; -if (drm_i_have_hw_lock (dev, file_priv)) { +if (drm_legacy_i_have_hw_lock (dev, file_priv)) {DRM_DEBUG ("File %p released, freeing lock for context %d\n" , filp,_DRM_LOCKING_CONTEXT (file_priv->master->lock.hw_lock->lock)); -drm_lock_free (&file_priv->master->lock, -_DRM_LOCKING_CONTEXT (file_priv->master->lock.hw_lock->lock)); +drm_legacy_lock_free (&file_priv->master->lock, +_DRM_LOCKING_CONTEXT (file_priv->master->lock.hw_lock->lock)); } }
drivers/gpu/drm/drm_ioctl.c +2 -2
@@ -82,8 +82,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_ADD_DRAW , drm_noop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF (DRM_IOCTL_RM_DRAW , drm_noop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF (DRM_IOCTL_LOCK , drm_lock,DRM_AUTH ), -DRM_IOCTL_DEF (DRM_IOCTL_UNLOCK , drm_unlock,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_LOCK , drm_legacy_lock,DRM_AUTH ), +DRM_IOCTL_DEF (DRM_IOCTL_UNLOCK , drm_legacy_unlock,DRM_AUTH ), DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH),
drivers/gpu/drm/drm_legacy.h +9 -0
@@ -78,4 +78,13 @@ struct drm_agp_mem { struct list_head head; }; +/* +* Generic Userspace Locking-API +*/ + +int drm_legacy_i_have_hw_lock (struct drm_device *d,struct drm_file *f); +int drm_legacy_lock (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_unlock (struct drm_device *d,void *v,struct drm_file *f); +int drm_legacy_lock_free (struct drm_lock_data *lock,unsigned int ctx); +#endif /* __DRM_LEGACY_H__ */
drivers/gpu/drm/drm_lock.c +11 -9
@@ -52,7 +52,8 @@ static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);* * Add the current task to the lock wait queue, and attempt to take to lock. */ -int drm_lock (struct drm_device *dev,void *data,struct drm_file *file_priv) +int drm_legacy_lock (struct drm_device *dev,void *data, +struct drm_file *file_priv) {DECLARE_WAITQUEUE (entry, current);struct drm_lock *lock = data;
@@ -146,7 +147,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)* * Transfer and free the lock. */ -int drm_unlock (struct drm_device *dev,void *data,struct drm_file *file_priv) +int drm_legacy_unlock (struct drm_device *dev,void *data,struct drm_file *file_priv) {struct drm_lock *lock = data;struct drm_master *master = file_priv->master;
@@ -157,7 +158,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)return -EINVAL ; } -if (drm_lock_free (&master->lock, lock->context)) { +if (drm_legacy_lock_free (&master->lock, lock->context)) {/* FIXME: Should really bail out here. */ }
@@ -250,7 +251,7 @@ static int drm_lock_transfer(struct drm_lock_data *lock_data,* Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task * waiting on the lock queue. */ -int drm_lock_free (struct drm_lock_data *lock_data,unsigned int context) +int drm_legacy_lock_free (struct drm_lock_data *lock_data,unsigned int context) {unsigned int old, new, prev;volatile unsigned int *lock = &lock_data->hw_lock->lock;
@@ -324,7 +325,7 @@ static int drm_notifier(void *priv)* having to worry about starvation. */ -void drm_idlelock_take (struct drm_lock_data *lock_data) +void drm_legacy_idlelock_take (struct drm_lock_data *lock_data) {int ret;
@@ -341,9 +342,9 @@ void drm_idlelock_take(struct drm_lock_data *lock_data) }spin_unlock_bh (&lock_data->spinlock); } -EXPORT_SYMBOL (drm_idlelock_take); +EXPORT_SYMBOL (drm_legacy_idlelock_take); -void drm_idlelock_release (struct drm_lock_data *lock_data) +void drm_legacy_idlelock_release (struct drm_lock_data *lock_data) {unsigned int old, prev;volatile unsigned int *lock = &lock_data->hw_lock->lock;
@@ -361,9 +362,10 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) }spin_unlock_bh (&lock_data->spinlock); } -EXPORT_SYMBOL (drm_idlelock_release); +EXPORT_SYMBOL (drm_legacy_idlelock_release); -int drm_i_have_hw_lock (struct drm_device *dev,struct drm_file *file_priv) +int drm_legacy_i_have_hw_lock (struct drm_device *dev, +struct drm_file *file_priv) {struct drm_master *master = file_priv->master; return (file_priv->lock_count && master->lock.hw_lock &&
drivers/gpu/drm/i810/i810_dma.c +2 -2
@@ -1215,9 +1215,9 @@ void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) }if (file_priv->master && file_priv->master->lock.hw_lock) { -drm_idlelock_take (&file_priv->master->lock); +drm_legacy_idlelock_take (&file_priv->master->lock);i810_driver_reclaim_buffers (dev, file_priv); -drm_idlelock_release (&file_priv->master->lock); +drm_legacy_idlelock_release (&file_priv->master->lock); }else {/* master disappeared, clean up stuff anyway and hope nothing * goes wrong */
drivers/gpu/drm/savage/savage_bci.c +2 -2
@@ -1051,7 +1051,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)return ;if (file_priv->master && file_priv->master->lock.hw_lock) { -drm_idlelock_take (&file_priv->master->lock); +drm_legacy_idlelock_take (&file_priv->master->lock); release_idlelock =1 ; }
@@ -1070,7 +1070,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv) }if (release_idlelock) -drm_idlelock_release (&file_priv->master->lock); +drm_legacy_idlelock_release (&file_priv->master->lock); }const struct drm_ioctl_desc savage_ioctls[] = {
drivers/gpu/drm/sis/sis_mm.c +3 -3
@@ -319,12 +319,12 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,if (!(file->minor->master && file->master->lock.hw_lock))return ; -drm_idlelock_take (&file->master->lock); +drm_legacy_idlelock_take (&file->master->lock);mutex_lock (&dev->struct_mutex);if (list_empty (&file_priv->obj_list)) {mutex_unlock (&dev->struct_mutex); -drm_idlelock_release (&file->master->lock); +drm_legacy_idlelock_release (&file->master->lock);return ; }
@@ -345,7 +345,7 @@ void sis_reclaim_buffers_locked(struct drm_device *dev, }mutex_unlock (&dev->struct_mutex); -drm_idlelock_release (&file->master->lock); +drm_legacy_idlelock_release (&file->master->lock);return ; }
drivers/gpu/drm/via/via_mm.c +3 -3
@@ -211,12 +211,12 @@ void via_reclaim_buffers_locked(struct drm_device *dev,if (!(file->minor->master && file->master->lock.hw_lock))return ; -drm_idlelock_take (&file->master->lock); +drm_legacy_idlelock_take (&file->master->lock);mutex_lock (&dev->struct_mutex);if (list_empty (&file_priv->obj_list)) {mutex_unlock (&dev->struct_mutex); -drm_idlelock_release (&file->master->lock); +drm_legacy_idlelock_release (&file->master->lock);return ; }
@@ -231,7 +231,7 @@ void via_reclaim_buffers_locked(struct drm_device *dev, }mutex_unlock (&dev->struct_mutex); -drm_idlelock_release (&file->master->lock); +drm_legacy_idlelock_release (&file->master->lock);return ; }
include/drm/drmP.h +3 -11
@@ -1143,22 +1143,11 @@ void drm_clflush_pages(struct page *pages[], unsigned long num_pages);void drm_clflush_sg (struct sg_table *st);void drm_clflush_virt_range (void *addr,unsigned long length); -/* Locking IOCTL support (drm_lock.h) */ -extern int drm_lock (struct drm_device *dev,void *data, -struct drm_file *file_priv); -extern int drm_unlock (struct drm_device *dev,void *data, -struct drm_file *file_priv); -extern int drm_lock_free (struct drm_lock_data *lock_data,unsigned int context); -extern void drm_idlelock_take (struct drm_lock_data *lock_data); -extern void drm_idlelock_release (struct drm_lock_data *lock_data); -/* * These are exported to drivers so that they can implement fencing using * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. */ -extern int drm_i_have_hw_lock (struct drm_device *dev,struct drm_file *file_priv); -/* DMA support (drm_dma.h) */ extern int drm_legacy_dma_setup (struct drm_device *dev);extern void drm_legacy_dma_takedown (struct drm_device *dev);
@@ -1363,6 +1352,9 @@ int drm_legacy_addbufs_pci(struct drm_device *d, struct drm_buf_desc *req);void drm_legacy_vma_flush (struct drm_device *d); +void drm_legacy_idlelock_take (struct drm_lock_data *lock); +void drm_legacy_idlelock_release (struct drm_lock_data *lock); +/* sysfs support (drm_sysfs.c) */ struct drm_sysfs_class ;extern struct class *drm_sysfs_create (struct module *owner,char *name);
Signature · 1 line
2.1.0
Re: [PATCH 20/20] drm: move drm-lock API to drm_legacy.h
Quoted 4 lines · David Herrmann
Same as the other legacy APIs, most of this is internal, so prefix it with drm_legacy_* and move into
drm_legacy.h.Signed-off-by David Herrmann <[email protected]>
Quoted 11 lines
--- drivers/gpu/drm/drm_fops.c | 6 +++--- drivers/gpu/drm/drm_ioctl.c | 4 ++-- drivers/gpu/drm/drm_legacy.h | 9 +++++++++ drivers/gpu/drm/drm_lock.c | 20 +++++++++++--------- drivers/gpu/drm/i810/i810_dma.c | 4 ++-- drivers/gpu/drm/savage/savage_bci.c | 4 ++-- drivers/gpu/drm/sis/sis_mm.c | 6 +++--- drivers/gpu/drm/via/via_mm.c | 6 +++--- include/drm/drmP.h | 14 +++----------- 9 files changed, 38 insertions(+), 35 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 46 lines · David Herrmann
Hi
More cleanups of DRM core code. Diffstat says:
72 files changed, 832 insertions(+), 1038 deletions(-)..which is already nice, but doesn't reflect that a lot of code is now hidden from main headers. Furthermore, with this series applied,
drmP.hno longer looks as ugly as it is now (widly unstructured). It still ain't a beauty, though:include/drm/drmP.h | 236 ++++++++-----------------------Anyhow, highlights:
- drop "drm_memory.h"
- drop "drm_usb.c"
- drop "structdrm_waitlist"
- drop "structdrm_sigdata"
- drop "structdrm_bus"
- drop "drm_master->unique_size"Two patches are driver related:
- radeon: Patch #1, movesdrm_buffer.cto radeon/
- nouveau: Patch #17, splitsdrm_driverfor nouveau
They're rather trivial. Everything else is DRM-core.I've moved some legacy stuff around so it's easier to drop it once unused. If someone disagrees with move, let me know and I'll drop the patch.
I've pushed this to the 0-day testing bots now. I'll comment on the patches in case something shows up.
Comments welcome!
DavidDavid Herrmann (20):
drm/radeon: movedrm_bufferto drm/radeon/
drm: markdrm_bufanddrm_mapas legacy
drm: move "structdrm_vma_entry" todrm_vm.c
drm: move "structdrm_magic_entry" todrm_auth.c
drm: drop unused "structdrm_waitlist"
drm: move AGP definitions harder
drm: replace weird conditional includes
drm: drop__KERNEL__protection indrmP.h
drm: mergedrm_memory.hintodrm_memory.c
drm: move__OS_HAS_AGPintodrm_agpsupport.h
drm: order includes alphabetically indrmP.h
drm: dropDRM_DEBUG_CODE
Quoted 8 lines
drm: inline "struct
drm_sigdata"
drm: move remaining includes indrmP.hto the top
drm: simplify drm_*_set_unique()
drm: drop unuseddrm_master->unique_size
drm: adddriver->set_busid()callback
drm: Goody bye,drm_bus!
drm: mergedrm_usbinto udl
drm: move drm-lock API todrm_legacy.h
Oh well, I've thought I'll be lazy and only review what Thierry didn't look at yet ;-) I guess should have looked at the time-stamps.
Anyway nothing else but what Thierry spotted, so Ack on all the patches I didn't comment on. And thanks a lot for doing this.
-Daniel
Quoted 85 lines
Documentation/DocBook/drm.tmpl | 3 +- drivers/gpu/drm/Kconfig | 6 - drivers/gpu/drm/Makefile | 5 +- drivers/gpu/drm/armada/armada_drv.c | 1 + drivers/gpu/drm/ast/ast_drv.c | 1 + drivers/gpu/drm/bochs/bochs_drv.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 1 + drivers/gpu/drm/drm_agpsupport.c | 1 + drivers/gpu/drm/drm_auth.c | 6 + drivers/gpu/drm/drm_buffer.c | 181 ------------------------ drivers/gpu/drm/drm_bufs.c | 89 ++++++------ drivers/gpu/drm/drm_debugfs.c | 2 - drivers/gpu/drm/drm_drv.c | 11 +- drivers/gpu/drm/drm_fops.c | 16 +-- drivers/gpu/drm/drm_info.c | 59 -------- drivers/gpu/drm/drm_ioctl.c | 27 ++-- drivers/gpu/drm/drm_legacy.h | 39 +++++ drivers/gpu/drm/drm_lock.c | 35 ++--- drivers/gpu/drm/drm_memory.c | 12 ++ drivers/gpu/drm/drm_pci.c | 41 ++---- drivers/gpu/drm/drm_platform.c | 38 ++--- drivers/gpu/drm/drm_usb.c | 88 ------------ drivers/gpu/drm/drm_vm.c | 74 ++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 + drivers/gpu/drm/gma500/psb_drv.c | 1 + drivers/gpu/drm/i810/i810_dma.c | 4 +- drivers/gpu/drm/i810/i810_drv.c | 1 + drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/mga/mga_dma.c | 49 +++---- drivers/gpu/drm/mga/mga_drv.c | 1 + drivers/gpu/drm/mgag200/mgag200_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/nouveau/nouveau_drm.c | 19 ++- drivers/gpu/drm/omapdrm/omap_drv.c | 1 + drivers/gpu/drm/qxl/qxl_drv.c | 1 + drivers/gpu/drm/r128/r128_cce.c | 2 +- drivers/gpu/drm/r128/r128_drv.c | 1 + drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/drm_buffer.c | 177 +++++++++++++++++++++++ drivers/gpu/drm/radeon/drm_buffer.h | 148 +++++++++++++++++++ drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/gpu/drm/radeon/r600_cp.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 17 ++- drivers/gpu/drm/radeon/radeon_cp.c | 22 +-- drivers/gpu/drm/radeon/radeon_drv.c | 2 + drivers/gpu/drm/radeon/radeon_ring.c | 21 --- drivers/gpu/drm/radeon/radeon_state.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 + drivers/gpu/drm/savage/savage_bci.c | 23 +-- drivers/gpu/drm/savage/savage_drv.c | 1 + drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 + drivers/gpu/drm/sis/sis_drv.c | 1 + drivers/gpu/drm/sis/sis_mm.c | 6 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 + drivers/gpu/drm/udl/Kconfig | 3 +- drivers/gpu/drm/udl/udl_connector.c | 4 +- drivers/gpu/drm/udl/udl_drv.c | 102 +++++++------ drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 8 +- drivers/gpu/drm/via/via_drv.c | 1 + drivers/gpu/drm/via/via_map.c | 2 +- drivers/gpu/drm/via/via_mm.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + drivers/staging/imx-drm/imx-drm-core.c | 1 + include/drm/drmP.h | 236 ++++++++----------------------- include/drm/drm_agpsupport.h | 26 +++- include/drm/drm_buffer.h | 148 ------------------- include/drm/drm_crtc.h | 4 +- include/drm/drm_memory.h | 59 -------- include/drm/drm_usb.h | 15 -- 72 files changed, 832 insertions(+), 1038 deletions(-) delete mode 100644 drivers/gpu/drm/drm_buffer.c delete mode 100644 drivers/gpu/drm/drm_usb.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.c create mode 100644 drivers/gpu/drm/radeon/drm_buffer.h delete mode 100644 include/drm/drm_buffer.h delete mode 100644 include/drm/drm_memory.h delete mode 100644 include/drm/drm_usb.hSignature · 1 line
2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch