Skip to content

Commit 1afc454

Browse files
committed
Merge tag 'drm-misc-next-2017-05-26' of git://anongit.freedesktop.org/git/drm-misc into drm-next
UAPI Changes: - Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI (Robert) Cross-subsystem Changes: - Standardize sync_file.txt documentation format (Mauro) Core Changes: - Turf drm_[cm]alloc functions for kvmalloc alternatives (Michal) - Add optional mode_valid() hook to crtc/encoder/bridge (Jose) - Improve documentation around mode validation/alteration (Daniel) - Reduce sync_file construction time by deferring name creation (Chris) Driver Changes: - pl111: Wire up the clock divider and add debugfs (Eric) - various: Fix include notation and remove -Iinclude/drm (Masahiro) - stm: Add Benjamin Gaignard and Vincent Abriou as STM maintainers (Vincent) - various: Miscellaneous trivial fixes to pl111/stm/vgem/vc4 Cc: Michal Hocko <mhocko@suse.com> Cc: Eric Anholt <eric@anholt.net> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Robert Foss <robert.foss@collabora.com> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Jose Abreu <Jose.Abreu@synopsys.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com> * tag 'drm-misc-next-2017-05-26' of git://anongit.freedesktop.org/git/drm-misc: (55 commits) dma-buf/sync-file: Defer creation of sync_file->name sync_file.txt: standardize document format gpu: drm: gma500: remove two more dead variable drm/doc: Clarify mode_fixup vs. atomic_check a bit more drm/doc: Document adjusted/request modes a bit better drm: Add crtc/encoder/bridge->mode_valid() callbacks MAINTAINERS: update drm/stm maintainers list drm/stm: ltdc: fix duplicated arguments drm/pl111: Fix return value check in pl111_amba_probe() drm/amd: include <linux/delay.h> instead of "linux/delay.h" drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI drm/vgem: Fix return value check in vgem_init() drm/blend: Fix comment typ-o drm/stm: remove unneeded -Iinclude/drm compiler flag drm/vc4: fix include notation and remove -Iinclude/drm flag drm/pl111: Add a debugfs node to dump our registers. drm/pl111: make structure mode_config_funcs static drm/pl111: make structure pl111_display_funcs static drm/pl111: Register the clock divider and use it. drm: drop drm_[cm]alloc* helpers ...
2 parents e98c58e + 71ebc9a commit 1afc454

File tree

224 files changed

+1194
-814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+1194
-814
lines changed

Documentation/sync_file.txt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Sync File API Guide
2-
~~~~~~~~~~~~~~~~~~~
1+
===================
2+
Sync File API Guide
3+
===================
34

4-
Gustavo Padovan
5-
<gustavo at padovan dot org>
5+
:Author: Gustavo Padovan <gustavo at padovan dot org>
66

77
This document serves as a guide for device drivers writers on what the
88
sync_file API is, and how drivers can support it. Sync file is the carrier of
@@ -46,16 +46,17 @@ Creating Sync Files
4646

4747
When a driver needs to send an out-fence userspace it creates a sync_file.
4848

49-
Interface:
49+
Interface::
50+
5051
struct sync_file *sync_file_create(struct dma_fence *fence);
5152

5253
The caller pass the out-fence and gets back the sync_file. That is just the
5354
first step, next it needs to install an fd on sync_file->file. So it gets an
54-
fd:
55+
fd::
5556

5657
fd = get_unused_fd_flags(O_CLOEXEC);
5758

58-
and installs it on sync_file->file:
59+
and installs it on sync_file->file::
5960

6061
fd_install(fd, sync_file->file);
6162

@@ -71,13 +72,15 @@ When userspace needs to send an in-fence to the driver it passes file descriptor
7172
of the Sync File to the kernel. The kernel can then retrieve the fences
7273
from it.
7374

74-
Interface:
75+
Interface::
76+
7577
struct dma_fence *sync_file_get_fence(int fd);
7678

7779

7880
The returned reference is owned by the caller and must be disposed of
7981
afterwards using dma_fence_put(). In case of error, a NULL is returned instead.
8082

