* [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 10:48 ` Emil Velikov
` (3 more replies)
2016-03-30 9:45 ` [PATCH 02/10] drm: Use dev->name as fallback for dev->unique Daniel Vetter
` (9 subsequent siblings)
10 siblings, 4 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development
It tries to do fancy things with excluding agp support if ttm is
built-in, but agp isn't. Instead just express this depency like drm
does and use CONFIG_AGP everywhere.
Also use the neat Makefile magic to make the entire ttm_agp_backend
file optional.
v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/ttm/Makefile | 3 ++-
drivers/gpu/drm/ttm/ttm_agp_backend.c | 3 ---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 ++++----
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
include/drm/ttm/ttm_bo_driver.h | 3 +--
6 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f2a74d0b68ae..7c9fc451f1aa 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE
config DRM_TTM
tristate
depends on DRM
+ depends on (AGP || AGP=n)
help
GPU memory management subsystem for devices with multiple
GPU memory types. Will be enabled automatically if a device driver
diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index b433b9f040c9..f92325800f8a 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -2,9 +2,10 @@
# Makefile for the drm device driver. This driver provides support for the
ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
obj-$(CONFIG_DRM_TTM) += ttm.o
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c
index 764be36397fd..028ab6007873 100644
--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
+++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
@@ -34,7 +34,6 @@
#include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
#include <drm/ttm/ttm_placement.h>
#include <linux/agp_backend.h>
#include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
}
EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 025c429050c0..a37de5db5731 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -48,7 +48,7 @@
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 624d941aaad1..bef9f6feb635 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -50,7 +50,7 @@
#include <linux/kthread.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 3d4bf08aa21f..ff544e3e37a7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#ifdef CONFIG_AGP
#include <linux/agp_backend.h>
/**
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
@ 2016-03-30 10:48 ` Emil Velikov
2016-03-30 11:00 ` [Intel-gfx] " kbuild test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 30+ messages in thread
From: Emil Velikov @ 2016-03-30 10:48 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Intel Graphics Development, DRI Development
On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE
> config DRM_TTM
> tristate
> depends on DRM
> + depends on (AGP || AGP=n)
Already part of config DRM, so we don't need it here ?
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
>
> extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
>
> -#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
> -#define TTM_HAS_AGP
> +#ifdef CONFIG_AGP
#if IS_ENABLED(CONFIG_AGP) ?
-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [Intel-gfx] [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
2016-03-30 10:48 ` Emil Velikov
@ 2016-03-30 11:00 ` kbuild test robot
2016-03-30 11:07 ` [PATCH] " Daniel Vetter
2016-03-30 11:24 ` Daniel Vetter
3 siblings, 0 replies; 30+ messages in thread
From: kbuild test robot @ 2016-03-30 11:00 UTC (permalink / raw)
Cc: Daniel Vetter, Intel Graphics Development, kbuild-all,
DRI Development
[-- Attachment #1: Type: text/plain, Size: 8586 bytes --]
Hi Daniel,
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
base: git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_create':
>> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration]
return ttm_agp_tt_create(bdev, drm->agp.bridge, size,
^
>> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_populate':
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1501:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration]
return ttm_agp_tt_populate(ttm);
^
drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_unpopulate':
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1568:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration]
ttm_agp_tt_unpopulate(ttm);
^
cc1: some warnings being treated as errors
--
drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_create':
>> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration]
return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge,
^
>> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_populate':
>> drivers/gpu/drm/radeon/radeon_ttm.c:741:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration]
return ttm_agp_tt_populate(ttm);
^
drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_unpopulate':
>> drivers/gpu/drm/radeon/radeon_ttm.c:792:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration]
ttm_agp_tt_unpopulate(ttm);
^
cc1: some warnings being treated as errors
vim +/ttm_agp_tt_unpopulate +1568 drivers/gpu/drm/nouveau/nouveau_bo.c
26c9e8eff Ben Skeggs 2015-08-20 1495 if (!nvxx_device(&drm->device)->func->cpu_coherent &&
c3a0c771e Alexandre Courbot 2014-10-27 1496 ttm->caching_state == tt_uncached)
c3a0c771e Alexandre Courbot 2014-10-27 1497 return ttm_dma_populate(ttm_dma, dev->dev);
c3a0c771e Alexandre Courbot 2014-10-27 1498
a7fb8a23c Daniel Vetter 2015-09-09 1499 #if IS_ENABLED(CONFIG_AGP)
340b0e7c5 Ben Skeggs 2015-08-20 1500 if (drm->agp.bridge) {
dea7e0ac4 Jerome Glisse 2012-01-03 @1501 return ttm_agp_tt_populate(ttm);
dea7e0ac4 Jerome Glisse 2012-01-03 1502 }
dea7e0ac4 Jerome Glisse 2012-01-03 1503 #endif
dea7e0ac4 Jerome Glisse 2012-01-03 1504
9bcd38de5 Alexandre Courbot 2016-03-02 1505 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1506 if (swiotlb_nr_tbl()) {
8e7e70522 Jerome Glisse 2011-11-09 1507 return ttm_dma_populate((void *)ttm, dev->dev);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1508 }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1509 #endif
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1510
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1511 r = ttm_pool_populate(ttm);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1512 if (r) {
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1513 return r;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1514 }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1515
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1516 for (i = 0; i < ttm->num_pages; i++) {
fd1496a0f Alexandre Courbot 2014-07-31 1517 dma_addr_t addr;
fd1496a0f Alexandre Courbot 2014-07-31 1518
fd1496a0f Alexandre Courbot 2014-07-31 1519 addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE,
fd1496a0f Alexandre Courbot 2014-07-31 1520 DMA_BIDIRECTIONAL);
fd1496a0f Alexandre Courbot 2014-07-31 1521
fd1496a0f Alexandre Courbot 2014-07-31 1522 if (dma_mapping_error(pdev, addr)) {
4fbbed46d Rasmus Villemoes 2016-02-15 1523 while (i--) {
fd1496a0f Alexandre Courbot 2014-07-31 1524 dma_unmap_page(pdev, ttm_dma->dma_address[i],
fd1496a0f Alexandre Courbot 2014-07-31 1525 PAGE_SIZE, DMA_BIDIRECTIONAL);
8e7e70522 Jerome Glisse 2011-11-09 1526 ttm_dma->dma_address[i] = 0;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1527 }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1528 ttm_pool_unpopulate(ttm);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1529 return -EFAULT;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1530 }
fd1496a0f Alexandre Courbot 2014-07-31 1531
fd1496a0f Alexandre Courbot 2014-07-31 1532 ttm_dma->dma_address[i] = addr;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1533 }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1534 return 0;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1535 }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1536
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1537 static void
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1538 nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1539 {
8e7e70522 Jerome Glisse 2011-11-09 1540 struct ttm_dma_tt *ttm_dma = (void *)ttm;
ebb945a94 Ben Skeggs 2012-07-20 1541 struct nouveau_drm *drm;
be83cd4ef Ben Skeggs 2015-01-14 1542 struct nvkm_device *device;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1543 struct drm_device *dev;
fd1496a0f Alexandre Courbot 2014-07-31 1544 struct device *pdev;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1545 unsigned i;
22b33e8ed Dave Airlie 2012-04-02 1546 bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
22b33e8ed Dave Airlie 2012-04-02 1547
22b33e8ed Dave Airlie 2012-04-02 1548 if (slave)
22b33e8ed Dave Airlie 2012-04-02 1549 return;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1550
ebb945a94 Ben Skeggs 2012-07-20 1551 drm = nouveau_bdev(ttm->bdev);
989aa5b76 Ben Skeggs 2015-01-12 1552 device = nvxx_device(&drm->device);
ebb945a94 Ben Skeggs 2012-07-20 1553 dev = drm->dev;
26c9e8eff Ben Skeggs 2015-08-20 1554 pdev = device->dev;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1555
c3a0c771e Alexandre Courbot 2014-10-27 1556 /*
c3a0c771e Alexandre Courbot 2014-10-27 1557 * Objects matching this condition have been marked as force_coherent,
c3a0c771e Alexandre Courbot 2014-10-27 1558 * so use the DMA API for them.
c3a0c771e Alexandre Courbot 2014-10-27 1559 */
26c9e8eff Ben Skeggs 2015-08-20 1560 if (!nvxx_device(&drm->device)->func->cpu_coherent &&
dcccdc143 Alexandre Courbot 2014-12-11 1561 ttm->caching_state == tt_uncached) {
c3a0c771e Alexandre Courbot 2014-10-27 1562 ttm_dma_unpopulate(ttm_dma, dev->dev);
dcccdc143 Alexandre Courbot 2014-12-11 1563 return;
dcccdc143 Alexandre Courbot 2014-12-11 1564 }
c3a0c771e Alexandre Courbot 2014-10-27 1565
a7fb8a23c Daniel Vetter 2015-09-09 1566 #if IS_ENABLED(CONFIG_AGP)
340b0e7c5 Ben Skeggs 2015-08-20 1567 if (drm->agp.bridge) {
dea7e0ac4 Jerome Glisse 2012-01-03 @1568 ttm_agp_tt_unpopulate(ttm);
dea7e0ac4 Jerome Glisse 2012-01-03 1569 return;
dea7e0ac4 Jerome Glisse 2012-01-03 1570 }
dea7e0ac4 Jerome Glisse 2012-01-03 1571 #endif
:::::: The code at line 1568 was first introduced by commit
:::::: dea7e0ac45fd28f90bbc38ff226d36a9f788efbf ttm: fix agp since ttm tt rework
:::::: TO: Jerome Glisse <jglisse@redhat.com>
:::::: CC: Dave Airlie <airlied@redhat.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 53506 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread* [PATCH] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
2016-03-30 10:48 ` Emil Velikov
2016-03-30 11:00 ` [Intel-gfx] " kbuild test robot
@ 2016-03-30 11:07 ` Daniel Vetter
2016-03-30 11:19 ` [Intel-gfx] " kbuild test robot
2016-03-30 11:24 ` Daniel Vetter
3 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 11:07 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Emil Velikov
It tries to do fancy things with excluding agp support if ttm is
built-in, but agp isn't. Instead just express this depency like drm
does and use CONFIG_AGP everywhere.
Also use the neat Makefile magic to make the entire ttm_agp_backend
file optional.
v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville
v3: Review from Emil.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/ttm/Makefile | 3 ++-
drivers/gpu/drm/ttm/ttm_agp_backend.c | 3 ---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 ++++----
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
include/drm/ttm/ttm_bo_driver.h | 3 +--
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index b433b9f040c9..f92325800f8a 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -2,9 +2,10 @@
# Makefile for the drm device driver. This driver provides support for the
ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
obj-$(CONFIG_DRM_TTM) += ttm.o
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c
index 764be36397fd..028ab6007873 100644
--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
+++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
@@ -34,7 +34,6 @@
#include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
#include <drm/ttm/ttm_placement.h>
#include <linux/agp_backend.h>
#include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
}
EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 025c429050c0..a37de5db5731 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -48,7 +48,7 @@
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 624d941aaad1..bef9f6feb635 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -50,7 +50,7 @@
#include <linux/kthread.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 3d4bf08aa21f..19b39cc2dcaa 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#ifdef IS_ENABLED(CONFIG_AGP)
#include <linux/agp_backend.h>
/**
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [Intel-gfx] [PATCH] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 11:07 ` [PATCH] " Daniel Vetter
@ 2016-03-30 11:19 ` kbuild test robot
0 siblings, 0 replies; 30+ messages in thread
From: kbuild test robot @ 2016-03-30 11:19 UTC (permalink / raw)
Cc: Daniel Vetter, Intel Graphics Development, Emil Velikov,
kbuild-all, DRI Development
[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]
Hi Daniel,
[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-ttm-Remove-TTM_HAS_AGP/20160330-191030
base: git://people.freedesktop.org/~airlied/linux.git drm-next
config: sparc64-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All warnings (new ones prefixed by >>):
In file included from include/drm/ttm/ttm_page_alloc.h:29:0,
from drivers/gpu/drm/ttm/ttm_memory.c:32:
>> include/drm/ttm/ttm_bo_driver.h:1033:18: warning: extra tokens at end of #ifdef directive
#ifdef IS_ENABLED(CONFIG_AGP)
^
In file included from include/drm/ttm/ttm_page_alloc.h:29:0,
from drivers/gpu/drm/ttm/ttm_memory.c:32:
>> include/drm/ttm/ttm_bo_driver.h:1033:18: warning: extra tokens at end of #ifdef directive
#ifdef IS_ENABLED(CONFIG_AGP)
^
vim +1033 include/drm/ttm/ttm_bo_driver.h
1017 struct fence *fence,
1018 bool evict, bool no_wait_gpu,
1019 struct ttm_mem_reg *new_mem);
1020 /**
1021 * ttm_io_prot
1022 *
1023 * @c_state: Caching state.
1024 * @tmp: Page protection flag for a normal, cached mapping.
1025 *
1026 * Utility function that returns the pgprot_t that should be used for
1027 * setting up a PTE with the caching model indicated by @c_state.
1028 */
1029 extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
1030
1031 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
1032
> 1033 #ifdef IS_ENABLED(CONFIG_AGP)
1034 #include <linux/agp_backend.h>
1035
1036 /**
1037 * ttm_agp_tt_create
1038 *
1039 * @bdev: Pointer to a struct ttm_bo_device.
1040 * @bridge: The agp bridge this device is sitting on.
1041 * @size: Size of the data needed backing.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45149 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
` (2 preceding siblings ...)
2016-03-30 11:07 ` [PATCH] " Daniel Vetter
@ 2016-03-30 11:24 ` Daniel Vetter
2016-03-30 12:53 ` Emil Velikov
3 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 11:24 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Emil Velikov
It tries to do fancy things with excluding agp support if ttm is
built-in, but agp isn't. Instead just express this depency like drm
does and use CONFIG_AGP everywhere.
Also use the neat Makefile magic to make the entire ttm_agp_backend
file optional.
v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville
v3: Review from Emil.
v4: Actually get it right as spotted by 0-day.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/ttm/Makefile | 3 ++-
drivers/gpu/drm/ttm/ttm_agp_backend.c | 3 ---
drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 ++++----
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
include/drm/ttm/ttm_bo_driver.h | 3 +--
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index b433b9f040c9..f92325800f8a 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -2,9 +2,10 @@
# Makefile for the drm device driver. This driver provides support for the
ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
obj-$(CONFIG_DRM_TTM) += ttm.o
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c
index 764be36397fd..028ab6007873 100644
--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
+++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
@@ -34,7 +34,6 @@
#include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
#include <drm/ttm/ttm_placement.h>
#include <linux/agp_backend.h>
#include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
}
EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 025c429050c0..a37de5db5731 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -48,7 +48,7 @@
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 624d941aaad1..bef9f6feb635 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -50,7 +50,7 @@
#include <linux/kthread.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
#ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 3d4bf08aa21f..cb91f80c15b3 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
#include <linux/agp_backend.h>
/**
--
2.8.0.rc3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 11:24 ` Daniel Vetter
@ 2016-03-30 12:53 ` Emil Velikov
2016-03-30 15:21 ` Daniel Vetter
0 siblings, 1 reply; 30+ messages in thread
From: Emil Velikov @ 2016-03-30 12:53 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Intel Graphics Development, DRI Development
On 30 March 2016 at 12:24, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> It tries to do fancy things with excluding agp support if ttm is
> built-in, but agp isn't. Instead just express this depency like drm
> does and use CONFIG_AGP everywhere.
>
> Also use the neat Makefile magic to make the entire ttm_agp_backend
> file optional.
>
> v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville
>
> v3: Review from Emil.
>
> v4: Actually get it right as spotted by 0-day.
>
Nice one. I didn't even spot the typo/thinko in v3 ;-)
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH] drm/ttm: Remove TTM_HAS_AGP
2016-03-30 12:53 ` Emil Velikov
@ 2016-03-30 15:21 ` Daniel Vetter
0 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 15:21 UTC (permalink / raw)
To: Emil Velikov; +Cc: Daniel Vetter, Intel Graphics Development, DRI Development
On Wed, Mar 30, 2016 at 01:53:38PM +0100, Emil Velikov wrote:
> On 30 March 2016 at 12:24, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > It tries to do fancy things with excluding agp support if ttm is
> > built-in, but agp isn't. Instead just express this depency like drm
> > does and use CONFIG_AGP everywhere.
> >
> > Also use the neat Makefile magic to make the entire ttm_agp_backend
> > file optional.
> >
> > v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville
> >
> > v3: Review from Emil.
> >
> > v4: Actually get it right as spotted by 0-day.
> >
> Nice one. I didn't even spot the typo/thinko in v3 ;-)
>
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Applied to drm-misc, thanks for the review.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 02/10] drm: Use dev->name as fallback for dev->unique
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 10:43 ` Emil Velikov
2016-03-30 9:45 ` [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE Daniel Vetter
` (8 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development
Cc: Daniel Vetter, Intel Graphics Development, Ilia Mirkin,
Daniel Vetter
Lots of arm drivers get this wrong and for most arm boards this is the
right thing actually. And anyway with most loaders you want to chase
sysfs links anyway to figure out which dri device you want.
This will fix dmesg noise for rockchip and sti.
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_ioctl.c | 12 +++++-------
drivers/gpu/drm/vgem/vgem_drv.c | 2 --
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8ce2a0c59116..3ecd1368c23a 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -134,16 +134,14 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
drm_unset_busid(dev, master);
return ret;
}
- } else {
- if (WARN(dev->unique == NULL,
- "No drm_driver.set_busid() implementation provided by "
- "%ps. Use drm_dev_set_unique() to set the unique "
- "name explicitly.", dev->driver))
- return -EINVAL;
-
+ } else if (dev->unique) {
master->unique = kstrdup(dev->unique, GFP_KERNEL);
if (master->unique)
master->unique_len = strlen(dev->unique);
+ } else {
+ master->unique = kstrdup(dev->driver->name, GFP_KERNEL);
+ if (master->unique)
+ master->unique_len = strlen(dev->driver->name);
}
return 0;
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index ae4de36d1d83..d61a547fa3c9 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -260,8 +260,6 @@ static int __init vgem_init(void)
goto out;
}
- drm_dev_set_unique(vgem_device, "vgem");
-
ret = drm_dev_register(vgem_device, 0);
if (ret)
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 02/10] drm: Use dev->name as fallback for dev->unique
2016-03-30 9:45 ` [PATCH 02/10] drm: Use dev->name as fallback for dev->unique Daniel Vetter
@ 2016-03-30 10:43 ` Emil Velikov
2016-04-26 11:12 ` Daniel Vetter
0 siblings, 1 reply; 30+ messages in thread
From: Emil Velikov @ 2016-03-30 10:43 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development, DRI Development
On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Lots of arm drivers get this wrong and for most arm boards this is the
> right thing actually. And anyway with most loaders you want to chase
> sysfs links anyway to figure out which dri device you want.
>
> This will fix dmesg noise for rockchip and sti.
>
Fwiw I still hope to finish libdrm-2 (hint importing kernel headers),
which will remove the biggest user of these legacy ioctls. This way we
might even nuke all these lovelies from the kernel. I doubt you'll
object against the idea, will you ?
-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 02/10] drm: Use dev->name as fallback for dev->unique
2016-03-30 10:43 ` Emil Velikov
@ 2016-04-26 11:12 ` Daniel Vetter
0 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-04-26 11:12 UTC (permalink / raw)
To: Emil Velikov
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
Daniel Vetter
On Wed, Mar 30, 2016 at 11:43:52AM +0100, Emil Velikov wrote:
> On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Lots of arm drivers get this wrong and for most arm boards this is the
> > right thing actually. And anyway with most loaders you want to chase
> > sysfs links anyway to figure out which dri device you want.
> >
> > This will fix dmesg noise for rockchip and sti.
> >
> Fwiw I still hope to finish libdrm-2 (hint importing kernel headers),
> which will remove the biggest user of these legacy ioctls. This way we
> might even nuke all these lovelies from the kernel. I doubt you'll
> object against the idea, will you ?
We can't nuke this lovelies from the kernel for another 5-10 years since
old userspace needs to keep working :(
Feel like r-b-stamping this patch?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
2016-03-30 9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
2016-03-30 9:45 ` [PATCH 02/10] drm: Use dev->name as fallback for dev->unique Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-04-26 11:24 ` Daniel Vetter
2016-03-30 9:45 ` [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files Daniel Vetter
` (7 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development
For documentation and paranoia.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_sysfs.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index d503f8e8c2d1..43875cb35691 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -208,9 +208,12 @@ static ssize_t status_show(struct device *device,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
+ enum drm_connector_status status;
+
+ status = READ_ONCE(connector->status);
return snprintf(buf, PAGE_SIZE, "%s\n",
- drm_get_connector_status_name(connector->status));
+ drm_get_connector_status_name(status));
}
static ssize_t dpms_show(struct device *device,
@@ -231,9 +234,11 @@ static ssize_t enabled_show(struct device *device,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
+ bool enabled;
+
+ enabled = READ_ONCE(connector->encoder);
- return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
- "disabled");
+ return snprintf(buf, PAGE_SIZE, enabled ? "enabled\n" : "disabled\n");
}
static ssize_t edid_show(struct file *filp, struct kobject *kobj,
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE
2016-03-30 9:45 ` [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE Daniel Vetter
@ 2016-04-26 11:24 ` Daniel Vetter
0 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-04-26 11:24 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development
On Wed, Mar 30, 2016 at 11:45:13AM +0200, Daniel Vetter wrote:
> For documentation and paranoia.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Merged to drm-misc with Chris' irc ack - we just discussed the opposite
WRITE_ONCE in some other patches.
-Daniel
> ---
> drivers/gpu/drm/drm_sysfs.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index d503f8e8c2d1..43875cb35691 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -208,9 +208,12 @@ static ssize_t status_show(struct device *device,
> char *buf)
> {
> struct drm_connector *connector = to_drm_connector(device);
> + enum drm_connector_status status;
> +
> + status = READ_ONCE(connector->status);
>
> return snprintf(buf, PAGE_SIZE, "%s\n",
> - drm_get_connector_status_name(connector->status));
> + drm_get_connector_status_name(status));
> }
>
> static ssize_t dpms_show(struct device *device,
> @@ -231,9 +234,11 @@ static ssize_t enabled_show(struct device *device,
> char *buf)
> {
> struct drm_connector *connector = to_drm_connector(device);
> + bool enabled;
> +
> + enabled = READ_ONCE(connector->encoder);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
> - "disabled");
> + return snprintf(buf, PAGE_SIZE, enabled ? "enabled\n" : "disabled\n");
> }
>
> static ssize_t edid_show(struct file *filp, struct kobject *kobj,
> --
> 2.8.0.rc3
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (2 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 13:49 ` Alex Deucher
2016-03-30 9:45 ` [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix Daniel Vetter
` (6 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter
This goes all the way back to the original KMS commit aeons ago
commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef
Author: Dave Airlie <airlied@redhat.com>
Date: Fri Nov 7 14:05:41 2008 -0800
DRM: add mode setting support
But it seems to be completely unused. Only i915 and nouveau even
register these properties, and the corresponding DDX don't even look
at them. Also the sysfs files are read-only, so not useful to
configure anything.
I suspect that this was added with the goal to have read-only access
to all properties in sysfs, but we never followed through on that.
Also, that should be done in a more generic fashion.
Since it would be real work to fix up the locking (with atomic we're
now chasing pointers when reading properties) and it seems unused lets
just nuke this all. It's easier. Of course we'll keep the properties
themselves, those are still exposed through the KMS ioctls.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
1 file changed, 156 deletions(-)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 43875cb35691..fa7fadce8063 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
return written;
}
-static ssize_t tv_subconnector_show(struct device *device,
- struct device_attribute *attr,
- char *buf)
-{
- struct drm_connector *connector = to_drm_connector(device);
- struct drm_device *dev = connector->dev;
- struct drm_property *prop;
- uint64_t subconnector;
- int ret;
-
- prop = dev->mode_config.tv_subconnector_property;
- if (!prop) {
- DRM_ERROR("Unable to find subconnector property\n");
- return 0;
- }
-
- ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
- if (ret)
- return 0;
-
- return snprintf(buf, PAGE_SIZE, "%s",
- drm_get_tv_subconnector_name((int)subconnector));
-}
-
-static ssize_t tv_select_subconnector_show(struct device *device,
- struct device_attribute *attr,
- char *buf)
-{
- struct drm_connector *connector = to_drm_connector(device);
- struct drm_device *dev = connector->dev;
- struct drm_property *prop;
- uint64_t subconnector;
- int ret;
-
- prop = dev->mode_config.tv_select_subconnector_property;
- if (!prop) {
- DRM_ERROR("Unable to find select subconnector property\n");
- return 0;
- }
-
- ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
- if (ret)
- return 0;
-
- return snprintf(buf, PAGE_SIZE, "%s",
- drm_get_tv_select_name((int)subconnector));
-}
-
-static ssize_t dvii_subconnector_show(struct device *device,
- struct device_attribute *attr,
- char *buf)
-{
- struct drm_connector *connector = to_drm_connector(device);
- struct drm_device *dev = connector->dev;
- struct drm_property *prop;
- uint64_t subconnector;
- int ret;
-
- prop = dev->mode_config.dvi_i_subconnector_property;
- if (!prop) {
- DRM_ERROR("Unable to find subconnector property\n");
- return 0;
- }
-
- ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
- if (ret)
- return 0;
-
- return snprintf(buf, PAGE_SIZE, "%s",
- drm_get_dvi_i_subconnector_name((int)subconnector));
-}
-
-static ssize_t dvii_select_subconnector_show(struct device *device,
- struct device_attribute *attr,
- char *buf)
-{
- struct drm_connector *connector = to_drm_connector(device);
- struct drm_device *dev = connector->dev;
- struct drm_property *prop;
- uint64_t subconnector;
- int ret;
-
- prop = dev->mode_config.dvi_i_select_subconnector_property;
- if (!prop) {
- DRM_ERROR("Unable to find select subconnector property\n");
- return 0;
- }
-
- ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
- if (ret)
- return 0;
-
- return snprintf(buf, PAGE_SIZE, "%s",
- drm_get_dvi_i_select_name((int)subconnector));
-}
-
static DEVICE_ATTR_RW(status);
static DEVICE_ATTR_RO(enabled);
static DEVICE_ATTR_RO(dpms);
@@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
NULL
};
-static DEVICE_ATTR_RO(tv_subconnector);
-static DEVICE_ATTR_RO(tv_select_subconnector);
-
-static struct attribute *connector_tv_dev_attrs[] = {
- &dev_attr_tv_subconnector.attr,
- &dev_attr_tv_select_subconnector.attr,
- NULL
-};
-
-static DEVICE_ATTR_RO(dvii_subconnector);
-static DEVICE_ATTR_RO(dvii_select_subconnector);
-
-static struct attribute *connector_dvii_dev_attrs[] = {
- &dev_attr_dvii_subconnector.attr,
- &dev_attr_dvii_select_subconnector.attr,
- NULL
-};
-
-/* Connector type related helpers */
-static int kobj_connector_type(struct kobject *kobj)
-{
- struct device *dev = kobj_to_dev(kobj);
- struct drm_connector *connector = to_drm_connector(dev);
-
- return connector->connector_type;
-}
-
-static umode_t connector_is_dvii(struct kobject *kobj,
- struct attribute *attr, int idx)
-{
- return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
- attr->mode : 0;
-}
-
-static umode_t connector_is_tv(struct kobject *kobj,
- struct attribute *attr, int idx)
-{
- switch (kobj_connector_type(kobj)) {
- case DRM_MODE_CONNECTOR_Composite:
- case DRM_MODE_CONNECTOR_SVIDEO:
- case DRM_MODE_CONNECTOR_Component:
- case DRM_MODE_CONNECTOR_TV:
- return attr->mode;
- }
-
- return 0;
-}
-
static struct bin_attribute edid_attr = {
.attr.name = "edid",
.attr.mode = 0444,
@@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
.bin_attrs = connector_bin_attrs,
};
-static const struct attribute_group connector_tv_dev_group = {
- .attrs = connector_tv_dev_attrs,
- .is_visible = connector_is_tv,
-};
-
-static const struct attribute_group connector_dvii_dev_group = {
- .attrs = connector_dvii_dev_attrs,
- .is_visible = connector_is_dvii,
-};
-
static const struct attribute_group *connector_dev_groups[] = {
&connector_dev_group,
- &connector_tv_dev_group,
- &connector_dvii_dev_group,
NULL
};
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files
2016-03-30 9:45 ` [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files Daniel Vetter
@ 2016-03-30 13:49 ` Alex Deucher
2016-03-30 15:30 ` Daniel Vetter
0 siblings, 1 reply; 30+ messages in thread
From: Alex Deucher @ 2016-03-30 13:49 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development, DRI Development
On Wed, Mar 30, 2016 at 5:45 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> This goes all the way back to the original KMS commit aeons ago
>
> commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef
> Author: Dave Airlie <airlied@redhat.com>
> Date: Fri Nov 7 14:05:41 2008 -0800
>
> DRM: add mode setting support
>
> But it seems to be completely unused. Only i915 and nouveau even
> register these properties, and the corresponding DDX don't even look
> at them. Also the sysfs files are read-only, so not useful to
> configure anything.
>
> I suspect that this was added with the goal to have read-only access
> to all properties in sysfs, but we never followed through on that.
> Also, that should be done in a more generic fashion.
>
> Since it would be real work to fix up the locking (with atomic we're
> now chasing pointers when reading properties) and it seems unused lets
> just nuke this all. It's easier. Of course we'll keep the properties
> themselves, those are still exposed through the KMS ioctls.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
> 1 file changed, 156 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index 43875cb35691..fa7fadce8063 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
> return written;
> }
>
> -static ssize_t tv_subconnector_show(struct device *device,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - struct drm_connector *connector = to_drm_connector(device);
> - struct drm_device *dev = connector->dev;
> - struct drm_property *prop;
> - uint64_t subconnector;
> - int ret;
> -
> - prop = dev->mode_config.tv_subconnector_property;
> - if (!prop) {
> - DRM_ERROR("Unable to find subconnector property\n");
> - return 0;
> - }
> -
> - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> - if (ret)
> - return 0;
> -
> - return snprintf(buf, PAGE_SIZE, "%s",
> - drm_get_tv_subconnector_name((int)subconnector));
> -}
> -
> -static ssize_t tv_select_subconnector_show(struct device *device,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - struct drm_connector *connector = to_drm_connector(device);
> - struct drm_device *dev = connector->dev;
> - struct drm_property *prop;
> - uint64_t subconnector;
> - int ret;
> -
> - prop = dev->mode_config.tv_select_subconnector_property;
> - if (!prop) {
> - DRM_ERROR("Unable to find select subconnector property\n");
> - return 0;
> - }
> -
> - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> - if (ret)
> - return 0;
> -
> - return snprintf(buf, PAGE_SIZE, "%s",
> - drm_get_tv_select_name((int)subconnector));
> -}
> -
> -static ssize_t dvii_subconnector_show(struct device *device,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - struct drm_connector *connector = to_drm_connector(device);
> - struct drm_device *dev = connector->dev;
> - struct drm_property *prop;
> - uint64_t subconnector;
> - int ret;
> -
> - prop = dev->mode_config.dvi_i_subconnector_property;
> - if (!prop) {
> - DRM_ERROR("Unable to find subconnector property\n");
> - return 0;
> - }
> -
> - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> - if (ret)
> - return 0;
> -
> - return snprintf(buf, PAGE_SIZE, "%s",
> - drm_get_dvi_i_subconnector_name((int)subconnector));
> -}
> -
> -static ssize_t dvii_select_subconnector_show(struct device *device,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - struct drm_connector *connector = to_drm_connector(device);
> - struct drm_device *dev = connector->dev;
> - struct drm_property *prop;
> - uint64_t subconnector;
> - int ret;
> -
> - prop = dev->mode_config.dvi_i_select_subconnector_property;
> - if (!prop) {
> - DRM_ERROR("Unable to find select subconnector property\n");
> - return 0;
> - }
> -
> - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> - if (ret)
> - return 0;
> -
> - return snprintf(buf, PAGE_SIZE, "%s",
> - drm_get_dvi_i_select_name((int)subconnector));
> -}
> -
> static DEVICE_ATTR_RW(status);
> static DEVICE_ATTR_RO(enabled);
> static DEVICE_ATTR_RO(dpms);
> @@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
> NULL
> };
>
> -static DEVICE_ATTR_RO(tv_subconnector);
> -static DEVICE_ATTR_RO(tv_select_subconnector);
> -
> -static struct attribute *connector_tv_dev_attrs[] = {
> - &dev_attr_tv_subconnector.attr,
> - &dev_attr_tv_select_subconnector.attr,
> - NULL
> -};
> -
> -static DEVICE_ATTR_RO(dvii_subconnector);
> -static DEVICE_ATTR_RO(dvii_select_subconnector);
> -
> -static struct attribute *connector_dvii_dev_attrs[] = {
> - &dev_attr_dvii_subconnector.attr,
> - &dev_attr_dvii_select_subconnector.attr,
> - NULL
> -};
> -
> -/* Connector type related helpers */
> -static int kobj_connector_type(struct kobject *kobj)
> -{
> - struct device *dev = kobj_to_dev(kobj);
> - struct drm_connector *connector = to_drm_connector(dev);
> -
> - return connector->connector_type;
> -}
> -
> -static umode_t connector_is_dvii(struct kobject *kobj,
> - struct attribute *attr, int idx)
> -{
> - return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
> - attr->mode : 0;
> -}
> -
> -static umode_t connector_is_tv(struct kobject *kobj,
> - struct attribute *attr, int idx)
> -{
> - switch (kobj_connector_type(kobj)) {
> - case DRM_MODE_CONNECTOR_Composite:
> - case DRM_MODE_CONNECTOR_SVIDEO:
> - case DRM_MODE_CONNECTOR_Component:
> - case DRM_MODE_CONNECTOR_TV:
> - return attr->mode;
> - }
> -
> - return 0;
> -}
> -
> static struct bin_attribute edid_attr = {
> .attr.name = "edid",
> .attr.mode = 0444,
> @@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
> .bin_attrs = connector_bin_attrs,
> };
>
> -static const struct attribute_group connector_tv_dev_group = {
> - .attrs = connector_tv_dev_attrs,
> - .is_visible = connector_is_tv,
> -};
> -
> -static const struct attribute_group connector_dvii_dev_group = {
> - .attrs = connector_dvii_dev_attrs,
> - .is_visible = connector_is_dvii,
> -};
> -
> static const struct attribute_group *connector_dev_groups[] = {
> &connector_dev_group,
> - &connector_tv_dev_group,
> - &connector_dvii_dev_group,
> NULL
> };
>
> --
> 2.8.0.rc3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files
2016-03-30 13:49 ` Alex Deucher
@ 2016-03-30 15:30 ` Daniel Vetter
0 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 15:30 UTC (permalink / raw)
To: Alex Deucher
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
Daniel Vetter
On Wed, Mar 30, 2016 at 09:49:26AM -0400, Alex Deucher wrote:
> On Wed, Mar 30, 2016 at 5:45 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > This goes all the way back to the original KMS commit aeons ago
> >
> > commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef
> > Author: Dave Airlie <airlied@redhat.com>
> > Date: Fri Nov 7 14:05:41 2008 -0800
> >
> > DRM: add mode setting support
> >
> > But it seems to be completely unused. Only i915 and nouveau even
> > register these properties, and the corresponding DDX don't even look
> > at them. Also the sysfs files are read-only, so not useful to
> > configure anything.
> >
> > I suspect that this was added with the goal to have read-only access
> > to all properties in sysfs, but we never followed through on that.
> > Also, that should be done in a more generic fashion.
> >
> > Since it would be real work to fix up the locking (with atomic we're
> > now chasing pointers when reading properties) and it seems unused lets
> > just nuke this all. It's easier. Of course we'll keep the properties
> > themselves, those are still exposed through the KMS ioctls.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Applied, thanks for the review.
-Daniel
>
> > ---
> > drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
> > 1 file changed, 156 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index 43875cb35691..fa7fadce8063 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
> > return written;
> > }
> >
> > -static ssize_t tv_subconnector_show(struct device *device,
> > - struct device_attribute *attr,
> > - char *buf)
> > -{
> > - struct drm_connector *connector = to_drm_connector(device);
> > - struct drm_device *dev = connector->dev;
> > - struct drm_property *prop;
> > - uint64_t subconnector;
> > - int ret;
> > -
> > - prop = dev->mode_config.tv_subconnector_property;
> > - if (!prop) {
> > - DRM_ERROR("Unable to find subconnector property\n");
> > - return 0;
> > - }
> > -
> > - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> > - if (ret)
> > - return 0;
> > -
> > - return snprintf(buf, PAGE_SIZE, "%s",
> > - drm_get_tv_subconnector_name((int)subconnector));
> > -}
> > -
> > -static ssize_t tv_select_subconnector_show(struct device *device,
> > - struct device_attribute *attr,
> > - char *buf)
> > -{
> > - struct drm_connector *connector = to_drm_connector(device);
> > - struct drm_device *dev = connector->dev;
> > - struct drm_property *prop;
> > - uint64_t subconnector;
> > - int ret;
> > -
> > - prop = dev->mode_config.tv_select_subconnector_property;
> > - if (!prop) {
> > - DRM_ERROR("Unable to find select subconnector property\n");
> > - return 0;
> > - }
> > -
> > - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> > - if (ret)
> > - return 0;
> > -
> > - return snprintf(buf, PAGE_SIZE, "%s",
> > - drm_get_tv_select_name((int)subconnector));
> > -}
> > -
> > -static ssize_t dvii_subconnector_show(struct device *device,
> > - struct device_attribute *attr,
> > - char *buf)
> > -{
> > - struct drm_connector *connector = to_drm_connector(device);
> > - struct drm_device *dev = connector->dev;
> > - struct drm_property *prop;
> > - uint64_t subconnector;
> > - int ret;
> > -
> > - prop = dev->mode_config.dvi_i_subconnector_property;
> > - if (!prop) {
> > - DRM_ERROR("Unable to find subconnector property\n");
> > - return 0;
> > - }
> > -
> > - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> > - if (ret)
> > - return 0;
> > -
> > - return snprintf(buf, PAGE_SIZE, "%s",
> > - drm_get_dvi_i_subconnector_name((int)subconnector));
> > -}
> > -
> > -static ssize_t dvii_select_subconnector_show(struct device *device,
> > - struct device_attribute *attr,
> > - char *buf)
> > -{
> > - struct drm_connector *connector = to_drm_connector(device);
> > - struct drm_device *dev = connector->dev;
> > - struct drm_property *prop;
> > - uint64_t subconnector;
> > - int ret;
> > -
> > - prop = dev->mode_config.dvi_i_select_subconnector_property;
> > - if (!prop) {
> > - DRM_ERROR("Unable to find select subconnector property\n");
> > - return 0;
> > - }
> > -
> > - ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
> > - if (ret)
> > - return 0;
> > -
> > - return snprintf(buf, PAGE_SIZE, "%s",
> > - drm_get_dvi_i_select_name((int)subconnector));
> > -}
> > -
> > static DEVICE_ATTR_RW(status);
> > static DEVICE_ATTR_RO(enabled);
> > static DEVICE_ATTR_RO(dpms);
> > @@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
> > NULL
> > };
> >
> > -static DEVICE_ATTR_RO(tv_subconnector);
> > -static DEVICE_ATTR_RO(tv_select_subconnector);
> > -
> > -static struct attribute *connector_tv_dev_attrs[] = {
> > - &dev_attr_tv_subconnector.attr,
> > - &dev_attr_tv_select_subconnector.attr,
> > - NULL
> > -};
> > -
> > -static DEVICE_ATTR_RO(dvii_subconnector);
> > -static DEVICE_ATTR_RO(dvii_select_subconnector);
> > -
> > -static struct attribute *connector_dvii_dev_attrs[] = {
> > - &dev_attr_dvii_subconnector.attr,
> > - &dev_attr_dvii_select_subconnector.attr,
> > - NULL
> > -};
> > -
> > -/* Connector type related helpers */
> > -static int kobj_connector_type(struct kobject *kobj)
> > -{
> > - struct device *dev = kobj_to_dev(kobj);
> > - struct drm_connector *connector = to_drm_connector(dev);
> > -
> > - return connector->connector_type;
> > -}
> > -
> > -static umode_t connector_is_dvii(struct kobject *kobj,
> > - struct attribute *attr, int idx)
> > -{
> > - return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
> > - attr->mode : 0;
> > -}
> > -
> > -static umode_t connector_is_tv(struct kobject *kobj,
> > - struct attribute *attr, int idx)
> > -{
> > - switch (kobj_connector_type(kobj)) {
> > - case DRM_MODE_CONNECTOR_Composite:
> > - case DRM_MODE_CONNECTOR_SVIDEO:
> > - case DRM_MODE_CONNECTOR_Component:
> > - case DRM_MODE_CONNECTOR_TV:
> > - return attr->mode;
> > - }
> > -
> > - return 0;
> > -}
> > -
> > static struct bin_attribute edid_attr = {
> > .attr.name = "edid",
> > .attr.mode = 0444,
> > @@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
> > .bin_attrs = connector_bin_attrs,
> > };
> >
> > -static const struct attribute_group connector_tv_dev_group = {
> > - .attrs = connector_tv_dev_attrs,
> > - .is_visible = connector_is_tv,
> > -};
> > -
> > -static const struct attribute_group connector_dvii_dev_group = {
> > - .attrs = connector_dvii_dev_attrs,
> > - .is_visible = connector_is_dvii,
> > -};
> > -
> > static const struct attribute_group *connector_dev_groups[] = {
> > &connector_dev_group,
> > - &connector_tv_dev_group,
> > - &connector_dvii_dev_group,
> > NULL
> > };
> >
> > --
> > 2.8.0.rc3
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (3 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 10:09 ` kbuild test robot
2016-03-30 9:45 ` [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit Daniel Vetter
` (5 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter
It has a DRIVER_MODESET check to sure make it's not creating havoc
for drm drivers. Make that clear in the name too.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_agpsupport.c | 4 ++--
drivers/gpu/drm/drm_fops.c | 2 +-
drivers/gpu/drm/drm_pci.c | 2 +-
include/drm/drm_agpsupport.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index a10ea6aec629..605bd243fb36 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -423,7 +423,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
}
/**
- * drm_agp_clear - Clear AGP resource list
+ * drm_legacy_agp_clear - Clear AGP resource list
* @dev: DRM device
*
* Iterate over all AGP resources and remove them. But keep the AGP head
@@ -434,7 +434,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
* resources from getting destroyed. Drivers are responsible of cleaning them up
* during device shutdown.
*/
-void drm_agp_clear(struct drm_device *dev)
+void drm_legacy_agp_clear(struct drm_device *dev)
{
struct drm_agp_mem *entry, *tempe;
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index aeef58ed359b..7b5a13cda7a6 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -413,7 +413,7 @@ int drm_lastclose(struct drm_device * dev)
mutex_lock(&dev->struct_mutex);
- drm_agp_clear(dev);
+ drm_legacy_agp_clear(dev);
drm_legacy_sg_cleanup(dev);
drm_legacy_vma_flush(dev);
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index a1fff1179a97..29d5a548d07a 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -250,7 +250,7 @@ void drm_pci_agp_destroy(struct drm_device *dev)
{
if (dev->agp) {
arch_phys_wc_del(dev->agp->agp_mtrr);
- drm_agp_clear(dev);
+ drm_legacy_agp_clear(dev);
kfree(dev->agp);
dev->agp = NULL;
}
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
index 193ef19dfc5c..e134e9ca422b 100644
--- a/include/drm/drm_agpsupport.h
+++ b/include/drm/drm_agpsupport.h
@@ -37,7 +37,7 @@ struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
uint32_t type);
struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-void drm_agp_clear(struct drm_device *dev);
+void drm_legacy_agp_clear(struct drm_device *dev);
int drm_agp_acquire(struct drm_device *dev);
int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix
2016-03-30 9:45 ` [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix Daniel Vetter
@ 2016-03-30 10:09 ` kbuild test robot
2016-03-30 12:59 ` [Intel-gfx] " Thierry Reding
0 siblings, 1 reply; 30+ messages in thread
From: kbuild test robot @ 2016-03-30 10:09 UTC (permalink / raw)
Cc: Daniel Vetter, Intel Graphics Development, kbuild-all,
DRI Development, Daniel Vetter
[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]
Hi Daniel,
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
base: git://people.freedesktop.org/~airlied/linux.git drm-next
config: sparc64-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
Note: the linux-review/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803 HEAD 0ef75daff5d81f77ebd5796d853c534749223b2e builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
drivers/gpu/drm/drm_fops.c: In function 'drm_lastclose':
>> drivers/gpu/drm/drm_fops.c:416:2: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
drm_legacy_agp_clear(dev);
^
cc1: some warnings being treated as errors
--
drivers/gpu/drm/drm_pci.c: In function 'drm_pci_agp_destroy':
>> drivers/gpu/drm/drm_pci.c:253:3: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
drm_legacy_agp_clear(dev);
^
cc1: some warnings being treated as errors
vim +/drm_legacy_agp_clear +416 drivers/gpu/drm/drm_fops.c
410
411 if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
412 drm_irq_uninstall(dev);
413
414 mutex_lock(&dev->struct_mutex);
415
> 416 drm_legacy_agp_clear(dev);
417
418 drm_legacy_sg_cleanup(dev);
419 drm_legacy_vma_flush(dev);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44851 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [Intel-gfx] [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix
2016-03-30 10:09 ` kbuild test robot
@ 2016-03-30 12:59 ` Thierry Reding
0 siblings, 0 replies; 30+ messages in thread
From: Thierry Reding @ 2016-03-30 12:59 UTC (permalink / raw)
To: kbuild test robot
Cc: Daniel Vetter, Intel Graphics Development, kbuild-all,
DRI Development, Daniel Vetter
[-- Attachment #1.1: Type: text/plain, Size: 2105 bytes --]
On Wed, Mar 30, 2016 at 06:09:04PM +0800, kbuild test robot wrote:
> Hi Daniel,
>
> [auto build test ERROR on drm/drm-next]
> [also build test ERROR on v4.6-rc1 next-20160330]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
> base: git://people.freedesktop.org/~airlied/linux.git drm-next
> config: sparc64-allmodconfig (attached as .config)
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=sparc64
>
> Note: the linux-review/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803 HEAD 0ef75daff5d81f77ebd5796d853c534749223b2e builds fine.
> It only hurts bisectibility.
>
> All errors (new ones prefixed by >>):
>
> drivers/gpu/drm/drm_fops.c: In function 'drm_lastclose':
> >> drivers/gpu/drm/drm_fops.c:416:2: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
> drm_legacy_agp_clear(dev);
> ^
> cc1: some warnings being treated as errors
> --
> drivers/gpu/drm/drm_pci.c: In function 'drm_pci_agp_destroy':
> >> drivers/gpu/drm/drm_pci.c:253:3: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
> drm_legacy_agp_clear(dev);
> ^
> cc1: some warnings being treated as errors
>
> vim +/drm_legacy_agp_clear +416 drivers/gpu/drm/drm_fops.c
>
> 410
> 411 if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
> 412 drm_irq_uninstall(dev);
> 413
> 414 mutex_lock(&dev->struct_mutex);
> 415
> > 416 drm_legacy_agp_clear(dev);
> 417
> 418 drm_legacy_sg_cleanup(dev);
> 419 drm_legacy_vma_flush(dev);
FWIW, this is because the dummy implementation wasn't renamed.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (4 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 13:01 ` Thierry Reding
2016-03-30 9:45 ` [PATCH 07/10] drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix Daniel Vetter
` (4 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter
Except for the ->lasclose driver callback evrything in drm_lastclose()
is all legacy cruft and can be hidden. Which means another
dev->struct_mutex site disappears entirely for modern drivers!
Also while at it change the return value of drm_lastclose to void
since it will always succeed. No one checks the return value of
close() anyway, ever.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_fops.c | 42 +++++++++++++++++++-----------------------
drivers/gpu/drm/drm_internal.h | 2 +-
include/drm/drm_agpsupport.h | 2 +-
3 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 7b5a13cda7a6..c3d0aaac0669 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -381,14 +381,26 @@ static void drm_events_release(struct drm_file *file_priv)
*/
static void drm_legacy_dev_reinit(struct drm_device *dev)
{
- if (drm_core_check_feature(dev, DRIVER_MODESET))
- return;
+ if (dev->irq_enabled)
+ drm_irq_uninstall(dev);
+
+ mutex_lock(&dev->struct_mutex);
+
+ drm_legacy_agp_clear(dev);
+
+ drm_legacy_sg_cleanup(dev);
+ drm_legacy_vma_flush(dev);
+ drm_legacy_dma_takedown(dev);
+
+ mutex_unlock(&dev->struct_mutex);
dev->sigdata.lock = NULL;
dev->context_flag = 0;
dev->last_context = 0;
dev->if_version = 0;
+
+ DRM_DEBUG("lastclose completed\n");
}
/*
@@ -400,7 +412,7 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
*
* \sa drm_device
*/
-int drm_lastclose(struct drm_device * dev)
+void drm_lastclose(struct drm_device * dev)
{
DRM_DEBUG("\n");
@@ -408,23 +420,8 @@ int drm_lastclose(struct drm_device * dev)
dev->driver->lastclose(dev);
DRM_DEBUG("driver lastclose completed\n");
- if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
- drm_irq_uninstall(dev);
-
- mutex_lock(&dev->struct_mutex);
-
- drm_legacy_agp_clear(dev);
-
- drm_legacy_sg_cleanup(dev);
- drm_legacy_vma_flush(dev);
- drm_legacy_dma_takedown(dev);
-
- mutex_unlock(&dev->struct_mutex);
-
- drm_legacy_dev_reinit(dev);
-
- DRM_DEBUG("lastclose completed\n");
- return 0;
+ if (!drm_core_check_feature(dev, DRIVER_MODESET))
+ drm_legacy_dev_reinit(dev);
}
/**
@@ -445,7 +442,6 @@ int drm_release(struct inode *inode, struct file *filp)
struct drm_file *file_priv = filp->private_data;
struct drm_minor *minor = file_priv->minor;
struct drm_device *dev = minor->dev;
- int retcode = 0;
mutex_lock(&drm_global_mutex);
@@ -538,7 +534,7 @@ int drm_release(struct inode *inode, struct file *filp)
*/
if (!--dev->open_count) {
- retcode = drm_lastclose(dev);
+ drm_lastclose(dev);
if (drm_device_is_unplugged(dev))
drm_put_dev(dev);
}
@@ -546,7 +542,7 @@ int drm_release(struct inode *inode, struct file *filp)
drm_minor_release(minor);
- return retcode;
+ return 0;
}
EXPORT_SYMBOL(drm_release);
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 43cbda3306ac..c81ff4769e7b 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -26,7 +26,7 @@ extern unsigned int drm_timestamp_monotonic;
/* drm_fops.c */
extern struct mutex drm_global_mutex;
-int drm_lastclose(struct drm_device *dev);
+void drm_lastclose(struct drm_device *dev);
/* drm_pci.c */
int drm_pci_set_unique(struct drm_device *dev,
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
index e134e9ca422b..b2d912670a7f 100644
--- a/include/drm/drm_agpsupport.h
+++ b/include/drm/drm_agpsupport.h
@@ -93,7 +93,7 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
return NULL;
}
-static inline void drm_agp_clear(struct drm_device *dev)
+static inline void drm_legacy_agp_clear(struct drm_device *dev)
{
}
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit
2016-03-30 9:45 ` [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit Daniel Vetter
@ 2016-03-30 13:01 ` Thierry Reding
0 siblings, 0 replies; 30+ messages in thread
From: Thierry Reding @ 2016-03-30 13:01 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development, DRI Development
[-- Attachment #1.1: Type: text/plain, Size: 569 bytes --]
On Wed, Mar 30, 2016 at 11:45:16AM +0200, Daniel Vetter wrote:
[...]
> diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
> index e134e9ca422b..b2d912670a7f 100644
> --- a/include/drm/drm_agpsupport.h
> +++ b/include/drm/drm_agpsupport.h
> @@ -93,7 +93,7 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
> return NULL;
> }
>
> -static inline void drm_agp_clear(struct drm_device *dev)
> +static inline void drm_legacy_agp_clear(struct drm_device *dev)
Ah... it ended up in the wrong patch.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 07/10] drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (5 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 9:45 ` [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET Daniel Vetter
` (3 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter
It belongs right next to the addmap and rmmap functions really. And
for OCD consistency name it drm_legacy_getmap_ioctl.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_bufs.c | 52 ++++++++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/drm_ioctl.c | 54 +-------------------------------------------
drivers/gpu/drm/drm_legacy.h | 2 ++
3 files changed, 55 insertions(+), 53 deletions(-)
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index f1a204d253cc..d92db7007f62 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -416,6 +416,58 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
return 0;
}
+/*
+ * Get a mapping information.
+ *
+ * \param inode device inode.
+ * \param file_priv DRM file private.
+ * \param cmd command.
+ * \param arg user argument, pointing to a drm_map structure.
+ *
+ * \return zero on success or a negative number on failure.
+ *
+ * Searches for the mapping with the specified offset and copies its information
+ * into userspace
+ */
+int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv)
+{
+ struct drm_map *map = data;
+ struct drm_map_list *r_list = NULL;
+ struct list_head *list;
+ int idx;
+ int i;
+
+ idx = map->offset;
+ if (idx < 0)
+ return -EINVAL;
+
+ i = 0;
+ mutex_lock(&dev->struct_mutex);
+ list_for_each(list, &dev->maplist) {
+ if (i == idx) {
+ r_list = list_entry(list, struct drm_map_list, head);
+ break;
+ }
+ i++;
+ }
+ if (!r_list || !r_list->map) {
+ mutex_unlock(&dev->struct_mutex);
+ return -EINVAL;
+ }
+
+ map->offset = r_list->map->offset;
+ map->size = r_list->map->size;
+ map->type = r_list->map->type;
+ map->flags = r_list->map->flags;
+ map->handle = (void *)(unsigned long) r_list->user_token;
+ map->mtrr = arch_phys_wc_index(r_list->map->mtrr);
+
+ mutex_unlock(&dev->struct_mutex);
+
+ return 0;
+}
+
/**
* Remove a map private from list and deallocate resources if the mapping
* isn't in use.
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 3ecd1368c23a..24b941c3b561 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -148,58 +148,6 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
}
/*
- * Get a mapping information.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg user argument, pointing to a drm_map structure.
- *
- * \return zero on success or a negative number on failure.
- *
- * Searches for the mapping with the specified offset and copies its information
- * into userspace
- */
-static int drm_getmap(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_map *map = data;
- struct drm_map_list *r_list = NULL;
- struct list_head *list;
- int idx;
- int i;
-
- idx = map->offset;
- if (idx < 0)
- return -EINVAL;
-
- i = 0;
- mutex_lock(&dev->struct_mutex);
- list_for_each(list, &dev->maplist) {
- if (i == idx) {
- r_list = list_entry(list, struct drm_map_list, head);
- break;
- }
- i++;
- }
- if (!r_list || !r_list->map) {
- mutex_unlock(&dev->struct_mutex);
- return -EINVAL;
- }
-
- map->offset = r_list->map->offset;
- map->size = r_list->map->size;
- map->type = r_list->map->type;
- map->flags = r_list->map->flags;
- map->handle = (void *)(unsigned long) r_list->user_token;
- map->mtrr = arch_phys_wc_index(r_list->map->mtrr);
-
- mutex_unlock(&dev->struct_mutex);
-
- return 0;
-}
-
-/*
* Get client information.
*
* \param inode device inode.
@@ -556,7 +504,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0),
DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0),
DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_getmap, DRM_UNLOCKED),
+ DRM_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_legacy_getmap_ioctl, DRM_UNLOCKED),
DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, DRM_UNLOCKED),
DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, DRM_UNLOCKED),
DRM_IOCTL_DEF(DRM_IOCTL_GET_CAP, drm_getcap, DRM_UNLOCKED|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
index 9b731786e4db..d3b6ee357a2b 100644
--- a/drivers/gpu/drm/drm_legacy.h
+++ b/drivers/gpu/drm/drm_legacy.h
@@ -63,6 +63,8 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
#define DRM_MAP_HASH_OFFSET 0x10000000
+int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
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);
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (6 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 07/10] drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 10:39 ` Emil Velikov
2016-03-30 9:45 ` [PATCH 09/10] drm: Push struct_mutex into ->master_destroy Daniel Vetter
` (2 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development
Cc: Daniel Vetter, Daniel Vetter, Intel Graphics Development,
Ben Skeggs
Like in
commit 0e975980d435d58df2d430d688b8c18778b42218
Author: Peter Antoine <peter.antoine@intel.com>
Date: Tue Jun 23 08:18:49 2015 +0100
drm: Turn off Legacy Context Functions
we need to again make an exception for nouveau, but everyone else
really doesn't need this.
Cc: Peter Antoine <peter.antoine@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index d92db7007f62..e8a12a4fd400 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
return -EPERM;
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+ drm_core_check_feature(dev, DRIVER_MODESET))
+ return -EINVAL;
+
err = drm_addmap_core(dev, map->offset, map->size, map->type,
map->flags, &maplist);
@@ -438,6 +442,10 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
int idx;
int i;
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+ drm_core_check_feature(dev, DRIVER_MODESET))
+ return -EINVAL;
+
idx = map->offset;
if (idx < 0)
return -EINVAL;
@@ -569,6 +577,10 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
struct drm_map_list *r_list;
int ret;
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+ drm_core_check_feature(dev, DRIVER_MODESET))
+ return -EINVAL;
+
mutex_lock(&dev->struct_mutex);
list_for_each_entry(r_list, &dev->maplist, head) {
if (r_list->map &&
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET
2016-03-30 9:45 ` [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET Daniel Vetter
@ 2016-03-30 10:39 ` Emil Velikov
2016-04-14 10:06 ` Daniel Vetter
0 siblings, 1 reply; 30+ messages in thread
From: Emil Velikov @ 2016-03-30 10:39 UTC (permalink / raw)
To: Daniel Vetter
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
Ben Skeggs
On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Like in
>
> commit 0e975980d435d58df2d430d688b8c18778b42218
> Author: Peter Antoine <peter.antoine@intel.com>
> Date: Tue Jun 23 08:18:49 2015 +0100
>
> drm: Turn off Legacy Context Functions
>
> we need to again make an exception for nouveau, but everyone else
> really doesn't need this.
>
> Cc: Peter Antoine <peter.antoine@intel.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index d92db7007f62..e8a12a4fd400 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
> if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
> return -EPERM;
>
> + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> + drm_core_check_feature(dev, DRIVER_MODESET))
> + return -EINVAL;
> +
Wondering if making this the first check in the function won't be
better ? We have a handful of places which preemptively check
DRIVER_MODESET prior to calling drm_legacy functions and similarly
some (last time I've looked) drm_legacy functions check for
DRIVER_MODESET. Perhaps we can move all the checking into the
drm_legacy API alone ?
-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET
2016-03-30 10:39 ` Emil Velikov
@ 2016-04-14 10:06 ` Daniel Vetter
2016-04-14 13:57 ` Emil Velikov
0 siblings, 1 reply; 30+ messages in thread
From: Daniel Vetter @ 2016-04-14 10:06 UTC (permalink / raw)
To: Emil Velikov
Cc: Peter Antoine, Daniel Vetter, Intel Graphics Development,
DRI Development, Ben Skeggs, Daniel Vetter
On Wed, Mar 30, 2016 at 11:39:01AM +0100, Emil Velikov wrote:
> On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Like in
> >
> > commit 0e975980d435d58df2d430d688b8c18778b42218
> > Author: Peter Antoine <peter.antoine@intel.com>
> > Date: Tue Jun 23 08:18:49 2015 +0100
> >
> > drm: Turn off Legacy Context Functions
> >
> > we need to again make an exception for nouveau, but everyone else
> > really doesn't need this.
> >
> > Cc: Peter Antoine <peter.antoine@intel.com>
> > Cc: Ben Skeggs <bskeggs@redhat.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> > drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> > index d92db7007f62..e8a12a4fd400 100644
> > --- a/drivers/gpu/drm/drm_bufs.c
> > +++ b/drivers/gpu/drm/drm_bufs.c
> > @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
> > if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
> > return -EPERM;
> >
> > + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> > + drm_core_check_feature(dev, DRIVER_MODESET))
> > + return -EINVAL;
> > +
> Wondering if making this the first check in the function won't be
> better ? We have a handful of places which preemptively check
> DRIVER_MODESET prior to calling drm_legacy functions and similarly
> some (last time I've looked) drm_legacy functions check for
> DRIVER_MODESET. Perhaps we can move all the checking into the
> drm_legacy API alone ?
This is an ioctl handler, so there's not really any caller we can move
this to. In general I'm split, and I just put checks like these wherever
it makes sense, pulling them out into callers if there's an entire pile of
them who all want the same checks.
In the end I don't think it matters, as long as we dutifully combine
drm_legacy_* with such checks, so that it's _really_ all dead code for
modern drives.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET
2016-04-14 10:06 ` Daniel Vetter
@ 2016-04-14 13:57 ` Emil Velikov
0 siblings, 0 replies; 30+ messages in thread
From: Emil Velikov @ 2016-04-14 13:57 UTC (permalink / raw)
To: Daniel Vetter
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
Ben Skeggs, Daniel Vetter
On 14 April 2016 at 11:06, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Mar 30, 2016 at 11:39:01AM +0100, Emil Velikov wrote:
>> On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> > Like in
>> >
>> > commit 0e975980d435d58df2d430d688b8c18778b42218
>> > Author: Peter Antoine <peter.antoine@intel.com>
>> > Date: Tue Jun 23 08:18:49 2015 +0100
>> >
>> > drm: Turn off Legacy Context Functions
>> >
>> > we need to again make an exception for nouveau, but everyone else
>> > really doesn't need this.
>> >
>> > Cc: Peter Antoine <peter.antoine@intel.com>
>> > Cc: Ben Skeggs <bskeggs@redhat.com>
>> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>> > ---
>> > drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
>> > 1 file changed, 12 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
>> > index d92db7007f62..e8a12a4fd400 100644
>> > --- a/drivers/gpu/drm/drm_bufs.c
>> > +++ b/drivers/gpu/drm/drm_bufs.c
>> > @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
>> > if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
>> > return -EPERM;
>> >
>> > + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>> > + drm_core_check_feature(dev, DRIVER_MODESET))
>> > + return -EINVAL;
>> > +
>> Wondering if making this the first check in the function won't be
>> better ? We have a handful of places which preemptively check
>> DRIVER_MODESET prior to calling drm_legacy functions and similarly
>> some (last time I've looked) drm_legacy functions check for
>> DRIVER_MODESET. Perhaps we can move all the checking into the
>> drm_legacy API alone ?
>
> This is an ioctl handler, so there's not really any caller we can move
> this to.
Indeed. One could extract the legacy ioctls into separate table and/or
use a function alike drm_ioctl_permit() to generalise things. It will
allow clear and obvious separation of things, although the particular
above will make things a bit annoying.
> In general I'm split, and I just put checks like these wherever
> it makes sense, pulling them out into callers if there's an entire pile of
> them who all want the same checks.
>
> In the end I don't think it matters, as long as we dutifully combine
> drm_legacy_* with such checks, so that it's _really_ all dead code for
> modern drives.
I'd suspect that there's a few bits that are missing the check, plus
going through might be a bit time consuming. Thus thinking of a
'generic' way to handle things.
Just thinking out loud :-)
-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 09/10] drm: Push struct_mutex into ->master_destroy
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (7 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 9:45 ` [PATCH 10/10] drm: Hide master MAP cleanup in drm_bufs.c Daniel Vetter
2016-03-30 16:13 ` ✗ Fi.CI.BAT: failure for Another shot at cruft removal Patchwork
10 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development
Cc: Alex Deucher, Daniel Vetter, Intel Graphics Development,
Thomas Hellstrom, Daniel Vetter
Only two drivers implement this hook. vmwgfx (which doesn't need it
really) and legacy radeon (which since v1 has been nuked, yay).
v1: Rebase over radeon ums removal.
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 167c8d3d4a31..845aa644c890 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -113,10 +113,10 @@ static void drm_master_destroy(struct kref *kref)
struct drm_device *dev = master->minor->dev;
struct drm_map_list *r_list, *list_temp;
- mutex_lock(&dev->struct_mutex);
if (dev->driver->master_destroy)
dev->driver->master_destroy(dev, master);
+ mutex_lock(&dev->struct_mutex);
list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
if (r_list->master == master) {
drm_legacy_rmmap_locked(dev, r_list->map);
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH 10/10] drm: Hide master MAP cleanup in drm_bufs.c
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (8 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 09/10] drm: Push struct_mutex into ->master_destroy Daniel Vetter
@ 2016-03-30 9:45 ` Daniel Vetter
2016-03-30 16:13 ` ✗ Fi.CI.BAT: failure for Another shot at cruft removal Patchwork
10 siblings, 0 replies; 30+ messages in thread
From: Daniel Vetter @ 2016-03-30 9:45 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter
And again make sure it's a no-op for modern drivers, again with the
exception of nouveau. Another case of dev->struct_mutex gone for
modern drivers!
v2: Also add a DRIVER_* check like for all other maps functions to
really short-circuit the code. And give drm_legacy_rmmap used by the
dev unregister code the same treatment.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_bufs.c | 28 ++++++++++++++++++++++++----
drivers/gpu/drm/drm_drv.c | 10 +---------
include/drm/drm_legacy.h | 4 +++-
3 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index e8a12a4fd400..5a51633da033 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -542,18 +542,38 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
}
EXPORT_SYMBOL(drm_legacy_rmmap_locked);
-int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
+void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
{
- int ret;
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+ drm_core_check_feature(dev, DRIVER_MODESET))
+ return;
mutex_lock(&dev->struct_mutex);
- ret = drm_legacy_rmmap_locked(dev, map);
+ drm_legacy_rmmap_locked(dev, map);
mutex_unlock(&dev->struct_mutex);
- return ret;
+ return;
}
EXPORT_SYMBOL(drm_legacy_rmmap);
+void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master)
+{
+ struct drm_map_list *r_list, *list_temp;
+
+ if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+ drm_core_check_feature(dev, DRIVER_MODESET))
+ return;
+
+ mutex_lock(&dev->struct_mutex);
+ list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
+ if (r_list->master == master) {
+ drm_legacy_rmmap_locked(dev, r_list->map);
+ r_list = NULL;
+ }
+ }
+ mutex_unlock(&dev->struct_mutex);
+}
+
/* 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
* exit uncleanly. Therefore, having userland manually remove mappings seems
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 845aa644c890..4bd8ec529060 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -111,19 +111,11 @@ static void drm_master_destroy(struct kref *kref)
{
struct drm_master *master = container_of(kref, struct drm_master, refcount);
struct drm_device *dev = master->minor->dev;
- struct drm_map_list *r_list, *list_temp;
if (dev->driver->master_destroy)
dev->driver->master_destroy(dev, master);
- mutex_lock(&dev->struct_mutex);
- list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
- if (r_list->master == master) {
- drm_legacy_rmmap_locked(dev, r_list->map);
- r_list = NULL;
- }
- }
- mutex_unlock(&dev->struct_mutex);
+ drm_legacy_master_rmmaps(dev, master);
idr_destroy(&master->magic_map);
kfree(master->unique);
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index 3e698038dc7b..a5ef2c7e40f8 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -154,8 +154,10 @@ struct drm_map_list {
int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, struct drm_local_map **map_p);
-int drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
+void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
+void drm_legacy_master_rmmaps(struct drm_device *dev,
+ struct drm_master *master);
struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);
int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma);
--
2.8.0.rc3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 30+ messages in thread* ✗ Fi.CI.BAT: failure for Another shot at cruft removal
2016-03-30 9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
` (9 preceding siblings ...)
2016-03-30 9:45 ` [PATCH 10/10] drm: Hide master MAP cleanup in drm_bufs.c Daniel Vetter
@ 2016-03-30 16:13 ` Patchwork
10 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2016-03-30 16:13 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx
== Series Details ==
Series: Another shot at cruft removal
URL : https://patchwork.freedesktop.org/series/5033/
State : failure
== Summary ==
Series 5033v1 Another shot at cruft removal
2016-03-30T09:23:14.874392 http://patchwork.freedesktop.org/api/1.0/series/5033/revisions/1/mbox/
Applying: drm/ttm: Remove TTM_HAS_AGP
Using index info to reconstruct a base tree...
M drivers/gpu/drm/ttm/Makefile
M drivers/gpu/drm/ttm/ttm_agp_backend.c
M drivers/gpu/drm/ttm/ttm_page_alloc.c
M drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
M include/drm/ttm/ttm_bo_driver.h
Falling back to patching base and 3-way merge...
Auto-merging include/drm/ttm/ttm_bo_driver.h
CONFLICT (content): Merge conflict in include/drm/ttm/ttm_bo_driver.h
Patch failed at 0001 drm/ttm: Remove TTM_HAS_AGP
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 30+ messages in thread