8183
References:
82-
[1] struct sync_file in include/linux/sync_file.h
83-
[2] All interfaces mentioned above defined in include/linux/sync_file.h
84+
85+
1. struct sync_file in include/linux/sync_file.h
86+
2. All interfaces mentioned above defined in include/linux/sync_file.h

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,8 @@ F: Documentation/devicetree/bindings/display/st,stih4xx.txt
45024502
DRM DRIVERS FOR STM
45034503
M: Yannick Fertre <yannick.fertre@st.com>
45044504
M: Philippe Cornu <philippe.cornu@st.com>
4505+
M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
4506+
M: Vincent Abriou <vincent.abriou@st.com>
45054507
L: dri-devel@lists.freedesktop.org
45064508
T: git git://anongit.freedesktop.org/drm/drm-misc
45074509
S: Maintained

drivers/dma-buf/sync_debug.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,11 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
132132
static void sync_print_sync_file(struct seq_file *s,
133133
struct sync_file *sync_file)
134134
{
135+
char buf[128];
135136
int i;
136137

137-
seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
138+
seq_printf(s, "[%p] %s: %s\n", sync_file,
139+
sync_file_get_name(sync_file, buf, sizeof(buf)),
138140
sync_status_str(dma_fence_get_status(sync_file->fence)));
139141

140142
if (dma_fence_is_array(sync_file->fence)) {

drivers/dma-buf/sync_file.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ struct sync_file *sync_file_create(struct dma_fence *fence)
8080

8181
sync_file->fence = dma_fence_get(fence);
8282

83-
snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
84-
fence->ops->get_driver_name(fence),
85-
fence->ops->get_timeline_name(fence), fence->context,
86-
fence->seqno);
87-
8883
return sync_file;
8984
}
9085
EXPORT_SYMBOL(sync_file_create);
@@ -129,6 +124,36 @@ struct dma_fence *sync_file_get_fence(int fd)
129124
}
130125
EXPORT_SYMBOL(sync_file_get_fence);
131126

127+
/**
128+
* sync_file_get_name - get the name of the sync_file
129+
* @sync_file: sync_file to get the fence from
130+
* @buf: destination buffer to copy sync_file name into
131+
* @len: available size of destination buffer.
132+
*
133+
* Each sync_file may have a name assigned either by the user (when merging
134+
* sync_files together) or created from the fence it contains. In the latter
135+
* case construction of the name is deferred until use, and so requires
136+
* sync_file_get_name().
137+
*
138+
* Returns: a string representing the name.
139+
*/
140+
char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len)
141+
{
142+
if (sync_file->user_name[0]) {
143+
strlcpy(buf, sync_file->user_name, len);
144+
} else {
145+
struct dma_fence *fence = sync_file->fence;
146+
147+
snprintf(buf, len, "%s-%s%llu-%d",
148+
fence->ops->get_driver_name(fence),
149+
fence->ops->get_timeline_name(fence),
150+
fence->context,
151+
fence->seqno);
152+
}
153+
154+
return buf;
155+
}
156+
132157
static int sync_file_set_fence(struct sync_file *sync_file,
133158
struct dma_fence **fences, int num_fences)
134159
{
@@ -266,7 +291,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
266291
goto err;
267292
}
268293

269-
strlcpy(sync_file->name, name, sizeof(sync_file->name));
294+
strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
270295
return sync_file;
271296

272297
err:
@@ -413,7 +438,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
413438
}
414439

415440
no_fences:
416-
strlcpy(info.name, sync_file->name, sizeof(info.name));
441+
sync_file_get_name(sync_file, info.name, sizeof(info.name));
417442
info.status = dma_fence_is_signaled(sync_file->fence);
418443
info.num_fences = num_fences;
419444

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
FULL_AMD_PATH=$(src)/..
66

7-
ccflags-y := -Iinclude/drm -I$(FULL_AMD_PATH)/include/asic_reg \
7+
ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
88
-I$(FULL_AMD_PATH)/include \
99
-I$(FULL_AMD_PATH)/amdgpu \
1010
-I$(FULL_AMD_PATH)/scheduler \

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
#include <linux/hashtable.h>
3737
#include <linux/dma-fence.h>
3838

39-
#include <ttm/ttm_bo_api.h>
40-
#include <ttm/ttm_bo_driver.h>
41-
#include <ttm/ttm_placement.h>
42-
#include <ttm/ttm_module.h>
43-
#include <ttm/ttm_execbuf_util.h>
39+
#include <drm/ttm/ttm_bo_api.h>
40+
#include <drm/ttm/ttm_bo_driver.h>
41+
#include <drm/ttm/ttm_placement.h>
42+
#include <drm/ttm/ttm_module.h>
43+
#include <drm/ttm/ttm_execbuf_util.h>
4444

4545
#include <drm/drmP.h>
4646
#include <drm/drm_gem.h>

drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
9696
int r;
9797
unsigned long total_size = 0;
9898

99-
array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry));
99+
array = kvmalloc_array(num_entries, sizeof(struct amdgpu_bo_list_entry), GFP_KERNEL);
100100
if (!array)
101101
return -ENOMEM;
102102
memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry));
@@ -148,7 +148,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
148148
for (i = 0; i < list->num_entries; ++i)
149149
amdgpu_bo_unref(&list->array[i].robj);
150150

151-
drm_free_large(list->array);
151+
kvfree(list->array);
152152

153153
list->gds_obj = gds_obj;
154154
list->gws_obj = gws_obj;
@@ -163,7 +163,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
163163
error_free:
164164
while (i--)
165165
amdgpu_bo_unref(&array[i].robj);
166-
drm_free_large(array);
166+
kvfree(array);
167167
return r;
168168
}
169169

@@ -224,7 +224,7 @@ void amdgpu_bo_list_free(struct amdgpu_bo_list *list)
224224
amdgpu_bo_unref(&list->array[i].robj);
225225

226226
mutex_destroy(&list->lock);
227-
drm_free_large(list->array);
227+
kvfree(list->array);
228228
kfree(list);
229229
}
230230

@@ -244,8 +244,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
244244

245245
int r;
246246

247-
info = drm_malloc_ab(args->in.bo_number,
248-
sizeof(struct drm_amdgpu_bo_list_entry));
247+
info = kvmalloc_array(args->in.bo_number,
248+
sizeof(struct drm_amdgpu_bo_list_entry), GFP_KERNEL);
249249
if (!info)
250250
return -ENOMEM;
251251

@@ -311,11 +311,11 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
311311

312312
memset(args, 0, sizeof(*args));
313313
args->out.list_handle = handle;
314-
drm_free_large(info);
314+
kvfree(info);
315315

316316
return 0;
317317

318318
error_free:
319-
drm_free_large(info);
319+
kvfree(info);
320320
return r;
321321
}

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
194194
size = p->chunks[i].length_dw;
195195
cdata = (void __user *)(uintptr_t)user_chunk.chunk_data;
196196

197-
p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t));
197+
p->chunks[i].kdata = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
198198
if (p->chunks[i].kdata == NULL) {
199199
ret = -ENOMEM;
200200
i--;
@@ -247,7 +247,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
247247
i = p->nchunks - 1;
248248
free_partial_kdata:
249249
for (; i >= 0; i--)
250-
drm_free_large(p->chunks[i].kdata);
250+
kvfree(p->chunks[i].kdata);
251251
kfree(p->chunks);
252252
p->chunks = NULL;
253253
p->nchunks = 0;
@@ -505,7 +505,7 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
505505
return r;
506506

507507
if (binding_userptr) {
508-
drm_free_large(lobj->user_pages);
508+
kvfree(lobj->user_pages);
509509
lobj->user_pages = NULL;
510510
}
511511
}
@@ -571,7 +571,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
571571
release_pages(e->user_pages,
572572
e->robj->tbo.ttm->num_pages,
573573
false);
574-
drm_free_large(e->user_pages);
574+
kvfree(e->user_pages);
575575
e->user_pages = NULL;
576576
}
577577

@@ -601,8 +601,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
601601
list_for_each_entry(e, &need_pages, tv.head) {
602602
struct ttm_tt *ttm = e->robj->tbo.ttm;
603603

604-
e->user_pages = drm_calloc_large(ttm->num_pages,
605-
sizeof(struct page*));
604+
e->user_pages = kvmalloc_array(ttm->num_pages,
605+
sizeof(struct page*),
606+
GFP_KERNEL | __GFP_ZERO);
606607
if (!e->user_pages) {
607608
r = -ENOMEM;
608609
DRM_ERROR("calloc failure in %s\n", __func__);
@@ -612,7 +613,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
612613
r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages);
613614
if (r) {
614615
DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n");
615-
drm_free_large(e->user_pages);
616+
kvfree(e->user_pages);
616617
e->user_pages = NULL;
617618
goto error_free_pages;
618619
}
@@ -708,7 +709,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
708709
release_pages(e->user_pages,
709710
e->robj->tbo.ttm->num_pages,
710711
false);
711-
drm_free_large(e->user_pages);
712+
kvfree(e->user_pages);
712713
}
713714
}
714715

@@ -761,7 +762,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo
761762
amdgpu_bo_list_put(parser->bo_list);
762763

763764
for (i = 0; i < parser->nchunks; i++)
764-
drm_free_large(parser->chunks[i].kdata);
765+
kvfree(parser->chunks[i].kdata);
765766
kfree(parser->chunks);
766767
if (parser->job)
767768
amdgpu_job_free(parser->job);

drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Authors: Alex Deucher
2323
*/
2424

25-
#include "drmP.h"
25+
#include <drm/drmP.h>
2626
#include "amdgpu.h"
2727
#include "amdgpu_atombios.h"
2828
#include "amdgpu_i2c.h"

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <linux/module.h>
4040
#include <linux/pm_runtime.h>
4141
#include <linux/vga_switcheroo.h>
42-
#include "drm_crtc_helper.h"
42+
#include <drm/drm_crtc_helper.h>
4343

4444
#include "amdgpu.h"
4545
#include "amdgpu_irq.h"

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
#include <linux/firmware.h>
27-
#include "drmP.h"
27+
#include <drm/drmP.h>
2828
#include "amdgpu.h"
2929
#include "amdgpu_psp.h"
3030
#include "amdgpu_ucode.h"

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
* Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
3030
* Dave Airlie
3131
*/
32-
#include <ttm/ttm_bo_api.h>
33-
#include <ttm/ttm_bo_driver.h>
34-
#include <ttm/ttm_placement.h>
35-
#include <ttm/ttm_module.h>
36-
#include <ttm/ttm_page_alloc.h>
32+
#include <drm/ttm/ttm_bo_api.h>
33+
#include <drm/ttm/ttm_bo_driver.h>
34+
#include <drm/ttm/ttm_placement.h>
35+
#include <drm/ttm/ttm_module.h>
36+
#include <drm/ttm/ttm_page_alloc.h>
3737
#include <drm/drmP.h>
3838
#include <drm/amdgpu_drm.h>
3939
#include <linux/seq_file.h>

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
279279
if (!parent->entries) {
280280
unsigned num_entries = amdgpu_vm_num_entries(adev, level);
281281

282-
parent->entries = drm_calloc_large(num_entries,
283-
sizeof(struct amdgpu_vm_pt));
282+
parent->entries = kvmalloc_array(num_entries,
283+
sizeof(struct amdgpu_vm_pt),
284+
GFP_KERNEL | __GFP_ZERO);
284285
if (!parent->entries)
285286
return -ENOMEM;
286287
memset(parent->entries, 0 , sizeof(struct amdgpu_vm_pt));
@@ -2198,7 +2199,7 @@ static void amdgpu_vm_free_levels(struct amdgpu_vm_pt *level)
21982199
for (i = 0; i <= level->last_entry_used; i++)
21992200
amdgpu_vm_free_levels(&level->entries[i]);
22002201

2201-
drm_free_large(level->entries);
2202+
kvfree(level->entries);
22022203
}
22032204

22042205
/**

drivers/gpu/drm/amd/amdgpu/ci_dpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323

2424
#include <linux/firmware.h>
25-
#include "drmP.h"
25+
#include <drm/drmP.h>
2626
#include "amdgpu.h"
2727
#include "amdgpu_pm.h"
2828
#include "amdgpu_ucode.h"

drivers/gpu/drm/amd/amdgpu/ci_smc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
#include <linux/firmware.h>
26-
#include "drmP.h"
26+
#include <drm/drmP.h>
2727
#include "amdgpu.h"
2828
#include "cikd.h"
2929
#include "ppsmc.h"

drivers/gpu/drm/amd/amdgpu/cik.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <linux/firmware.h>
2525
#include <linux/slab.h>
2626
#include <linux/module.h>
27-
#include "drmP.h"
27+
#include <drm/drmP.h>
2828
#include "amdgpu.h"
2929
#include "amdgpu_atombios.h"
3030
#include "amdgpu_ih.h"

0 commit comments

Comments
 (0)