[Bug 81644] Random crashes on RadeonSI with Chromium.
https://bugs.freedesktop.org/show_bug.cgi?id=81644 --- Comment #11 from Aaron B --- (In reply to comment #1) > (In reply to comment #1) > > Everything is current git from Oibaf PPA using Mint 17 Cinnamon, although > > I'm > > about to move to Arch Linux so I don't know how long I'll be able to provide > > logs as > > Better attach them here ASAP then. :) Xorg.0.log, dmesg and glxinfo. > > > the problem doesn't exist in Arch's currents AFAIK. > > What version of Mesa does that use? I'm guessing as of this patch this can be closed? http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2062afb4f804afef61cbe62a30cac9a46e58e067 -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/efef9ea8/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #104 from Kai --- (In reply to comment #98) > After some playing around, I do see some (minor) visual issues. See > https://imgur.com/a/uswfc for some screenshots and descriptions. Ignore this, this was most likely a layer 8 problem. I just noticed, that the "Compositing type" for KDE's desktop effects has been XRender instead of "OpenGL 3.1" (not sure how that changed back; maybe I had to do it for fglrx and don't remember). Now that I've changed that, all title bars are rendered correctly. XRender never worked with GLAMOR since I've started using GLAMOR (IIRC it was something close to 0.3). -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/675d7f6a/attachment.html>
[PATCH 2/2] drm/radeon: add new info ioctl query for hawaii accel
Can't we just make the accel2 info return 2 instead of 1? and have userspace know the difference. be careful to make userspace work so we can return 3 in future. Dave.
[PATCH v2 21/25] amdkfd: Implement the create/destroy/update queue IOCTLs
On 21/07/14 02:09, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:28PM +0300, Oded Gabbay wrote: >> From: Ben Goz >> >> Signed-off-by: Ben Goz >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/kfd_chardev.c | 133 >> +++- >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h| 8 ++ >> 2 files changed, 138 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_chardev.c >> b/drivers/gpu/drm/radeon/amdkfd/kfd_chardev.c >> index d6580a6..a74693a 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_chardev.c >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_chardev.c >> @@ -119,17 +119,144 @@ static int kfd_open(struct inode *inode, struct file >> *filep) >> >> static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process >> *p, void __user *arg) >> { >> -return -ENODEV; >> +struct kfd_ioctl_create_queue_args args; >> +struct kfd_dev *dev; >> +int err = 0; >> +unsigned int queue_id; >> +struct kfd_process_device *pdd; >> +struct queue_properties q_properties; >> + >> +memset(&q_properties, 0, sizeof(struct queue_properties)); >> + >> +if (copy_from_user(&args, arg, sizeof(args))) >> +return -EFAULT; >> + >> +if (!access_ok(VERIFY_WRITE, args.read_pointer_address, >> sizeof(qptr_t))) { >> +pr_err("kfd: can't access read pointer"); >> +return -EFAULT; >> +} >> + >> +if (!access_ok(VERIFY_WRITE, args.write_pointer_address, >> sizeof(qptr_t))) { >> +pr_err("kfd: can't access write pointer"); >> +return -EFAULT; >> +} >> + >> +q_properties.is_interop = false; >> +q_properties.queue_percent = args.queue_percentage; >> +q_properties.priority = args.queue_priority; >> +q_properties.queue_address = args.ring_base_address; >> +q_properties.queue_size = args.ring_size; >> +q_properties.read_ptr = (qptr_t *) args.read_pointer_address; >> +q_properties.write_ptr = (qptr_t *) args.write_pointer_address; >> + > > So there is still no sanity check on any of the argument especialy the > queue_size. > I might have missed it, if so i think it really should be here inside the > ioctl > function as is simpler to find. > Fixed in v3. >> + >> +pr_debug("%s Arguments: Queue Percentage (%d, %d)\n" >> +"Queue Priority (%d, %d)\n" >> +"Queue Address (0x%llX, 0x%llX)\n" >> +"Queue Size (0x%llX, %u)\n" >> +"Queue r/w Pointers (0x%llX, 0x%llX)\n", >> +__func__, >> +q_properties.queue_percent, args.queue_percentage, >> +q_properties.priority, args.queue_priority, >> +q_properties.queue_address, args.ring_base_address, >> +q_properties.queue_size, args.ring_size, >> +(uint64_t) q_properties.read_ptr, >> +(uint64_t) q_properties.write_ptr); > > One pr_debug call perline. > Fixed in v3. >> + >> +dev = kfd_device_by_id(args.gpu_id); >> +if (dev == NULL) >> +return -EINVAL; >> + >> +mutex_lock(&p->mutex); >> + >> +pdd = kfd_bind_process_to_device(dev, p); >> +if (IS_ERR(pdd) < 0) { >> +err = PTR_ERR(pdd); >> +goto err_bind_process; >> +} >> + >> +pr_debug("kfd: creating queue for PASID %d on GPU 0x%x\n", >> +p->pasid, >> +dev->id); >> + >> +err = pqm_create_queue(&p->pqm, dev, filep, &q_properties, 0, >> KFD_QUEUE_TYPE_COMPUTE, &queue_id); >> +if (err != 0) >> +goto err_create_queue; >> + >> +args.queue_id = queue_id; >> +args.doorbell_address = (uint64_t)q_properties.doorbell_ptr; >> + >> +if (copy_to_user(arg, &args, sizeof(args))) { >> +err = -EFAULT; >> +goto err_copy_args_out; >> +} >> + >> +mutex_unlock(&p->mutex); >> + >> +pr_debug("kfd: queue id %d was created successfully.\n" >> + " ring buffer address == 0x%016llX\n" >> + " read ptr address== 0x%016llX\n" >> + " write ptr address == 0x%016llX\n" >> + " doorbell address== 0x%016llX\n", >> +args.queue_id, >> +args.ring_base_address, >> +args.read_pointer_address, >> +args.write_pointer_address, >> +args.doorbell_address); >> + > > Ditto Fixed in v3. > >> +return 0; >> + >> +err_copy_args_out: >> +pqm_destroy_queue(&p->pqm, queue_id); >> +err_create_queue: >> +err_bind_process: >> +mutex_unlock(&p->mutex); >> +return err; >> } >> >> static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process >> *p, void __user *arg) >> { >> -return -ENODEV; >> +int retval; >> +struct kfd_ioctl_destroy_queue_args args; >> + >> +if (copy_from_user(&args, arg, sizeo
[PATCH v2 16/25] amdkfd: Add module parameter of scheduling policy
On 21/07/14 05:45, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:23PM +0300, Oded Gabbay wrote: >> From: Ben Goz >> >> This patch adds a new parameter to the amdkfd driver. This parameter enables >> the user to select the scheduling policy of the CP. The choices are: >> >> * CP Scheduling with support for over-subscription >> * CP Scheduling without support for over-subscription >> * Without CP Scheduling > > Is this property per process ? No, this is the general scheduling mode for all of amdkfd. The runlist that we feed to the GPU contains queues from all HSA processes. Furthermore, the number of hardware queues is a total number of the GPU. Therefore, there is no option to operate in different modes (and I see no point in that). Also, I see I forgot to write in the commit msg that the third option (without CP Scheduling) is only for debug purposes and bringup of new H/W. As such, it is _not_ guaranteed to work at all times on all H/W versions. Added this is v3. > And again 80 chars line please. Fixed in v3. Oded > >> >> Signed-off-by: Ben Goz >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/kfd_module.c | 4 >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 9 + >> 2 files changed, 13 insertions(+) >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c >> b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c >> index dc08f51..fe5e39d 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c >> @@ -46,6 +46,10 @@ static const struct kgd2kfd_calls kgd2kfd = { >> .resume = kgd2kfd_resume, >> }; >> >> +int sched_policy = KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION; >> +module_param(sched_policy, int, S_IRUSR | S_IWUSR); >> +MODULE_PARM_DESC(sched_policy, "Kernel cmdline parameter define the kfd >> scheduling policy"); >> + >> bool kgd2kfd_init(unsigned interface_version, >>const struct kfd2kgd_calls *f2g, >>const struct kgd2kfd_calls **g2f) >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> index 25f23c5..8be07a1 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> @@ -64,6 +64,15 @@ >> /* Macro for allocating structures */ >> #define kfd_alloc_struct(ptr_to_struct)((typeof(ptr_to_struct)) >> kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL)) >> >> +/* Kernel module parameter to specify the scheduling policy */ >> +extern int sched_policy; >> + >> +enum kfd_sched_policy { >> +KFD_SCHED_POLICY_HWS = 0, >> +KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION, >> +KFD_SCHED_POLICY_NO_HWS >> +}; >> + >> /* >>* Large enough to hold the maximum usable pasid + 1. >>* It must also be able to store the number of doorbells >> -- >> 1.9.1 >> >> ___ >> dri-devel mailing list >> dri-devel at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66963] Rv6xx dpm problems
https://bugs.freedesktop.org/show_bug.cgi?id=66963 --- Comment #235 from Harald Judt --- With the latest kernel 3.15.6 my RV635 boots fine and no longer hangs. The only problems that are still present are when resuming from hibernation. Even there things are much better now, because most times there is actually something to read on the screen instead of blankness. It got nothing to do with the hibernation process itself, because I can resume from the same image after a few tries. I'll see if I can get more info by using an initrd. Also, I will test whether this occurs with suspend/resume too or only with hibernate/resume. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/0709c94a/attachment.html>
[PATCH v2 15/25] amdkfd: Add kernel queue module
On 21/07/14 05:42, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:22PM +0300, Oded Gabbay wrote: >> From: Ben Goz >> >> The kernel queue module enables the amdkfd to establish kernel queues, not >> exposed to user space. >> >> The kernel queues are used for HIQ (HSA Interface Queue) and DIQ (Debug >> Interface Queue) operations >> >> Signed-off-by: Ben Goz >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/Makefile | 3 +- >> .../drm/radeon/amdkfd/kfd_device_queue_manager.h | 101 +++ >> drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c | 305 + >> drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h | 66 ++ >> drivers/gpu/drm/radeon/amdkfd/kfd_pm4_headers.h| 682 >> + >> drivers/gpu/drm/radeon/amdkfd/kfd_pm4_opcodes.h| 107 >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 32 + >> 7 files changed, 1295 insertions(+), 1 deletion(-) >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_device_queue_manager.h >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_pm4_headers.h >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_pm4_opcodes.h >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >> b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >> new file mode 100644 >> index 000..b212524 >> --- /dev/null >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >> + >> +static int sync_with_hw(struct kernel_queue *kq, unsigned long timeout_ms) >> +{ >> +unsigned long org_timeout_ms; >> + >> +BUG_ON(!kq); >> + >> +org_timeout_ms = timeout_ms; >> +timeout_ms += jiffies * 1000 / HZ; >> +while (*kq->wptr_kernel != *kq->rptr_kernel) { > > I am not a fan of this kind of busy wait even with the cpu_relax below. Won't > there be some interrupt you can wait on (signaled through a wait queue > perhaps) ? > So there is an interrupt but we don't use it for two reasons: 1. According to our thunk spec (thunk is the userspace bits of amdkfd), all ioctls calls to amdkfd must be synchronous, meaning that when the ioctl returns to thunk, the operation has completed. The sync_with_hw function is called during the create/destroy/update queue ioctls and we must wait to its completion before returning from the ioctl. Therefore, there is no point in using interrupt here as we will also need to wait for the interrupt before returning. It is especially important in the destroy path, as the runtime library above the thunk release the memory of the queue once it returns from the thunk's destroy function. 2. Simpler code. The operations of adding/destroying queue require allocations and releases of various memory objects (runlists, indirect buffers). Adding an interrupt context in the middle of this would make the code a lot more complex than it should be, IMO. >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >> b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >> new file mode 100644 >> index 000..abfb9c8 >> --- /dev/null >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >> @@ -0,0 +1,66 @@ >> +/* >> + * Copyright 2014 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + * >> + */ >> + >> +#ifndef KFD_KERNEL_QUEUE_H_ >> +#define KFD_KERNEL_QUEUE_H_ >> + >> +#include >> +#include >> +#include "kfd_priv.h" >> + >> +struct kernel_queue { >> +/* interface */ >> +bool(*initialize)(struct kernel_queue *kq, struct kfd_dev *dev, >> +enum kfd_queue_type type, unsigned int queue_size); >> +void(*uninitialize)(struct kernel_queue *kq); >> +int (*acquire_packet_buffer)(struct kernel_queue *kq, >> +size_t p
[PATCH v2 13/25] amdkfd: Add queue module
On 21/07/14 02:06, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:20PM +0300, Oded Gabbay wrote: >> From: Ben Goz >> >> The queue module enables allocating and initializing queues uniformly. >> >> Signed-off-by: Ben Goz >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/Makefile| 2 +- >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 48 + >> drivers/gpu/drm/radeon/amdkfd/kfd_queue.c | 109 >> ++ >> 3 files changed, 158 insertions(+), 1 deletion(-) >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_queue.c >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/Makefile >> b/drivers/gpu/drm/radeon/amdkfd/Makefile >> index daf75a8..dbff147 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/Makefile >> +++ b/drivers/gpu/drm/radeon/amdkfd/Makefile >> @@ -6,6 +6,6 @@ ccflags-y := -Iinclude/drm >> >> amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \ >> kfd_pasid.o kfd_doorbell.o kfd_vidmem.o kfd_aperture.o \ >> -kfd_process.o >> +kfd_process.o kfd_queue.o >> >> obj-$(CONFIG_HSA_RADEON) += amdkfd.o >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> index 604c317..94ff1c3 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h >> @@ -65,6 +65,9 @@ typedef unsigned int pasid_t; >> /* Type that represents a HW doorbell slot. */ >> typedef u32 doorbell_t; >> >> +/* Type that represents queue pointer */ >> +typedef u32 qptr_t; >> + >> struct kfd_device_info { >> const struct kfd_scheduler_class *scheduler_class; >> unsigned int max_pasid_bits; >> @@ -125,12 +128,57 @@ void kfd_vidmem_unkmap(struct kfd_dev *kfd, >> kfd_mem_obj mem_obj); >> int kfd_vidmem_alloc_map(struct kfd_dev *kfd, kfd_mem_obj *mem_obj, void >> **ptr, >> uint64_t *vmid0_address, size_t size); >> void kfd_vidmem_free_unmap(struct kfd_dev *kfd, kfd_mem_obj mem_obj); >> + >> /* Character device interface */ >> int kfd_chardev_init(void); >> void kfd_chardev_exit(void); >> struct device *kfd_chardev(void); >> >> >> +enum kfd_queue_type { >> +KFD_QUEUE_TYPE_COMPUTE, >> +KFD_QUEUE_TYPE_SDMA, >> +KFD_QUEUE_TYPE_HIQ, >> +KFD_QUEUE_TYPE_DIQ >> +}; >> + >> +struct queue_properties { >> +enum kfd_queue_type type; >> +unsigned int queue_id; >> +uint64_t queue_address; >> +uint64_t queue_size; >> +uint32_t priority; >> +uint32_t queue_percent; >> +qptr_t *read_ptr; >> +qptr_t *write_ptr; >> +qptr_t *doorbell_ptr; >> +qptr_t doorbell_off; >> +bool is_interop; >> +bool is_active; >> +/* Not relevant for user mode queues in cp scheduling */ >> +unsigned int vmid; >> +}; >> + >> +struct queue { >> +struct list_head list; >> +void *mqd; >> +/* kfd_mem_obj contains the mqd */ >> +kfd_mem_obj mqd_mem_obj; >> +uint64_t gart_mqd_addr; /* needed for cp scheduling */ >> +struct queue_properties properties; >> + >> +/* >> + * Used by the queue device manager to track the hqd slot per queue >> + * when using no cp scheduling >> + */ >> +uint32_t mec; >> +uint32_t pipe; >> +uint32_t queue; >> + >> +struct kfd_process *process; >> +struct kfd_dev *device; >> +}; >> + >> /* Data that is per-process-per device. */ >> struct kfd_process_device { >> /* >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_queue.c >> b/drivers/gpu/drm/radeon/amdkfd/kfd_queue.c >> new file mode 100644 >> index 000..646b6d1 >> --- /dev/null >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_queue.c >> @@ -0,0 +1,109 @@ >> +/* >> + * Copyright 2014 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + * >> + */ >> + >> +#include >> +#inclu
[PATCH v2 12/25] amdkfd: Add binding/unbinding calls to amd_iommu driver
On 21/07/14 02:04, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:19PM +0300, Oded Gabbay wrote: >> This patch adds the functions to bind and unbind pasid from a device through >> the amd_iommu driver. >> >> The unbind function is called when the mm_struct of the process is released. >> >> The bind function is not called here because it is called only in the IOCTLs >> which are not yet implemented at this stage of the patchset. > > Commit message should follow the 80 char per line rules too IIRC > No other comment than apply the 80char for the patch too. Done in v3 for commit msg. For the patch, I tried to minimize the lines above 80 char as much as I could without harming readability of the code. Oded > >> >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/kfd_device.c | 80 >> - >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h| 1 + >> drivers/gpu/drm/radeon/amdkfd/kfd_process.c | 12 + >> 3 files changed, 92 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_device.c >> b/drivers/gpu/drm/radeon/amdkfd/kfd_device.c >> index f6a7cf7..7c4c836 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_device.c >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_device.c >> @@ -95,6 +95,59 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct >> pci_dev *pdev) >> return kfd; >> } >> >> +static bool device_iommu_pasid_init(struct kfd_dev *kfd) >> +{ >> +const u32 required_iommu_flags = AMD_IOMMU_DEVICE_FLAG_ATS_SUP | >> AMD_IOMMU_DEVICE_FLAG_PRI_SUP >> +| AMD_IOMMU_DEVICE_FLAG_PASID_SUP; >> + >> +struct amd_iommu_device_info iommu_info; >> +pasid_t pasid_limit; >> +int err; >> + >> +err = amd_iommu_device_info(kfd->pdev, &iommu_info); >> +if (err < 0) { >> +dev_err(kfd_device, "error getting iommu info. is the iommu >> enabled?\n"); >> +return false; >> +} >> + >> +if ((iommu_info.flags & required_iommu_flags) != required_iommu_flags) { >> +dev_err(kfd_device, "error required iommu flags ats(%i), >> pri(%i), pasid(%i)\n", >> + (iommu_info.flags & AMD_IOMMU_DEVICE_FLAG_ATS_SUP) != 0, >> + (iommu_info.flags & AMD_IOMMU_DEVICE_FLAG_PRI_SUP) != 0, >> + (iommu_info.flags & AMD_IOMMU_DEVICE_FLAG_PASID_SUP) != >> 0); >> +return false; >> +} >> + >> +pasid_limit = min_t(pasid_t, (pasid_t)1 << >> kfd->device_info->max_pasid_bits, iommu_info.max_pasids); >> +/* >> + * last pasid is used for kernel queues doorbells >> + * in the future the last pasid might be used for a kernel thread. >> + */ >> +pasid_limit = min_t(pasid_t, pasid_limit, kfd->doorbell_process_limit - >> 1); >> + >> +err = amd_iommu_init_device(kfd->pdev, pasid_limit); >> +if (err < 0) { >> +dev_err(kfd_device, "error initializing iommu device\n"); >> +return false; >> +} >> + >> +if (!kfd_set_pasid_limit(pasid_limit)) { >> +dev_err(kfd_device, "error setting pasid limit\n"); >> +amd_iommu_free_device(kfd->pdev); >> +return false; >> +} >> + >> +return true; >> +} >> + >> +static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid) >> +{ >> +struct kfd_dev *dev = kfd_device_by_pci_dev(pdev); >> + >> +if (dev) >> +kfd_unbind_process_from_device(dev, pasid); >> +} >> + >> bool kgd2kfd_device_init(struct kfd_dev *kfd, >> const struct kgd2kfd_shared_resources *gpu_resources) >> { >> @@ -102,8 +155,15 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, >> >> kfd_doorbell_init(kfd); >> >> -if (kfd_topology_add_device(kfd) != 0) >> +if (!device_iommu_pasid_init(kfd)) >> +return false; >> + >> +if (kfd_topology_add_device(kfd) != 0) { >> +amd_iommu_free_device(kfd->pdev); >> return false; >> +} >> + >> +amd_iommu_set_invalidate_ctx_cb(kfd->pdev, >> iommu_pasid_shutdown_callback); >> >> kfd->init_complete = true; >> dev_info(kfd_device, "added device (%x:%x)\n", kfd->pdev->vendor, >> @@ -118,18 +178,36 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd) >> >> BUG_ON(err != 0); >> >> +if (kfd->init_complete) >> +amd_iommu_free_device(kfd->pdev); >> + >> kfree(kfd); >> } >> >> void kgd2kfd_suspend(struct kfd_dev *kfd) >> { >> BUG_ON(kfd == NULL); >> + >> +if (kfd->init_complete) >> +amd_iommu_free_device(kfd->pdev); >> } >> >> int kgd2kfd_resume(struct kfd_dev *kfd) >> { >> +pasid_t pasid_limit; >> +int err; >> + >> BUG_ON(kfd == NULL); >> >> +pasid_limit = kfd_get_pasid_limit(); >> + >> +if (kfd->init_complete) { >> +err = amd_iommu_init_device(kfd->pdev, pasid_limit); >> +if (err < 0) >> +return -ENXIO; >> +amd_iommu_
[PATCH v2 10/25] amdkfd: Add topology module to amdkfd
On 21/07/14 01:37, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:17PM +0300, Oded Gabbay wrote: >> From: Evgeny Pinchuk >> >> This patch adds the topology module to the driver. The topology is exposed to >> userspace through the sysfs. >> >> The calls to add and remove a device to/from topology are done by the radeon >> driver. > > So overall we already said that we do not want to see the cpu architecture > re-expose by hsa in its own format. This pacth is NACK. Only expose additional > non existent information and also follow the number one rules of sysfs which > is one value -> one file. > > I understand the temptation to rexpose the cpu topology in your own way to > make life simpler but there is already api for this so please use what exist > today and if there is short coming than i am sure they can be fixed. > > See : > > /sys/devices/system/cpu/cpu* > Agreed and we will change the code. Hopefully it will be in v3, although we may release v3 early this week and release v4 with this change next week. Oded >> >> Signed-off-by: Evgeny Pinchuk >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/Makefile |2 +- >> drivers/gpu/drm/radeon/amdkfd/kfd_crat.h | 294 +++ >> drivers/gpu/drm/radeon/amdkfd/kfd_device.c |7 + >> drivers/gpu/drm/radeon/amdkfd/kfd_module.c |7 + >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 17 + >> drivers/gpu/drm/radeon/amdkfd/kfd_topology.c | 1207 >> ++ >> drivers/gpu/drm/radeon/amdkfd/kfd_topology.h | 168 >> 7 files changed, 1701 insertions(+), 1 deletion(-) >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_topology.c >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_topology.h >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/Makefile >> b/drivers/gpu/drm/radeon/amdkfd/Makefile >> index 9564e75..08ecfcd 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/Makefile >> +++ b/drivers/gpu/drm/radeon/amdkfd/Makefile >> @@ -4,6 +4,6 @@ >> >> ccflags-y := -Iinclude/drm >> >> -amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o >> +amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o >> >> obj-$(CONFIG_HSA_RADEON) += amdkfd.o >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> b/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> new file mode 100644 >> index 000..a374fa3 >> --- /dev/null >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> @@ -0,0 +1,294 @@ >> +/* >> + * Copyright 2014 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + */ >> + >> +#ifndef KFD_CRAT_H_INCLUDED >> +#define KFD_CRAT_H_INCLUDED >> + >> +#include >> + >> +#pragma pack(1) > > No pragma > >> + >> +/* >> + * 4CC signature values for the CRAT and CDIT ACPI tables >> + */ >> + >> +#define CRAT_SIGNATURE "CRAT" >> +#define CDIT_SIGNATURE "CDIT" >> + >> +/* >> + * Component Resource Association Table (CRAT) >> + */ >> + >> +#define CRAT_OEMID_LENGTH 6 >> +#define CRAT_OEMTABLEID_LENGTH 8 >> +#define CRAT_RESERVED_LENGTH6 >> + >> +#define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1) >> + >> +struct crat_header { >> +uint32_tsignature; >> +uint32_tlength; >> +uint8_t revision; >> +uint8_t checksum; >> +uint8_t oem_id[CRAT_OEMID_LENGTH]; >> +uint8_t oem_table_id[CRAT_OEMTABLEID_LENGTH]; >> +uint32_toem_revision; >> +uint32_tcreator_id; >> +uint32_tcreator_revision; >> +uint32_ttotal_entries; >> +uint16_tnum_domains; >> +uint8_t reserved[CRAT_RESERVED_LENGTH]; >> +}; >> + >> +/* >> + * The header structure is immediately followed by total_entries of the >> + * data definitions >> + */ >> + >>
[PATCH v2 10/25] amdkfd: Add topology module to amdkfd
On 21/07/14 01:37, Jerome Glisse wrote: > On Thu, Jul 17, 2014 at 04:29:17PM +0300, Oded Gabbay wrote: >> From: Evgeny Pinchuk >> >> This patch adds the topology module to the driver. The topology is exposed to >> userspace through the sysfs. >> >> The calls to add and remove a device to/from topology are done by the radeon >> driver. > > So overall we already said that we do not want to see the cpu architecture > re-expose by hsa in its own format. This pacth is NACK. Only expose additional > non existent information and also follow the number one rules of sysfs which > is one value -> one file. > > I understand the temptation to rexpose the cpu topology in your own way to > make life simpler but there is already api for this so please use what exist > today and if there is short coming than i am sure they can be fixed. > > See : > > /sys/devices/system/cpu/cpu* > >> >> Signed-off-by: Evgeny Pinchuk >> Signed-off-by: Oded Gabbay >> --- >> drivers/gpu/drm/radeon/amdkfd/Makefile |2 +- >> drivers/gpu/drm/radeon/amdkfd/kfd_crat.h | 294 +++ >> drivers/gpu/drm/radeon/amdkfd/kfd_device.c |7 + >> drivers/gpu/drm/radeon/amdkfd/kfd_module.c |7 + >> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 17 + >> drivers/gpu/drm/radeon/amdkfd/kfd_topology.c | 1207 >> ++ >> drivers/gpu/drm/radeon/amdkfd/kfd_topology.h | 168 >> 7 files changed, 1701 insertions(+), 1 deletion(-) >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_topology.c >> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_topology.h >> >> diff --git a/drivers/gpu/drm/radeon/amdkfd/Makefile >> b/drivers/gpu/drm/radeon/amdkfd/Makefile >> index 9564e75..08ecfcd 100644 >> --- a/drivers/gpu/drm/radeon/amdkfd/Makefile >> +++ b/drivers/gpu/drm/radeon/amdkfd/Makefile >> @@ -4,6 +4,6 @@ >> >> ccflags-y := -Iinclude/drm >> >> -amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o >> +amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o >> >> obj-$(CONFIG_HSA_RADEON) += amdkfd.o >> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> b/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> new file mode 100644 >> index 000..a374fa3 >> --- /dev/null >> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_crat.h >> @@ -0,0 +1,294 @@ >> +/* >> + * Copyright 2014 Advanced Micro Devices, Inc. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included >> in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR >> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR >> + * OTHER DEALINGS IN THE SOFTWARE. >> + */ >> + >> +#ifndef KFD_CRAT_H_INCLUDED >> +#define KFD_CRAT_H_INCLUDED >> + >> +#include >> + >> +#pragma pack(1) > > No pragma > Why no pragma ? The structures here describe H/W tables in the BIOS so we must pragma pack(1) them. See for example the following line in file atombios.h in radeon: #pragma pack(1) /* BIOS data must use byte aligment */ Oded >> + >> +/* >> + * 4CC signature values for the CRAT and CDIT ACPI tables >> + */ >> + >> +#define CRAT_SIGNATURE "CRAT" >> +#define CDIT_SIGNATURE "CDIT" >> + >> +/* >> + * Component Resource Association Table (CRAT) >> + */ >> + >> +#define CRAT_OEMID_LENGTH 6 >> +#define CRAT_OEMTABLEID_LENGTH 8 >> +#define CRAT_RESERVED_LENGTH6 >> + >> +#define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1) >> + >> +struct crat_header { >> +uint32_tsignature; >> +uint32_tlength; >> +uint8_t revision; >> +uint8_t checksum; >> +uint8_t oem_id[CRAT_OEMID_LENGTH]; >> +uint8_t oem_table_id[CRAT_OEMTABLEID_LENGTH]; >> +uint32_toem_revision; >> +uint32_tcreator_id; >> +uint32_tcreator_revision; >> +uint32_ttotal_entries; >> +uint16_tnum_domains; >> +uint8_t reserved[CRAT_RESERVED_LENGTH]; >> +}; >> + >> +/* >> + * The header structure is immed
[Bug 80584] XCOM: Eenemy Unknown incorrect hair rendering
https://bugs.freedesktop.org/show_bug.cgi?id=80584 --- Comment #4 from Kai --- Created attachment 103534 --> https://bugs.freedesktop.org/attachment.cgi?id=103534&action=edit Another variant of incorrectly rendered hair I'm seeing the same with radeonsi on a Hawaii. As you can see from the attached image, it looks a bit different from what the initial reporter saw. The stack I'm using is: GPU: Hawaii PRO [Radeon R9 290] (ChipID = 0x67b1) Linux: Git:~agdf5/linux:drm-next-3.17-wip (calls itself 3.16-rc4?) libdrm: Git:master/libdrm-2.4.55 + patch from http://lists.freedesktop.org/archives/dri-devel/2014-July/064743.html LLVM: 3.5 RC1 libclc: Git:master/0ec7437d9c Mesa: Git:master/74e100affc + some patches from Marek to fix Hawaii ("radeonsi: fix CMASK and HTILE calculations for Hawaii"; "gallium/util: add a helper for calculating primitive count from vertex count"; "radeonsi: fix a hang with instancing on Hawaii"; "radeonsi: fix a hang with streamout on Hawaii"; "winsys/radeon: fix vram_size overflow with Hawaii"; "radeonsi: fix occlusion queries on Hawaii"; "r600g, radeonsi: switch all occurences of array_size to util_max_layer") and can be found on mesa-dev. DDX: 1:7.4.0-2 + Patch from http://people.freedesktop.org/~agd5f/0001-radeon-enable-hawaii-accel-conditionally.patch X: 2:1.16.0-1 (1.16.0) -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/85ccd518/attachment.html>
[Bug 80584] XCOM: Eenemy Unknown incorrect hair rendering
https://bugs.freedesktop.org/show_bug.cgi?id=80584 Kai changed: What|Removed |Added Attachment #103534|text/plain |image/png mime type|| -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/67b58dfd/attachment.html>
[Bug 66963] Rv6xx dpm problems
https://bugs.freedesktop.org/show_bug.cgi?id=66963 --- Comment #236 from Harald Judt --- Ok, unfortunately I only thought I was lucky. My X server froze again, but the machine remained accessible via ssh, so here is the last part of the dmesg: radeon :01:00.0: ring 0 stalled for more than 10017msec radeon :01:00.0: GPU lockup (waiting for 0x000c72a7 last fence id 0x000c7299 on ring 0) radeon :01:00.0: Saved 3289 dwords of commands on ring 0. radeon :01:00.0: GPU softreset: 0x0008 radeon :01:00.0: R_008010_GRBM_STATUS = 0xA0003030 radeon :01:00.0: R_008014_GRBM_STATUS2 = 0x0003 radeon :01:00.0: R_000E50_SRBM_STATUS = 0x20C0 radeon :01:00.0: R_008674_CP_STALLED_STAT1 = 0x radeon :01:00.0: R_008678_CP_STALLED_STAT2 = 0x radeon :01:00.0: R_00867C_CP_BUSY_STAT = 0x0002 radeon :01:00.0: R_008680_CP_STAT = 0x8645 radeon :01:00.0: R_00D034_DMA_STATUS_REG = 0x44C83D57 radeon :01:00.0: R_008020_GRBM_SOFT_RESET=0x4001 radeon :01:00.0: SRBM_SOFT_RESET=0x0100 radeon :01:00.0: R_008010_GRBM_STATUS = 0xA0003030 radeon :01:00.0: R_008014_GRBM_STATUS2 = 0x0003 radeon :01:00.0: R_000E50_SRBM_STATUS = 0x200080C0 radeon :01:00.0: R_008674_CP_STALLED_STAT1 = 0x radeon :01:00.0: R_008678_CP_STALLED_STAT2 = 0x radeon :01:00.0: R_00867C_CP_BUSY_STAT = 0x radeon :01:00.0: R_008680_CP_STAT = 0x8010 radeon :01:00.0: R_00D034_DMA_STATUS_REG = 0x44C83D57 radeon :01:00.0: GPU reset succeeded, trying to resume [drm] PCIE gen 2 link speeds already enabled [drm] PCIE GART of 512M enabled (table at 0x0004). radeon :01:00.0: WB enabled radeon :01:00.0: fence driver on ring 0 use gpu addr 0x2c00 and cpu addr 0x88007fd6ec00 [drm] ring test on 0 succeeded in 1 usecs radeon :01:00.0: ring 0 stalled for more than 1msec radeon :01:00.0: GPU lockup (waiting for 0x000c7301 last fence id 0x000c729a on ring 0) [drm:r600_ib_test] *ERROR* radeon: fence wait failed (-35). [drm:radeon_ib_ring_tests] *ERROR* radeon: failed testing IB on GFX ring (-35). radeon :01:00.0: ib ring test failed (-35). radeon :01:00.0: GPU softreset: 0x0019 radeon :01:00.0: R_008010_GRBM_STATUS = 0xA20034E0 radeon :01:00.0: R_008014_GRBM_STATUS2 = 0x0003 radeon :01:00.0: R_000E50_SRBM_STATUS = 0x20C0 radeon :01:00.0: R_008674_CP_STALLED_STAT1 = 0x0100 radeon :01:00.0: R_008678_CP_STALLED_STAT2 = 0x1002 radeon :01:00.0: R_00867C_CP_BUSY_STAT = 0x00028486 radeon :01:00.0: R_008680_CP_STAT = 0x80838645 radeon :01:00.0: R_00D034_DMA_STATUS_REG = 0x44C83D57 radeon :01:00.0: R_008020_GRBM_SOFT_RESET=0x7FEF radeon :01:00.0: SRBM_SOFT_RESET=0x0100 radeon :01:00.0: R_008010_GRBM_STATUS = 0xA0003030 radeon :01:00.0: R_008014_GRBM_STATUS2 = 0x0003 radeon :01:00.0: R_000E50_SRBM_STATUS = 0x200080C0 radeon :01:00.0: R_008674_CP_STALLED_STAT1 = 0x radeon :01:00.0: R_008678_CP_STALLED_STAT2 = 0x radeon :01:00.0: R_00867C_CP_BUSY_STAT = 0x radeon :01:00.0: R_008680_CP_STAT = 0x8010 radeon :01:00.0: R_00D034_DMA_STATUS_REG = 0x44C83D57 radeon :01:00.0: GPU reset succeeded, trying to resume [drm] PCIE gen 2 link speeds already enabled [drm] PCIE GART of 512M enabled (table at 0x0004). radeon :01:00.0: WB enabled radeon :01:00.0: fence driver on ring 0 use gpu addr 0x2c00 and cpu addr 0x88007fd6ec00 [drm] ring test on 0 succeeded in 1 usecs [drm] ib test on ring 0 succeeded in 0 usecs [drm:radeon_pm_resume_dpm] *ERROR* radeon: dpm resume failed switching from power state: ui class: none internal class: boot caps: video uvdvclk: 0 dclk: 0 power level 0sclk: 72500 mclk: 4 vddc: 1250 power level 1sclk: 72500 mclk: 4 vddc: 1250 power level 2sclk: 72500 mclk: 4 vddc: 1250 status: c b switching to power state: ui class: performance internal class: none caps: single_disp video uvdvclk: 0 dclk: 0 power level 0sclk: 11000 mclk: 25200 vddc: 900 power level 1sclk: 3 mclk: 35000 vddc: 1000 power level 2sclk: 72500 mclk: 4 vddc: 1250 status: r -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/e8ddae8c/attachment.html>
[PATCH v2 15/25] amdkfd: Add kernel queue module
Am 27.07.2014 um 13:05 schrieb Oded Gabbay: > On 21/07/14 05:42, Jerome Glisse wrote: >> On Thu, Jul 17, 2014 at 04:29:22PM +0300, Oded Gabbay wrote: >>> From: Ben Goz >>> >>> The kernel queue module enables the amdkfd to establish kernel >>> queues, not exposed to user space. >>> >>> The kernel queues are used for HIQ (HSA Interface Queue) and DIQ >>> (Debug Interface Queue) operations >>> >>> Signed-off-by: Ben Goz >>> Signed-off-by: Oded Gabbay >>> --- >>> drivers/gpu/drm/radeon/amdkfd/Makefile | 3 +- >>> .../drm/radeon/amdkfd/kfd_device_queue_manager.h | 101 +++ >>> drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c | 305 + >>> drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h | 66 ++ >>> drivers/gpu/drm/radeon/amdkfd/kfd_pm4_headers.h| 682 >>> + >>> drivers/gpu/drm/radeon/amdkfd/kfd_pm4_opcodes.h| 107 >>> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 32 + >>> 7 files changed, 1295 insertions(+), 1 deletion(-) >>> create mode 100644 >>> drivers/gpu/drm/radeon/amdkfd/kfd_device_queue_manager.h >>> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >>> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >>> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_pm4_headers.h >>> create mode 100644 drivers/gpu/drm/radeon/amdkfd/kfd_pm4_opcodes.h >>> >>> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >>> b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >>> new file mode 100644 >>> index 000..b212524 >>> --- /dev/null >>> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.c >>> + >>> +static int sync_with_hw(struct kernel_queue *kq, unsigned long >>> timeout_ms) >>> +{ >>> +unsigned long org_timeout_ms; >>> + >>> +BUG_ON(!kq); >>> + >>> +org_timeout_ms = timeout_ms; >>> +timeout_ms += jiffies * 1000 / HZ; >>> +while (*kq->wptr_kernel != *kq->rptr_kernel) { >> >> I am not a fan of this kind of busy wait even with the cpu_relax >> below. Won't >> there be some interrupt you can wait on (signaled through a wait >> queue perhaps) ? >> > So there is an interrupt but we don't use it for two reasons: > 1. According to our thunk spec (thunk is the userspace bits of > amdkfd), all ioctls calls to amdkfd must be synchronous, meaning that > when the ioctl returns to thunk, the operation has completed. The > sync_with_hw function is called during the create/destroy/update queue > ioctls and we must wait to its completion before returning from the > ioctl. Therefore, there is no point in using interrupt here as we will > also need to wait for the interrupt before returning. It is especially > important in the destroy path, as the runtime library above the thunk > release the memory of the queue once it returns from the thunk's > destroy function. > > 2. Simpler code. The operations of adding/destroying queue require > allocations and releases of various memory objects (runlists, indirect > buffers). Adding an interrupt context in the middle of this would make > the code a lot more complex than it should be, IMO. How about using a wait_queue? That would allow the IOCTL to be synchronous, is rather simple to implement and still don't busy wait for any hardware state to be reached. Regards, Christian. > >>> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >>> b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >>> new file mode 100644 >>> index 000..abfb9c8 >>> --- /dev/null >>> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_kernel_queue.h >>> @@ -0,0 +1,66 @@ >>> +/* >>> + * Copyright 2014 Advanced Micro Devices, Inc. >>> + * >>> + * Permission is hereby granted, free of charge, to any person >>> obtaining a >>> + * copy of this software and associated documentation files (the >>> "Software"), >>> + * to deal in the Software without restriction, including without >>> limitation >>> + * the rights to use, copy, modify, merge, publish, distribute, >>> sublicense, >>> + * and/or sell copies of the Software, and to permit persons to >>> whom the >>> + * Software is furnished to do so, subject to the following >>> conditions: >>> + * >>> + * The above copyright notice and this permission notice shall be >>> included in >>> + * all copies or substantial portions of the Software. >>> + * >>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >>> EXPRESS OR >>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >>> MERCHANTABILITY, >>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO >>> EVENT SHALL >>> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, >>> DAMAGES OR >>> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR >>> OTHERWISE, >>> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE >>> USE OR >>> + * OTHER DEALINGS IN THE SOFTWARE. >>> + * >>> + */ >>> + >>> +#ifndef KFD_KERNEL_QUEUE_H_ >>> +#define KFD_KERNEL_QUEUE_H_ >>>
Re: [Radeon RV280] radeon_cs_gem.c:181: cs_gem_write_reloc: Assertion »boi->space_accounted« failed, core dumped
I think the problem is the driver hasn't called radeon_cs_space_add_persistent_bo. Marek On Fri, Jul 25, 2014 at 6:32 PM, Jochen Rollwagen wrote: > I've recently ported the peopsxgl OpenGL-GPU-Plugin for the pcsx > Playstation1 Emulator to the Powerpc-architecture. When running certain > games (for instance "Vagrant Stories") during longer cut-scenes i get a > reproducible crash of the radeon drm driver (i.e. it always crashes at > certain points in the scene) with the following message (in german): > > pcsx: radeon_cs_gem.c:181: cs_gem_write_reloc: Zusicherung > ?boi->space_accounted? nicht erf?llt. > Abgebrochen (Speicherabzug geschrieben) > > This happens with all the latest 3.10, 3.12 and 3.14 kernels. > > Other than that i'm running the latest xorg-ati driver, libdrm and mesa from > git on a Mac Mini G4 (PowerPC). > > OpenGL vendor string: Mesa Project > OpenGL renderer string: Mesa DRI R200 (RV280 5962) TCL DRI2 > OpenGL version string: 1.3 Mesa 10.1.6 (git-42f86ef) > > I guess the issue is memory/vm/swap-related since the machine only has 1 gb > RAM. The GPU has 64 MB VRAM. > > Any ideas what i could do to avoid these crashes ? > > > > > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #105 from Luzipher --- (In reply to comment #103) > Not working for me. I've updated the firmware files and using agd5f's > drm-next-3.17-wip branch. I can't switch to other vt's, it gets stuck with > the boot messages on vt1. Haven't tried starting X yet. Your dmesg shows that you have a ASIC_ProfilingInfo v3.1 table on your board. You might want to try a patch from bug #73420: attachement #93015. The issue itself is tracked in bug #74250. Other than that I can report Civ5, Half Life 2 and even Metro Last Light working on Hawaii now (native via Steam) :-) Kai: did changing "Composition type" also fix the corrupted glyphs or just the title bars ? I've seen exactly one corrupted glyph in firefox so far (several hours of use) on cinnamon (but I'm not sure what cinnamon uses as I couldn't find any settings related to opengl). -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/334ca839/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #106 from Kai --- (In reply to comment #105) > Other than that I can report Civ5, Half Life 2 and even Metro Last Light > working on Hawaii now (native via Steam) :-) I can confirm Portal 2 (Source), Jagged Alliance: Flashback (Unity) and XCOM: Enemy Unknown (Unreal Engine 3) as working, though the performance in XCOM is abysmal (9 FPS) and after a while you get GPU stalls (system recovered after a short block and I could continue, but it's of course not much fun). The other games have room to improve as well. But that was to be expected at this point. Still, having more performance with the free driver would be really nice. ;-) Playing streams (live and recorded broadcasts) from Twitch with this setup is, however, neigh impossible. With the open driver and GLAMOR acceleration, X uses 80 % CPU time on one core and the video becomes a dia show. The Flash plugin is at 40 % CPU time (different core), but that's roughly the same as with fglrx. (For reference: my CPU is an Intel Core i7-3770K.) > Kai: did changing "Composition type" also fix the corrupted glyphs or just > the title bars ? I've seen exactly one corrupted glyph in firefox so far > (several hours of use) on cinnamon (but I'm not sure what cinnamon uses as I > couldn't find any settings related to opengl). Can't say for sure. With XRender I saw a corrupted glyph almost immediately on the first page I visited. Since switching to OpenGL as "compositing type" in KDE's settings, I haven't seen a corrupt glyph. But it could also be coincidence. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/68c43566/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #107 from Marek Ol??k --- Yeah, it looks like Hawaii is underclocked or something. It's a lot slower than my Bonaire. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/2f7d9e39/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #108 from Kai --- Btw, watching a video on Twitch spams my Xorg.0.log with *tons* of: > [ 21013.158] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2822274 < target_msc 2822275 > [ 21075.557] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2826015 < target_msc 2826016 > [ 21139.338] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2829840 < target_msc 2829841 > [ 21161.360] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2831160 < target_msc 2831161 > [ 21163.677] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2831298 < target_msc 2831299 > [ 21163.811] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2831306 < target_msc 2831307 > [ 21178.130] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2832164 < target_msc 2832165 > [ 21209.838] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2834066 < target_msc 2834067 > [ 21267.601] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2837529 < target_msc 2837530 > [ 21273.836] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2837902 < target_msc 2837903 > [ 21483.986] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2850507 < target_msc 2850508 > [ 21516.393] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2852450 < target_msc 2852451 > [ 21668.162] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2861549 < target_msc 2861550 > [ 21699.370] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2863419 < target_msc 2863420 > [ 21699.837] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2863446 < target_msc 2863447 > [ 21731.427] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2865340 < target_msc 2865341 > [ 21899.500] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2875419 < target_msc 2875420 > [ 21906.569] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2875843 < target_msc 2875844 > [ 21906.835] (WW) RADEON(0): radeon_dri2_flip_event_handler: Pageflip > completion event has impossible msc 2875859 < target_msc 2875860 AFAICT this happens only in fullscreen mode. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/4aaa1a83/attachment.html>
[PATCH] drm: refcnt drm_display_mode
On Sat, Jul 26, 2014 at 12:51 AM, Rob Clark wrote: > We're going to need this for atomic. > > Signed-off-by: Rob Clark I disagree. Iiui correctly Rob's concern is that the additional stuff to keep track of mode lists (list_head and the idr stuff) could confuse driver writers into doing stupid stuff when they embed drm_display_mode into some other stuff. Imo the right fix would be to just remove them (but that's fairly invasive to the mode list code). Now wrt atomic we only need refcounting because currently drm_atomic_state is refcounted. And we don't need that afaics (and I'm working on the draft code to show how). So without a clear need for refcounting I really prefer we don't add this complexity - doing refcounting for fbs wasn't fun at all ;-) -Daniel > --- > drivers/gpu/drm/drm_crtc.c| 4 +-- > drivers/gpu/drm/drm_crtc_helper.c | 2 +- > drivers/gpu/drm/drm_edid.c| 6 ++-- > drivers/gpu/drm/drm_fb_helper.c | 6 ++-- > drivers/gpu/drm/drm_modes.c | 41 > --- > drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- > drivers/gpu/drm/gma500/psb_intel_sdvo.c | 3 +- > drivers/gpu/drm/i915/intel_panel.c| 8 ++ > drivers/gpu/drm/i915/intel_sdvo.c | 3 +- > drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- > drivers/gpu/drm/omapdrm/omap_connector.c | 2 +- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +-- > include/drm/drm_modes.h | 5 +++- > 13 files changed, 52 insertions(+), 36 deletions(-) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 1ccf5cb..7a7fced 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -822,7 +822,7 @@ static void drm_mode_remove(struct drm_connector > *connector, > struct drm_display_mode *mode) > { > list_del(&mode->head); > - drm_mode_destroy(connector->dev, mode); > + drm_mode_unreference(mode); > } > > /** > @@ -2602,7 +2602,7 @@ out: > drm_framebuffer_unreference(fb); > > kfree(connector_set); > - drm_mode_destroy(dev, mode); > + drm_mode_unreference(mode); > drm_modeset_unlock_all(dev); > return ret; > } > diff --git a/drivers/gpu/drm/drm_crtc_helper.c > b/drivers/gpu/drm/drm_crtc_helper.c > index 6c65a0a..757de8b 100644 > --- a/drivers/gpu/drm/drm_crtc_helper.c > +++ b/drivers/gpu/drm/drm_crtc_helper.c > @@ -384,7 +384,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, > > /* FIXME: add subpixel order */ > done: > - drm_mode_destroy(dev, adjusted_mode); > + drm_mode_unreference(adjusted_mode); > if (!ret) { > crtc->enabled = saved_enabled; > crtc->mode = saved_mode; > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 087d608..cbc021d 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -1705,7 +1705,7 @@ drm_mode_std(struct drm_connector *connector, struct > edid *edid, > if (!mode) > return NULL; > if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) { > - drm_mode_destroy(dev, mode); > + drm_mode_unreference(mode); > mode = drm_gtf_mode_complex(dev, hsize, vsize, > vrefresh_rate, 0, 0, > drm_gtf2_m(edid), > @@ -2021,7 +2021,7 @@ drm_gtf_modes_for_range(struct drm_connector > *connector, struct edid *edid, > fixup_mode_1366x768(newmode); > if (!mode_in_range(newmode, edid, timing) || > !valid_inferred_mode(connector, newmode)) { > - drm_mode_destroy(dev, newmode); > + drm_mode_unreference(newmode); > continue; > } > > @@ -2050,7 +2050,7 @@ drm_cvt_modes_for_range(struct drm_connector > *connector, struct edid *edid, > fixup_mode_1366x768(newmode); > if (!mode_in_range(newmode, edid, timing) || > !valid_inferred_mode(connector, newmode)) { > - drm_mode_destroy(dev, newmode); > + drm_mode_unreference(newmode); > continue; > } > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 3144db9..5c96a6a 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -588,7 +588,7 @@ static void drm_fb_helper_crtc_free(struct drm_fb_helper > *helper) > for (i = 0; i < helper->crtc_count; i++) { > kfree(helper->crtc_info[i].mode_set.connectors); > if (helper->crtc_info[i].mode_set.mode) > -
[PATCH] drm: refcnt drm_display_mode
On Sun, Jul 27, 2014 at 11:17 AM, Daniel Vetter wrote: > On Sat, Jul 26, 2014 at 12:51 AM, Rob Clark wrote: >> We're going to need this for atomic. >> >> Signed-off-by: Rob Clark > > I disagree. Iiui correctly Rob's concern is that the additional stuff > to keep track of mode lists (list_head and the idr stuff) could > confuse driver writers into doing stupid stuff when they embed > drm_display_mode into some other stuff. Imo the right fix would be to > just remove them (but that's fairly invasive to the mode list code). bleh, all the deep copies seem ugly either way, I still think refcnt'ing and shallow copies is the better idea > Now wrt atomic we only need refcounting because currently > drm_atomic_state is refcounted. And we don't need that afaics (and I'm > working on the draft code to show how). So without a clear need for > refcounting I really prefer we don't add this complexity - doing > refcounting for fbs wasn't fun at all ;-) Well, that was somewhat different, because there were some side-effects of rmfb BR, -R > -Daniel >> --- >> drivers/gpu/drm/drm_crtc.c| 4 +-- >> drivers/gpu/drm/drm_crtc_helper.c | 2 +- >> drivers/gpu/drm/drm_edid.c| 6 ++-- >> drivers/gpu/drm/drm_fb_helper.c | 6 ++-- >> drivers/gpu/drm/drm_modes.c | 41 >> --- >> drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- >> drivers/gpu/drm/gma500/psb_intel_sdvo.c | 3 +- >> drivers/gpu/drm/i915/intel_panel.c| 8 ++ >> drivers/gpu/drm/i915/intel_sdvo.c | 3 +- >> drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- >> drivers/gpu/drm/omapdrm/omap_connector.c | 2 +- >> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +-- >> include/drm/drm_modes.h | 5 +++- >> 13 files changed, 52 insertions(+), 36 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c >> index 1ccf5cb..7a7fced 100644 >> --- a/drivers/gpu/drm/drm_crtc.c >> +++ b/drivers/gpu/drm/drm_crtc.c >> @@ -822,7 +822,7 @@ static void drm_mode_remove(struct drm_connector >> *connector, >> struct drm_display_mode *mode) >> { >> list_del(&mode->head); >> - drm_mode_destroy(connector->dev, mode); >> + drm_mode_unreference(mode); >> } >> >> /** >> @@ -2602,7 +2602,7 @@ out: >> drm_framebuffer_unreference(fb); >> >> kfree(connector_set); >> - drm_mode_destroy(dev, mode); >> + drm_mode_unreference(mode); >> drm_modeset_unlock_all(dev); >> return ret; >> } >> diff --git a/drivers/gpu/drm/drm_crtc_helper.c >> b/drivers/gpu/drm/drm_crtc_helper.c >> index 6c65a0a..757de8b 100644 >> --- a/drivers/gpu/drm/drm_crtc_helper.c >> +++ b/drivers/gpu/drm/drm_crtc_helper.c >> @@ -384,7 +384,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, >> >> /* FIXME: add subpixel order */ >> done: >> - drm_mode_destroy(dev, adjusted_mode); >> + drm_mode_unreference(adjusted_mode); >> if (!ret) { >> crtc->enabled = saved_enabled; >> crtc->mode = saved_mode; >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c >> index 087d608..cbc021d 100644 >> --- a/drivers/gpu/drm/drm_edid.c >> +++ b/drivers/gpu/drm/drm_edid.c >> @@ -1705,7 +1705,7 @@ drm_mode_std(struct drm_connector *connector, struct >> edid *edid, >> if (!mode) >> return NULL; >> if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) { >> - drm_mode_destroy(dev, mode); >> + drm_mode_unreference(mode); >> mode = drm_gtf_mode_complex(dev, hsize, vsize, >> vrefresh_rate, 0, 0, >> drm_gtf2_m(edid), >> @@ -2021,7 +2021,7 @@ drm_gtf_modes_for_range(struct drm_connector >> *connector, struct edid *edid, >> fixup_mode_1366x768(newmode); >> if (!mode_in_range(newmode, edid, timing) || >> !valid_inferred_mode(connector, newmode)) { >> - drm_mode_destroy(dev, newmode); >> + drm_mode_unreference(newmode); >> continue; >> } >> >> @@ -2050,7 +2050,7 @@ drm_cvt_modes_for_range(struct drm_connector >> *connector, struct edid *edid, >> fixup_mode_1366x768(newmode); >> if (!mode_in_range(newmode, edid, timing) || >> !valid_inferred_mode(connector, newmode)) { >> - drm_mode_destroy(dev, newmode); >> + drm_mode_unreference(newmode); >> continue; >> } >> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c >> b/drivers/gpu/drm/drm_fb_helper.c >> index 3144db9..5c96a6a 10
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #109 from Serkan Hosca --- (In reply to comment #105) > (In reply to comment #103) > > Not working for me. I've updated the firmware files and using agd5f's > > drm-next-3.17-wip branch. I can't switch to other vt's, it gets stuck with > > the boot messages on vt1. Haven't tried starting X yet. > > Your dmesg shows that you have a ASIC_ProfilingInfo v3.1 table on your > board. You might want to try a patch from bug #73420: attachement #93015. > The issue itself is tracked in bug #74250. Tried attachment #93015 from bug #73420 and i get a hard lock up, can't even ssh the machine. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/2c1e94cb/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #110 from Serkan Hosca --- Created attachment 103549 --> https://bugs.freedesktop.org/attachment.cgi?id=103549&action=edit dmesg with drm-next-3.17-wip with x -retro and starting xterm (In reply to comment #109) > (In reply to comment #105) > > (In reply to comment #103) > > > Not working for me. I've updated the firmware files and using agd5f's > > > drm-next-3.17-wip branch. I can't switch to other vt's, it gets stuck with > > > the boot messages on vt1. Haven't tried starting X yet. > > > > Your dmesg shows that you have a ASIC_ProfilingInfo v3.1 table on your > > board. You might want to try a patch from bug #73420: attachement #93015. > > The issue itself is tracked in bug #74250. > > Tried attachment #93015 [details] [review] from bug #73420 and i get a hard > lock up, can't even ssh the machine Scratch that, my mistake, the attachment worked, cleared up those messages. I can start x -retro but when i try to launch xterm gpu crashes. -- You are receiving this mail because: You are the assignee for the bug. -- next part ------ An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/c861393c/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #111 from Serkan Hosca --- Created attachment 103550 --> https://bugs.freedesktop.org/attachment.cgi?id=103550&action=edit xorg log with drm-next-3.17-wip with x -retro and starting xterm -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/af69b807/attachment-0001.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #112 from Kai --- (In reply to comment #111) > Created attachment 103550 [details] > xorg log with drm-next-3.17-wip with x -retro and starting xterm Just FYI: all "working" reports came from people with a stable X.Org 1.16.0 AFAIK. Maybe you want to try that instead of your development version? -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/4381cf99/attachment.html>
[Bug 78453] [HAWAII] Get acceleration working
https://bugs.freedesktop.org/show_bug.cgi?id=78453 --- Comment #113 from Kai --- Oh, and I needed the three Mesa patches "radeonsi: fix CMASK and HTILE calculations for Hawaii", "gallium/util: add a helper for calculating primitive count from vertex count" and "radeonsi: fix a hang with instancing on Hawaii" to get into my KDE desktop, maybe it's the same for X -retro. The other Mesa patches can't hurt either (I have them applied now). -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20140727/dc7c24cf/attachment.html>
[PATCH] drm: refcnt drm_display_mode
On Sun, Jul 27, 2014 at 6:20 PM, Rob Clark wrote: > On Sun, Jul 27, 2014 at 11:17 AM, Daniel Vetter wrote: >> On Sat, Jul 26, 2014 at 12:51 AM, Rob Clark wrote: >>> We're going to need this for atomic. >>> >>> Signed-off-by: Rob Clark >> >> I disagree. Iiui correctly Rob's concern is that the additional stuff >> to keep track of mode lists (list_head and the idr stuff) could >> confuse driver writers into doing stupid stuff when they embed >> drm_display_mode into some other stuff. Imo the right fix would be to >> just remove them (but that's fairly invasive to the mode list code). > > bleh, all the deep copies seem ugly either way, I still think > refcnt'ing and shallow copies is the better idea Until people start screaming at me I'm not really concerned with cpu overhead in the modeset code. We need to do piles of uncached register writes (at least in most drivers) and it's run about 60 times per second. Imo we can and should optimize programmer time over cpu time here. So if deep copies allow us to avoid refcounting, them I'm all for it. >> Now wrt atomic we only need refcounting because currently >> drm_atomic_state is refcounted. And we don't need that afaics (and I'm >> working on the draft code to show how). So without a clear need for >> refcounting I really prefer we don't add this complexity - doing >> refcounting for fbs wasn't fun at all ;-) > > Well, that was somewhat different, because there were some side-effects of > rmfb That's not the part I've meant since that's just a gross hack - the rmfb stuff isn't done on the final unref, only on the final unref from userspace. And the hack was required to avoid undoing all the benefits of the finer-grained locking. I'm meaning the inherent auditing we need to do when adding refcounting, and the potential complexity going forward. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH] drm: refcnt drm_display_mode
On Sun, Jul 27, 2014 at 1:38 PM, Daniel Vetter wrote: > On Sun, Jul 27, 2014 at 6:20 PM, Rob Clark wrote: >> On Sun, Jul 27, 2014 at 11:17 AM, Daniel Vetter wrote: >>> On Sat, Jul 26, 2014 at 12:51 AM, Rob Clark wrote: We're going to need this for atomic. Signed-off-by: Rob Clark >>> >>> I disagree. Iiui correctly Rob's concern is that the additional stuff >>> to keep track of mode lists (list_head and the idr stuff) could >>> confuse driver writers into doing stupid stuff when they embed >>> drm_display_mode into some other stuff. Imo the right fix would be to >>> just remove them (but that's fairly invasive to the mode list code). >> >> bleh, all the deep copies seem ugly either way, I still think >> refcnt'ing and shallow copies is the better idea > > Until people start screaming at me I'm not really concerned with cpu > overhead in the modeset code. We need to do piles of uncached register > writes (at least in most drivers) and it's run about 60 times per > second. Imo we can and should optimize programmer time over cpu time > here. So if deep copies allow us to avoid refcounting, them I'm all > for it. oh, I'm sure it would be hard to measure a difference.. just seems pointlessly stupid not to do refcnt'ing ;-) >>> Now wrt atomic we only need refcounting because currently >>> drm_atomic_state is refcounted. And we don't need that afaics (and I'm >>> working on the draft code to show how). So without a clear need for >>> refcounting I really prefer we don't add this complexity - doing >>> refcounting for fbs wasn't fun at all ;-) >> >> Well, that was somewhat different, because there were some side-effects of >> rmfb > > That's not the part I've meant since that's just a gross hack - the > rmfb stuff isn't done on the final unref, only on the final unref from > userspace. And the hack was required to avoid undoing all the benefits > of the finer-grained locking. I'm meaning the inherent auditing we > need to do when adding refcounting, and the potential complexity going > forward. we use refcnt'ing in enough other places, it isn't like it is a new and foreign concept.. if needed, we can back it up w/ some debugfs to simplify checking for leaks.. BR, -R > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH 00/19] atomic, remixed
Hi all, So I've figured instead of just talking I should draw up my ideas for atomic helpers and related stuff in some draft patches. Major differences compared to Rob's series: - The software side state update is done synchronously, at least when using the helper code. Drivers are free to do whatever they want, as usual. This has a bunch of nice upsides: + All the tricky locking dances can be abolished, and if the ordering and synchronization is done correctly async worker threads don't need any modeset state locking at all. I'm fairly sure that Rob's scheme won't blow up, but I much prefer we don't need it at all. + In Rob's patches any atomic operation must wait for outstanding updates to complete. Otherwise the software state isn't committed yet. With the synchronous updates we can immediately proceed with the state construction and verification and will only block right before applying the state update. And even for that drivers can implement cancellation of the previous update. This has the nice benefit that check-only operations (which compositors need to do right after having completed the current frame to know how to render the next one) can be done without blocking for completion of the previous update. - Internal interfaces for atomic updates don't need to go through properties, but can directly set the state. Drivers can always compare updates in their ->check hook later on, so we don't lose expressiveness in the interface. But the resulting code in the callers looks much better. In general I've ditched a lot of interfaces where drivers could overwrite default behaviour and boiled down the interface two state handling functions (duplicate+destroy), setting driver-private properties and check/commit. - There is a clear helper separation between core code which should be used to use the atomic interface to drivers, and helper functions. Core never uses helper functions so that we can keep the clear separation we have in all other places in the kms api. There's a set of helpers sitting in-between to implement legacy interfaces on top of atomic. Those _only_ use the core atomic interfaces. - I've added a new set of plane helpers. Mostly this was motivated to make the atomic helpers work on less stellar hardware where you can't just stream the state and then atomically commit with some GO bits. But those helpers should also be useful for more gradual transitions of drivers to the atomic interface. Since a requirement for atomic is to have universal plane support they can be used bare-bones just for that, without all the other atomic baggage (i.e. all the state tracking for crtcs/connectors). - State tracking for connectors. i915 has piles of relevant connector properties, which we want to save/restore in atomic ops (e.g. hdmi metadata and stuff). - fbdev panic locking is implemented with trylock instead of nolock. - I've thought a bit about resume. See the proposed state handling for the default reset functions and the addition of a plane reset callback. There's also a metric pile of stuff missing: - It's completely untested (except for the parts touching currently used code) since I lack suitable hw. Converting i915 is just a bit too much of a pain for a quick w/e code draft ;-) - I didn't add all the properties for things currently exposed through ioctl structures. Since the interface here doesn't force internal code to use properties for everything (which really makes things look much better) we don't have a need for that until we merge the actual atomic ioctl. So I left that out. - I didn't write code for the fbdev helper to use atomic. The w/e ran out of time for that ... - Kerneldoc is occasionally not updated or still missing. Anyway I think this draft code is good enough to explain how I'd like to address some of the concerns I have with the current atomic code. Comments, flames and ideas highly welcome. And if anyone is insane enought to try this on real hardware, that would certainly be interesting and I'm very much willing to help out as much as possible ... i915 just really isn't suitable since it won't be using the helpers, and all the other hw I have here doesn't support planes. Cheers, Daniel Daniel Vetter (18): drm: Add atomic driver interface definitions for objects drm: Add drm_plane/connector_index drm: Move modeset_lock_all helpers to drm_modeset_lock.[hc] drm: Handle legacy per-crtc locking with full acquire ctx drm: Global atomic state handling drm: Add atomic/plane helpers drm/irq: Implement a generic vblank_wait function drm/i915: Use generic vblank wait drm/plane-helper: transitional atomic plane helpers drm/crtc-helper: Transitional functions using atomic plane helpers drm: Atomic crtc/connector updates using crtc helper interfaces drm: Move ->old_fb from crtc to plane drm/atomic-helper: implementatations for legacy interfa
[PATCH 02/19] drm: Add drm_plane/connector_index
In the atomic state we'll have an array of states for crtcs, planes and connectors and need to be able to at them by their index. We already have a drm_crtc_index function so add the missing ones for planes and connectors. If it later on turns out that the list walking is too expensive we can add the index to the relevant modeset objects. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 46 ++ include/drm/drm_crtc.h | 3 +++ 2 files changed, 49 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 0f934a58702d..fdea713767b4 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -937,6 +937,29 @@ void drm_connector_cleanup(struct drm_connector *connector) EXPORT_SYMBOL(drm_connector_cleanup); /** + * drm_plane_index - find the index of a registered CRTC + * @plane: CRTC to find index for + * + * Given a registered CRTC, return the index of that CRTC within a DRM + * device's list of CRTCs. + */ +unsigned int drm_connector_index(struct drm_connector *connector) +{ + unsigned int index = 0; + struct drm_connector *tmp; + + list_for_each_entry(tmp, &connector->dev->mode_config.connector_list, head) { + if (tmp == connector) + return index; + + index++; + } + + BUG(); +} +EXPORT_SYMBOL(drm_connector_index); + +/** * drm_connector_register - register a connector * @connector: the connector to register * @@ -1239,6 +1262,29 @@ void drm_plane_cleanup(struct drm_plane *plane) EXPORT_SYMBOL(drm_plane_cleanup); /** + * drm_plane_index - find the index of a registered CRTC + * @plane: CRTC to find index for + * + * Given a registered CRTC, return the index of that CRTC within a DRM + * device's list of CRTCs. + */ +unsigned int drm_plane_index(struct drm_plane *plane) +{ + unsigned int index = 0; + struct drm_plane *tmp; + + list_for_each_entry(tmp, &plane->dev->mode_config.plane_list, head) { + if (tmp == plane) + return index; + + index++; + } + + BUG(); +} +EXPORT_SYMBOL(drm_plane_index); + +/** * drm_plane_force_disable - Forcibly disable a plane * @plane: plane to disable * diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a1a8c694e765..d6546fd1e00c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -680,6 +680,7 @@ struct drm_plane_state { /* Source values are 16.16 fixed point */ uint32_t src_x, src_y; uint32_t src_h, src_w; + struct drm_atomic_state *state; }; @@ -1052,6 +1053,7 @@ int drm_connector_register(struct drm_connector *connector); void drm_connector_unregister(struct drm_connector *connector); extern void drm_connector_cleanup(struct drm_connector *connector); +extern unsigned int drm_connector_index(struct drm_connector *crtc); /* helper to unplug all connectors from sysfs for device */ extern void drm_connector_unplug_all(struct drm_device *dev); @@ -1091,6 +1093,7 @@ extern int drm_plane_init(struct drm_device *dev, const uint32_t *formats, uint32_t format_count, bool is_primary); extern void drm_plane_cleanup(struct drm_plane *plane); +extern unsigned int drm_plane_index(struct drm_plane *crtc); extern void drm_plane_force_disable(struct drm_plane *plane); extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, int x, int y, -- 2.0.1
[PATCH 01/19] drm: Add atomic driver interface definitions for objects
Heavily based upon Rob Clark's atomic series. - Dropped the connctor state from the crtc state, instead opting for a full-blown connector state. The only thing it has is the desired crtc, but drivers which have connector properties have now a data-structure to subclass. - Rename create_state to duplicate_state. Especially for legacy ioctls we want updates on top of existing state, so we need a way to get at the current state. We need to be careful to clear the backpointers correctly though. We need to be careful though with the ->state backpointer we need while constructing the atomic state. - Drop property values. Drivers with properties simply need to subclass the datastructures and track the decoded values in there. I also think that common properties (like rotation) should be decoded and stored in the core structures. - Create a new set of ->atomic_set_prop functions, for smoother transitions from legacy to atomic operations. - Pass the ->atomic_set_prop ioctl the right structure to avoid chasing pointers in drivers. - Drop temporary boolean state for now until we resurrect them with the helper functions. - Drop invert_dimensions. For now we don't need any checking since that's done by the higher-level legacy ioctls. But even then we should also add rotation/flip tracking to the core drm_crtc_state, not just whether the dimensions are inverted. - Track crtc state with an enable/disable. That's equivalent to mode_valid, but a bit clearer that it means the entire crtc. The global interface will follow in subsequent patches. v2: We need to allow drivers to somehow set up the initial state and clear it on resume. So add a plane->reset callback for that. Helpers will be provided with default behaviour for all these. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 5 ++ include/drm/drm_crtc.h | 149 + 2 files changed, 154 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 805240b11229..0f934a58702d 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -4623,9 +4623,14 @@ out: void drm_mode_config_reset(struct drm_device *dev) { struct drm_crtc *crtc; + struct drm_crtc *plane; struct drm_encoder *encoder; struct drm_connector *connector; + list_for_each_entry(plane, &dev->mode_config.plane_list, head) + if (plane->funcs->reset) + plane->funcs->reset(plane); + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) if (crtc->funcs->reset) crtc->funcs->reset(crtc); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index f1105d0da059..a1a8c694e765 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -228,6 +228,25 @@ struct drm_encoder; struct drm_pending_vblank_event; struct drm_plane; struct drm_bridge; +struct drm_atomic_state; + +/** + * drm_crtc_state - mutable crtc state + * @mode_valid: a valid mode has been set + * @set_config: needs modeset (crtc->set_config()) + * @connectors_change: the connector-ids array has changed + * @mode: current mode timings + * @event: pending pageflip event + */ +struct drm_crtc_state { + bool enable: 1; + + struct drm_display_mode mode; + + struct drm_pending_vblank_event *event; + + struct drm_atomic_state *state; +}; /** * drm_crtc_funcs - control CRTCs for a given device @@ -291,6 +310,15 @@ struct drm_crtc_funcs { int (*set_property)(struct drm_crtc *crtc, struct drm_property *property, uint64_t val); + + /* atomic update handling */ + struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc); + void (*atomic_destroy_state)(struct drm_crtc *crtc, +struct drm_crtc_state *cstate); + int (*atomic_set_property)(struct drm_crtc *crtc, + struct drm_crtc_state *state, + struct drm_property *property, + uint64_t val); }; /** @@ -375,8 +403,38 @@ struct drm_crtc { void *helper_private; struct drm_object_properties properties; + + struct drm_crtc_state *state; }; +static inline struct drm_crtc_state * +drm_crtc_duplicate_state(struct drm_crtc *crtc) +{ + if (crtc->funcs->atomic_duplicate_state) + return crtc->funcs->atomic_duplicate_state(crtc); + return kmemdup(crtc->state, sizeof(struct drm_crtc_state), GFP_KERNEL); +} + +static inline void +drm_crtc_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *cstate) +{ + if (crtc->funcs->atomic_destroy_state) + crtc->funcs->atomic_destroy_state(crtc, cstate); + else + kfree(cstate); +} + + +/** + * drm_connector_state - mutable connector state + * @
[PATCH 03/19] drm: Move modeset_lock_all helpers to drm_modeset_lock.[hc]
Somehow we've forgotten about this little bit of OCD. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 95 -- drivers/gpu/drm/drm_modeset_lock.c | 95 ++ include/drm/drm_crtc.h | 4 -- include/drm/drm_modeset_lock.h | 5 ++ 4 files changed, 100 insertions(+), 99 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index fdea713767b4..acb3b3121f67 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -45,101 +45,6 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, struct drm_mode_fb_cmd2 *r, struct drm_file *file_priv); -/** - * drm_modeset_lock_all - take all modeset locks - * @dev: drm device - * - * This function takes all modeset locks, suitable where a more fine-grained - * scheme isn't (yet) implemented. Locks must be dropped with - * drm_modeset_unlock_all. - */ -void drm_modeset_lock_all(struct drm_device *dev) -{ - struct drm_mode_config *config = &dev->mode_config; - struct drm_modeset_acquire_ctx *ctx; - int ret; - - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (WARN_ON(!ctx)) - return; - - mutex_lock(&config->mutex); - - drm_modeset_acquire_init(ctx, 0); - -retry: - ret = drm_modeset_lock(&config->connection_mutex, ctx); - if (ret) - goto fail; - ret = drm_modeset_lock_all_crtcs(dev, ctx); - if (ret) - goto fail; - - WARN_ON(config->acquire_ctx); - - /* now we hold the locks, so now that it is safe, stash the -* ctx for drm_modeset_unlock_all(): -*/ - config->acquire_ctx = ctx; - - drm_warn_on_modeset_not_all_locked(dev); - - return; - -fail: - if (ret == -EDEADLK) { - drm_modeset_backoff(ctx); - goto retry; - } -} -EXPORT_SYMBOL(drm_modeset_lock_all); - -/** - * drm_modeset_unlock_all - drop all modeset locks - * @dev: device - * - * This function drop all modeset locks taken by drm_modeset_lock_all. - */ -void drm_modeset_unlock_all(struct drm_device *dev) -{ - struct drm_mode_config *config = &dev->mode_config; - struct drm_modeset_acquire_ctx *ctx = config->acquire_ctx; - - if (WARN_ON(!ctx)) - return; - - config->acquire_ctx = NULL; - drm_modeset_drop_locks(ctx); - drm_modeset_acquire_fini(ctx); - - kfree(ctx); - - mutex_unlock(&dev->mode_config.mutex); -} -EXPORT_SYMBOL(drm_modeset_unlock_all); - -/** - * drm_warn_on_modeset_not_all_locked - check that all modeset locks are locked - * @dev: device - * - * Useful as a debug assert. - */ -void drm_warn_on_modeset_not_all_locked(struct drm_device *dev) -{ - struct drm_crtc *crtc; - - /* Locking is currently fubar in the panic handler. */ - if (oops_in_progress) - return; - - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) - WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); - - WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); - WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); -} -EXPORT_SYMBOL(drm_warn_on_modeset_not_all_locked); - /* Avoid boilerplate. I'm tired of typing. */ #define DRM_ENUM_NAME_FN(fnname, list) \ const char *fnname(int val) \ diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 0dc57d5ecd10..73e6534fd0aa 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c @@ -57,6 +57,101 @@ /** + * drm_modeset_lock_all - take all modeset locks + * @dev: drm device + * + * This function takes all modeset locks, suitable where a more fine-grained + * scheme isn't (yet) implemented. Locks must be dropped with + * drm_modeset_unlock_all. + */ +void drm_modeset_lock_all(struct drm_device *dev) +{ + struct drm_mode_config *config = &dev->mode_config; + struct drm_modeset_acquire_ctx *ctx; + int ret; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (WARN_ON(!ctx)) + return; + + mutex_lock(&config->mutex); + + drm_modeset_acquire_init(ctx, 0); + +retry: + ret = drm_modeset_lock(&config->connection_mutex, ctx); + if (ret) + goto fail; + ret = drm_modeset_lock_all_crtcs(dev, ctx); + if (ret) + goto fail; + + WARN_ON(config->acquire_ctx); + + /* now we hold the locks, so now that it is safe, stash the +* ctx for drm_modeset_unlock_all(): +*/ + config->acquire_ctx = ctx; + + drm_warn_on_modeset_not_all_locked(dev); + + return; + +fail: + if (ret == -EDEADLK) { + drm_modeset_backoff(ct
[PATCH 04/19] drm: Handle legacy per-crtc locking with full acquire ctx
So drivers using the atomic interfaces expect that they can acquire additional locks internal to the driver as-needed. Examples would be locks to protect shared state like shared display PLLs. Unfortunately the legacy ioctls assume that all locking is fully done by the drm core. Now for those paths which grab all locks we already have to keep around an acquire context in dev->mode_config. Helper functions that implement legacy interfaces in terms of atomic support can therefore grab this acquire contexts and reuse it. The only interfaces left are the cursor and pageflip ioctls. So add functions to grab the crtc lock these need using an acquire context and preserve it for atomic drivers to reuse. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 8 ++-- drivers/gpu/drm/drm_modeset_lock.c | 86 ++ include/drm/drm_crtc.h | 6 +++ include/drm/drm_modeset_lock.h | 5 +++ 4 files changed, 101 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index acb3b3121f67..e33aa3a3a8a5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2714,7 +2714,7 @@ static int drm_mode_cursor_common(struct drm_device *dev, if (crtc->cursor) return drm_mode_cursor_universal(crtc, req, file_priv); - drm_modeset_lock(&crtc->mutex, NULL); + drm_modeset_lock_crtc(crtc); if (req->flags & DRM_MODE_CURSOR_BO) { if (!crtc->funcs->cursor_set && !crtc->funcs->cursor_set2) { ret = -ENXIO; @@ -2738,7 +2738,7 @@ static int drm_mode_cursor_common(struct drm_device *dev, } } out: - drm_modeset_unlock(&crtc->mutex); + drm_modeset_unlock_crtc(crtc); return ret; @@ -4474,7 +4474,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, if (!crtc) return -ENOENT; - drm_modeset_lock(&crtc->mutex, NULL); + drm_modeset_lock_crtc(crtc); if (crtc->primary->fb == NULL) { /* The framebuffer is currently unbound, presumably * due to a hotplug event, that userspace has not @@ -4558,7 +4558,7 @@ out: drm_framebuffer_unreference(fb); if (old_fb) drm_framebuffer_unreference(old_fb); - drm_modeset_unlock(&crtc->mutex); + drm_modeset_unlock_crtc(crtc); return ret; } diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 73e6534fd0aa..412b396af740 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c @@ -130,6 +130,90 @@ void drm_modeset_unlock_all(struct drm_device *dev) EXPORT_SYMBOL(drm_modeset_unlock_all); /** + * drm_modeset_lock_crtc - lock crtc with hidden acquire ctx + * @crtc: drm crtc + * + * This function locks the given crtc using a hidden acquire context. This is + * necessary so that drivers internally using the atomic interfaces can grab + * furether locks with the lock acquire context. + */ +void drm_modeset_lock_crtc(struct drm_crtc *crtc) +{ + struct drm_modeset_acquire_ctx *ctx; + int ret; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (WARN_ON(!ctx)) + return; + + drm_modeset_acquire_init(ctx, 0); + +retry: + ret = drm_modeset_lock(&crtc->mutex, ctx); + if (ret) + goto fail; + + WARN_ON(crtc->acquire_ctx); + + /* now we hold the locks, so now that it is safe, stash the +* ctx for drm_modeset_unlock_all(): +*/ + crtc->acquire_ctx = ctx; + + return; + +fail: + if (ret == -EDEADLK) { + drm_modeset_backoff(ctx); + goto retry; + } +} +EXPORT_SYMBOL(drm_modeset_lock_crtc); + +/** + * drm_modeset_legacy_acquire_ctx - find acquire ctx for legacy ioctls + * crtc: drm crtc + * + * Legacy ioctl operations like cursor updates or page flips only have per-crtc + * locking, and store the acquire ctx in the corresponding crtc. All other + * legacy operations take all locks and use a global acquire context. This + * function grabs the right one. + */ +struct drm_modeset_acquire_ctx * +drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc) +{ + if (crtc->acquire_ctx) + return crtc->acquire_ctx; + + WARN_ON(!crtc->dev->mode_config.acquire_ctx); + + return crtc->dev->mode_config.acquire_ctx; +} +EXPORT_SYMBOL(drm_modeset_legacy_acquire_ctx); + +/** + * drm_modeset_unlock_crtc - drop all modeset locks + * @crtc: drm crtc + * + * This drops the crtc lock acquire with drm_modeset_lock_crtc() and all other + * locks acquired through the hidden context. + */ +void drm_modeset_unlock_crtc(struct drm_crtc *crtc) +{ + struct drm_modeset_acquire_ctx *ctx = crtc->acquire_ctx; + + if (WARN_ON(!ctx)) + return; + + crtc->acquire_ctx = NULL; + drm_modeset_drop_locks(ctx); +
[PATCH 05/19] drm: Global atomic state handling
Some differences compared to Rob's patches again: - Dropped the committed and checked booleans. Checking will be internally enforced by always calling ->atomic_check before ->atomic_commit. And async handling needs to be solved differently because the current scheme completely side-steps ww mutex deadlock avoidance (and so either reinvents a new deadlock avoidance wheel or like the current code just deadlocks). - State for connectors needed to be added, since now they have a full-blown drm_connector_state (so that drivers have something to attach their own stuff to). - Refcounting is gone. I plane to solve async updates differently, since the lock-passing scheme doesn't cut it (since it abuses ww mutexes). Essentially what we need for async is a simple ownership transfer from the caller to the driver. That doesn't need full-blown refcounting. - The acquire ctx is a pointer. Real atomic callers should have that on their stack, legacy entry points need to put the right one (obtained by drm_modeset_legacy_acuire_ctx) in there. - I've dropped all hooks except check/commit. All the begin/end handling is done by core functions and is the same. - commit/check are just thin wrappers that ensure that ->check is always called. - To help out with locking in the legacy implementations I've added a helper to just grab all locks in the backoff case. v2: Add notices that check/commit can fail with EDEADLK. v3: - More consistent naming for state_alloc. - Add state_clear which is needed for backoff and retry. v4: Planes/connectors can switch between crtcs, and we need to be careful that we grab the state (and locks) for both the old and new crtc. Improve the interface functions to ensure this. v5: Add functions to grab affected connectors for a crtc and to recompute the crtc->enable state. This is useful for both helper and atomic ioctl code when e.g. removing a connector. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_atomic.c | 529 +++ include/drm/drm_atomic.h | 63 ++ include/drm/drm_crtc.h | 23 ++ 4 files changed, 616 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 include/drm/drm_atomic.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 61d9e9c6bc10..82e922c02c6d 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -14,7 +14,7 @@ drm-y :=drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \ - drm_modeset_lock.o + drm_modeset_lock.o drm_atomic.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c new file mode 100644 index ..29e77fe24e06 --- /dev/null +++ b/drivers/gpu/drm/drm_atomic.c @@ -0,0 +1,529 @@ +/* + * Copyright (C) 2014 Red Hat + * Copyright (C) 2014 Intel Corp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rob Clark + * Daniel Vetter + */ + + +#include +#include +#include + +static void kfree_state(struct drm_atomic_state *state) +{ + kfree(state->connectors); + kfree(state->connector_states); + kfree(state->crtcs); + kfree(state->crtc_states); + kfree(state->planes); + kfree(state->plane_states); + kfree(state); +} + +/** + * drm_atomic_state_alloc - allocate atomic state + * @dev DRM device + * + * This allocates an empty atomic state to track updates. + */ +struct drm_atomic_state * +drm_atomic_state_alloc(struct drm_device *dev) +{ + struct drm_atomic_state *state; + + state = kzalloc(sizeof(*state), GFP_KERNEL
[PATCH 06/19] drm: Add atomic/plane helpers
This is the first cut of atomic helper code. As-is it's only useful to implement a pure atomic interface for plane updates. Later patches will integrate this with the crtc helpers so that full atomic updates are possible. We also need a pile of helpers to aid drivers in transitioning from the legacy world to the shiny new atomic age. Finally we need helpers to implement legacy ioctls on top of the atomic interface. The design of the helpers is fairly simple, but has a unfortunate large interface: - We have ->atomic_check callbacks for crtcs and planes. The idea is that connectors don't need any checking, and if they do they can adjust the relevant crtc driver-private state. So no connector hooks should be needed. Also the crtc helpers integration will do the ->best_encoder checks, so no need for that. - Framebuffer pinning needs to be done before we can commit to the hw state. This is especially important for async updates where we must pin all buffers before returning to userspace, so that really only hw failures can happen in the asynchronous worker. Hence we add ->prepare_fb and ->cleanup_fb hooks for this resources management. - The actual atomic plane commit can't fail (except hw woes), so has void return type. It has three stages: 1. Prepare all affected crtcs with crtc->atomic_begin. Drivers can use this to unset the GO bit or similar latches to prevent plane updates. 2. Update plane state by looping over all changed planes and calling plane->atomic_update. Presuming the hardware is sane and has GO bits drivers can simply bash the state into the hardware in this function. Other drivers might use this to precompute hw state for the final step. 3. Finally latch the update for the next vblank with crtc->atomic_flush. Note that this function doesn't need to wait for the vblank to happen even for the synchronous case. v2: Clear drm__state->state to NULL when swapping in state. v3: Add TODO that we don't short-circuit plane updates for now. Likely no one will care. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/Makefile| 2 +- drivers/gpu/drm/drm_atomic_helper.c | 349 include/drm/drm_atomic_helper.h | 44 + include/drm/drm_crtc.h | 5 + include/drm/drm_crtc_helper.h | 6 + include/drm/drm_plane_helper.h | 30 6 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_atomic_helper.c create mode 100644 include/drm/drm_atomic_helper.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 82e922c02c6d..aae92c684f95 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -25,7 +25,7 @@ drm-$(CONFIG_OF) += drm_of.o drm-usb-y := drm_usb.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ - drm_plane_helper.o drm_dp_mst_topology.o + drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c new file mode 100644 index ..71e7025068f7 --- /dev/null +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2014 Red Hat + * Copyright (C) 2014 Intel Corp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rob Clark + * Daniel Vetter + */ + +#include +#include +#include +#include + +static void +drm_atomic_helper_plane_changed(struct drm_atomic_state *state, + struct drm_plane_state *plane_state, + struct drm_plane *plane) +{ + struct drm_crtc_state *crtc_state; + + /* +* TODO: For now we don't bothe
[PATCH 08/19] drm/irq: Implement a generic vblank_wait function
As usual in both a crtc index and a struct drm_crtc * version. The function assumes that no one drivers their display below 10Hz, and it will complain if the vblank wait takes longer than that. v2: Also check dev->max_vblank_counter since some drivers register a fake get_vblank_counter function. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_irq.c | 45 + include/drm/drmP.h| 2 ++ 2 files changed, 47 insertions(+) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 0de123afdb34..76024fdde452 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -999,6 +999,51 @@ void drm_crtc_vblank_put(struct drm_crtc *crtc) EXPORT_SYMBOL(drm_crtc_vblank_put); /** + * drm_vblank_wait - wait for one vblank + * @dev: DRM device + * @crtc: crtc index + * + * This waits for one vblank to pass on @crtc, using the irq driver interfaces. + * It is a failure to call this when the vblank irq for @crtc is disable, e.g. + * due to lack of driver support or because the crtc is off. + */ +void drm_vblank_wait(struct drm_device *dev, int crtc) +{ + int ret; + u32 last; + + ret = drm_vblank_get(dev, crtc); + if (WARN_ON(ret)) + return; + + last = drm_vblank_count(dev, crtc); + +#define C (last != drm_vblank_count(dev, crtc)) + ret = wait_event_timeout(dev->vblank[crtc].queue, +C, msecs_to_jiffies(100)); + + WARN_ON(ret == 0); +#undef C + + drm_vblank_put(dev, crtc); +} +EXPORT_SYMBOL(drm_vblank_wait); + +/** + * drm_crtc_vblank_wait - wait for one vblank + * @crtc: DRM crtc + * + * This waits for one vblank to pass on @crtc, using the irq driver interfaces. + * It is a failure to call this when the vblank irq for @crtc is disable, e.g. + * due to lack of driver support or because the crtc is off. + */ +void drm_crtc_vblank_wait(struct drm_crtc *crtc) +{ + drm_vblank_wait(crtc->dev, drm_crtc_index(crtc)); +} +EXPORT_SYMBOL(drm_crtc_vblank_wait); + +/** * drm_vblank_off - disable vblank events on a CRTC * @dev: DRM device * @crtc: CRTC in question diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 06a673894c47..f72e5ef5f7b0 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1355,6 +1355,8 @@ extern int drm_vblank_get(struct drm_device *dev, int crtc); extern void drm_vblank_put(struct drm_device *dev, int crtc); extern int drm_crtc_vblank_get(struct drm_crtc *crtc); extern void drm_crtc_vblank_put(struct drm_crtc *crtc); +extern void drm_vblank_wait(struct drm_device *dev, int crtc); +extern void drm_crtc_vblank_wait(struct drm_crtc *crtc); extern void drm_vblank_off(struct drm_device *dev, int crtc); extern void drm_vblank_on(struct drm_device *dev, int crtc); extern void drm_crtc_vblank_off(struct drm_crtc *crtc); -- 2.0.1
[PATCH 07/19] drm: Add drm_crtc_vblank_waitqueue()
From: Ville Syrj?l? Add a small static inline helper to grab the vblank wait queue based on the drm_crtc. This is useful for drivers to do internal vblank waits using wait_event() & co. v2: Pimp commit message (Daniel) Add kernel doc (Daniel) Suggested-by: Daniel Vetter Signed-off-by: Ville Syrj?l? Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 1 + include/drm/drmP.h | 11 +++ 2 files changed, 12 insertions(+) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 1d3756d3176c..972759489376 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -3400,6 +3400,7 @@ void (*disable_vblank) (struct drm_device *dev, int crtc); Vertical Blanking and Interrupt Handling Functions Reference !Edrivers/gpu/drm/drm_irq.c +!Iinclude/drm/drmP.h drm_crtc_vblank_waitqueue diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 9b6a445f8602..06a673894c47 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1372,6 +1372,17 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, const struct drm_display_mode *mode); +/** + * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC + * @crtc: which CRTC's vblank waitqueue to retrieve + * + * This function returns a pointer to the vblank waitqueue for the CRTC. + * Drivers can use this to implement vblank waits using wait_event() & co. + */ +static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc) +{ + return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; +} /* Modesetting support */ extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); -- 2.0.1
[PATCH 09/19] drm/i915: Use generic vblank wait
This has the upside that it will no longer steal interrupts from the interrutp handler on pre-g4x. Furthermore this will now scream properly on all platforms if we don't have hw counters enabled. Not yet tested. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 41 +--- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 99eb7cad62a8..d139970023ac 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -891,17 +891,6 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, return intel_crtc->config.cpu_transcoder; } -static void g4x_wait_for_vblank(struct drm_device *dev, int pipe) -{ - struct drm_i915_private *dev_priv = dev->dev_private; - u32 frame, frame_reg = PIPE_FRMCOUNT_GM45(pipe); - - frame = I915_READ(frame_reg); - - if (wait_for(I915_READ_NOTRACE(frame_reg) != frame, 50)) - WARN(1, "vblank wait timed out\n"); -} - /** * intel_wait_for_vblank - wait for vblank on a given pipe * @dev: drm device @@ -912,35 +901,7 @@ static void g4x_wait_for_vblank(struct drm_device *dev, int pipe) */ void intel_wait_for_vblank(struct drm_device *dev, int pipe) { - struct drm_i915_private *dev_priv = dev->dev_private; - int pipestat_reg = PIPESTAT(pipe); - - if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { - g4x_wait_for_vblank(dev, pipe); - return; - } - - /* Clear existing vblank status. Note this will clear any other -* sticky status fields as well. -* -* This races with i915_driver_irq_handler() with the result -* that either function could miss a vblank event. Here it is not -* fatal, as we will either wait upon the next vblank interrupt or -* timeout. Generally speaking intel_wait_for_vblank() is only -* called during modeset at which time the GPU should be idle and -* should *not* be performing page flips and thus not waiting on -* vblanks... -* Currently, the result of us stealing a vblank from the irq -* handler is that a single frame will be skipped during swapbuffers. -*/ - I915_WRITE(pipestat_reg, - I915_READ(pipestat_reg) | PIPE_VBLANK_INTERRUPT_STATUS); - - /* Wait for vblank interrupt bit to set */ - if (wait_for(I915_READ(pipestat_reg) & -PIPE_VBLANK_INTERRUPT_STATUS, -50)) - DRM_DEBUG_KMS("vblank wait timed out\n"); + drm_vblank_wait(dev, pipe); } static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe) -- 2.0.1
[PATCH 10/19] drm/plane-helper: transitional atomic plane helpers
Converting a driver to the atomic interface can be a daunting undertaking. One of the prerequisites is to have full universal planes support. To make that transition a bit easier this pathc provides plane helpers which use the new atomic helper callbacks just only for the plane changes. This way the plane update functionality can be tested without being forced to convert everything at once. Of course a real atomic update capable driver will implement the all plane properties through the atomic interface, so these helpers are mostly transitional. But they can be used to enable proper universal plane support, especially once the crtc helpers have also been adapted. v2: Use ->atomic_duplicate_state if available. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_plane_helper.c | 181 - 1 file changed, 180 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 827ec1a3040b..7befbf017afe 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #define SUBPIXEL_MASK 0x @@ -369,3 +369,182 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs); } EXPORT_SYMBOL(drm_crtc_init); + +/** + * drm_primary_helper_update() - Helper for primary plane update + * @plane: plane object to update + * @crtc: owning CRTC of owning plane + * @fb: framebuffer to flip onto plane + * @crtc_x: x offset of primary plane on crtc + * @crtc_y: y offset of primary plane on crtc + * @crtc_w: width of primary plane rectangle on crtc + * @crtc_h: height of primary plane rectangle on crtc + * @src_x: x offset of @fb for panning + * @src_y: y offset of @fb for panning + * @src_w: width of source rectangle in @fb + * @src_h: height of source rectangle in @fb + * + * Provides a default plane update handler using the atomic plane update + * functions. It is fully left to the driver to check plane constraints and + * handle corner-cases like a fully occluded or otherwise invisible plane. + * + * This is useful for piecewise transitioning of a driver to the atomic helpers. + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, + struct drm_framebuffer *fb, + int crtc_x, int crtc_y, + unsigned int crtc_w, unsigned int crtc_h, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h) +{ + struct drm_plane_state *plane_state; + struct drm_plane_helper_funcs *plane_funcs; + struct drm_crtc_helper_funcs *crtc_funcs; + int ret; + + if (plane->funcs->atomic_duplicate_state) + plane_state = plane->funcs->atomic_duplicate_state(plane); + else if (plane->state) + plane_state = kmemdup(plane->state, sizeof(*plane_state), + GFP_KERNEL); + else + plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL); + if (!plane_state) + return -ENOMEM; + + plane_state->crtc = crtc; + plane_state->fb = fb; + plane_state->crtc_x = crtc_x; + plane_state->crtc_y = crtc_y; + plane_state->crtc_h = crtc_h; + plane_state->crtc_w = crtc_w; + plane_state->src_x = src_x; + plane_state->src_y = src_y; + plane_state->src_h = src_h; + plane_state->src_w = src_w; + + plane_funcs = plane->helper_private; + + if (plane_funcs->atomic_check) { + ret = plane_funcs->atomic_check(plane, plane_state); + if (ret) + goto fail; + } + + if (plane_funcs->prepare_fb) { + ret = plane_funcs->prepare_fb(plane, fb); + if (ret) + goto fail; + } + + /* Point of no return, commit sw state. */ + swap(plane->state, plane_state); + fb = plane_state->fb; + + crtc_funcs = crtc->helper_private; + + if (crtc_funcs && crtc_funcs->atomic_begin) + crtc_funcs->atomic_begin(crtc); + + plane_funcs->atomic_update(plane); + + if (crtc_funcs && crtc_funcs->atomic_flush) + crtc_funcs->atomic_flush(crtc); + + /* There's no way to figure out whether the crtc is running. */ + ret = drm_crtc_vblank_get(crtc); + if (ret == 0) { + drm_crtc_vblank_wait(crtc); + drm_crtc_vblank_put(crtc); + } + + if (plane_funcs->cleanup_fb && fb) + plane_funcs->cleanup_fb(plane, fb); +fail: + kfree(plane_state); + + return ret; +} +EXPORT_SYMBOL(drm_plane_helper_update); + +/** + * drm_primary_helper_disable() - Helper for primary plane disable +
[PATCH 12/19] drm: Atomic crtc/connector updates using crtc helper interfaces
So this is finally the integration of the crtc helper interfaces into the atomic helper functions. In the check function we now have a few steps: - First we update the output routing and figure out which crtcs need a full mode set. Suitable encoders are selected using ->best_encoder, with the same semantics as the crtc helpers of implicitly disabling all connectors currently using the encoder. - Then we pull all other connectors into the state update which feed from a crtc which changes. This must be done do catch mode changes and similar updates - atomic updates are differences on top of the current state. - Then we call all the various ->mode_fixup to compute the adjusted mode. Note that here we have a slight semantic difference compared to the crtc helpers: We have not yet updated the encoder->crtc link when calling the encoder's ->mode_fixup function. But that's a requirement when converting to atomic since we want to prepare the entire state completely contained with the over drm_atomic_state structure. So this must be carefully checked when converting drivers over to atomic helpers. - Finally we do call the atomic_check functions on planes and crtcs. The commit function is also quite a beast: - The only step that can fail is done first, namely pinning the framebuffers. After that we cross the point of no return, an async commit would push all that into the worker thread. - The disabling of encoders and connectors is a bit tricky, since depending upon the final state we need to select different crtc helper functions. - Software tracking is a bit clarified compared to the crtc helpers: We commit the software state before starting to touch the hardware, like crtc helpers. But since we just swap them we still have the old state (i.e. the current hw state) around, which is really handy to write simple disable functions. So no more drm_crtc_helper_disable_all_unused_functions kind of fun because we're leaving unused crtcs/encoders behind. Everything gets shut down in-order now, which is one of the key differences of the i915 helpers compared to crtc helpers and a really nice additional guarantee. - Like with the plane helpers the atomic commit function waits for one vblank to pass before calling the framebuffer cleanup function. Compared to Rob's helper approach there's a bunch of upsides: - All the interfaces which can fail are called in the ->check hook (i.e. ->best_match and the various ->mode_fixup hooks). This means that drivers can just reuse those functions and don't need to move everything into ->atomic_check callbacks. If drivers have no need for additional constraint checking beyong their existing crtc helper callbacks they don't need to do anything. - The actual commit operation is properly stage: First we prepare framebuffers, which can potentially still fail (due to memory exhausting). This is important for the async case, where this must be done synchronously to correctly return errors. - The output configuration changes (done with crtc helper functions) and the plane update (using atomic plane helpers) are correctly interleaved: First we shut down any crtcs that need changing, then we update planes and finally we enable everything again. Hardware without GO bits must be more careful with ordering, which this sequence enables. - Also for hardware with shared output resources (like display PLLs) we first must shut down the old configuration before we can enable the new one. Otherwise we can hit an impossible intermediate state where there's not enough PLLs (which is the point behind atomic updates). v2: - Ensure that users of ->check update crtc_state->enable correctly. - Update the legacy state in crtc/plane structures. Eventually we want to remove that, but for now the drm core still expects this (especially the plane->fb pointer). v3: A few changes for better async handling: - Reorder the software side state commit so that it happens all before we touch the hardware. This way async support becomes very easy since we can punt all the actual hw touching to a worker thread. And as long as we synchronize with that thread (flushing or cancelling, depending upon what the driver can handle) before we commit the next software state there's no need for any locking in the worker thread at all. Which greatly simplifies things. And as long as we synchronize with all relevant threads we can have a lot of them (e.g. per-crtc for per-crtc updates) running in parallel. - Expose pre/post plane commit steps separately. We need to expose the actual hw commit step anyway for drivers to be able to implement asynchronous commit workers. But if we expose pre/post and plane commit steps individually we allow drivers to selectively use atomic helpers. - I've forgotten to call encoder/bridge ->mode_set functions, fix this. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm
[PATCH 11/19] drm/crtc-helper: Transitional functions using atomic plane helpers
These two functions allow drivers to reuse their atomic plane helpers functions for the primary plane to implement the interfaces required by the crtc helpers for the legacy ->set_config callback. This is purely transitional and won't be used once the driver is fully converted. But it allows partial conversions to the atomic plane helpers which are functional. v2: - Use ->atomic_duplicate_state if available. - Don't forget to run crtc_funcs->atomic_check. v3: Shift source coordinates correctly for 16.16 fixed point. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc_helper.c | 138 ++ include/drm/drm_crtc.h| 3 + include/drm/drm_crtc_helper.h | 7 ++ 3 files changed, 148 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 6c65a0a28fbd..751dcc9ba163 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -38,6 +38,7 @@ #include #include #include +#include #include MODULE_AUTHOR("David Airlie, Jesse Barnes"); @@ -888,3 +889,140 @@ void drm_helper_resume_force_mode(struct drm_device *dev) drm_modeset_unlock_all(dev); } EXPORT_SYMBOL(drm_helper_resume_force_mode); + +/** + * drm_helper_crtc_mode_set - mode_set implementation for atomic plane helpers + * + * This function implements a callback useable as the ->mode_set callback + * required by the crtc helpers. Besides the atomic plane helper functions for + * the primary plane the driver must also provide the ->mode_set_nofb callback + * to set up the crtc. + * + * This is a transitional helper useful for converting drivers to the atomic + * interfaces. + */ +int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode, int x, int y, +struct drm_framebuffer *old_fb) +{ + struct drm_crtc_state *crtc_state; + struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; + int ret; + + if (crtc->funcs->atomic_duplicate_state) + crtc_state = crtc->funcs->atomic_duplicate_state(crtc); + else if (crtc->state) + crtc_state = kmemdup(crtc->state, sizeof(*crtc_state), +GFP_KERNEL); + else + crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL); + if (!crtc_state) + return -ENOMEM; + + crtc_state->enable = true; + crtc_state->planes_changed = true; + drm_mode_copy(&crtc_state->mode, mode); + drm_mode_copy(&crtc_state->adjusted_mode, adjusted_mode); + + if (crtc_funcs->atomic_check) { + ret = crtc_funcs->atomic_check(crtc, crtc_state); + if (ret) { + kfree(crtc_state); + + return ret; + } + } + + swap(crtc->state, crtc_state); + + crtc_funcs->mode_set_nofb(crtc); + + kfree(crtc_state); + + return drm_helper_crtc_mode_set_base(crtc, x, y, old_fb); +} +EXPORT_SYMBOL(drm_helper_crtc_mode_set); + +/** + * drm_helper_crtc_mode_set_base - mode_set_base implementation for atomic plane helpers + * + * This function implements a callback useable as the ->mode_set_base used + * required by the crtc helpers. The driver must provide the atomic plane helper + * functions for the primary plane. + * + * This is a transitional helper useful for converting drivers to the atomic + * interfaces. + */ +int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, + struct drm_framebuffer *old_fb) +{ + struct drm_plane_state *plane_state; + struct drm_plane_helper_funcs *plane_funcs; + struct drm_crtc_helper_funcs *crtc_funcs; + struct drm_plane *plane = crtc->primary; + int ret; + + if (plane->funcs->atomic_duplicate_state) + plane_state = plane->funcs->atomic_duplicate_state(plane); + else if (plane->state) + plane_state = kmemdup(plane->state, sizeof(*plane_state), + GFP_KERNEL); + else + plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL); + if (!plane_state) + return -ENOMEM; + + plane_state->crtc = crtc; + plane_state->fb = crtc->primary->fb; + plane_state->crtc_x = 0; + plane_state->crtc_y = 0; + plane_state->crtc_h = crtc->mode.hdisplay; + plane_state->crtc_w = crtc->mode.vdisplay; + plane_state->src_x = x << 16; + plane_state->src_y = y << 16; + plane_state->src_h = crtc->mode.hdisplay << 16; + plane_state->src_w = crtc->mode.hdisplay << 16; + + plane_funcs = plane->helper_private; + + if (plane_funcs->atomic_check) { + ret = plane_funcs->atomic_check(plane, plane_state); + if (ret) + goto fail; + }
[PATCH 13/19] drm: Move ->old_fb from crtc to plane
Atomic implemenations for legacy ioctls must be able to drop locks. Which doesn't cause havoc since we only do that while constructing the new state, so no driver or hardware state change has happened. The only troubling bit is the fb refcounting the core does - if someone else has snuck in then it might potentially unref an outdated framebuffer. To fix that move the old_fb temporary storage into struct drm_plane for all ioctls, so that the atomic helpers can update it. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 40 include/drm/drm_crtc.h | 8 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e33aa3a3a8a5..ff705ea3f50e 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1200,19 +1200,21 @@ EXPORT_SYMBOL(drm_plane_index); */ void drm_plane_force_disable(struct drm_plane *plane) { - struct drm_framebuffer *old_fb = plane->fb; int ret; - if (!old_fb) + if (!plane->fb) return; + plane->old_fb = plane->fb; ret = plane->funcs->disable_plane(plane); if (ret) { DRM_ERROR("failed to disable plane with busy fb\n"); + plane->old_fb = NULL; return; } /* disconnect the plane from the fb and crtc: */ - __drm_framebuffer_unreference(old_fb); + __drm_framebuffer_unreference(plane->old_fb); + plane->old_fb = NULL; plane->fb = NULL; plane->crtc = NULL; } @@ -2188,7 +2190,7 @@ static int setplane_internal(struct drm_plane *plane, uint32_t src_w, uint32_t src_h) { struct drm_device *dev = plane->dev; - struct drm_framebuffer *old_fb = NULL; + struct drm_framebuffer *old_fb; int ret = 0; unsigned int fb_width, fb_height; int i; @@ -2196,14 +2198,16 @@ static int setplane_internal(struct drm_plane *plane, /* No fb means shut it down */ if (!fb) { drm_modeset_lock_all(dev); - old_fb = plane->fb; + plane->old_fb = plane->fb; ret = plane->funcs->disable_plane(plane); if (!ret) { plane->crtc = NULL; plane->fb = NULL; } else { - old_fb = NULL; + plane->old_fb = NULL; } + old_fb = plane->old_fb; + plane->old_fb = NULL; drm_modeset_unlock_all(dev); goto out; } @@ -2245,7 +2249,7 @@ static int setplane_internal(struct drm_plane *plane, } drm_modeset_lock_all(dev); - old_fb = plane->fb; + plane->old_fb = plane->fb; ret = plane->funcs->update_plane(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h); @@ -2254,8 +2258,10 @@ static int setplane_internal(struct drm_plane *plane, plane->fb = fb; fb = NULL; } else { - old_fb = NULL; + plane->old_fb = NULL; } + old_fb = plane->old_fb; + plane->old_fb = NULL; drm_modeset_unlock_all(dev); out: @@ -2369,7 +2375,7 @@ int drm_mode_set_config_internal(struct drm_mode_set *set) * crtcs. Atomic modeset will have saner semantics ... */ list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) - tmp->old_fb = tmp->primary->fb; + tmp->primary->old_fb = tmp->primary->fb; fb = set->fb; @@ -2382,8 +2388,9 @@ int drm_mode_set_config_internal(struct drm_mode_set *set) list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { if (tmp->primary->fb) drm_framebuffer_reference(tmp->primary->fb); - if (tmp->old_fb) - drm_framebuffer_unreference(tmp->old_fb); + if (tmp->primary->old_fb) + drm_framebuffer_unreference(tmp->primary->old_fb); + tmp->primary->old_fb = NULL; } return ret; @@ -4458,7 +4465,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, { struct drm_mode_crtc_page_flip *page_flip = data; struct drm_crtc *crtc; - struct drm_framebuffer *fb = NULL, *old_fb = NULL; + struct drm_framebuffer *fb = NULL; struct drm_pending_vblank_event *e = NULL; unsigned long flags; int ret = -EINVAL; @@ -4530,7 +4537,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, (void (*) (struct drm_pending_event *)) kfree; } - old_fb = crtc->primary->fb; + crtc->primary->old_fb = crtc->primary->fb; ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags);
[PATCH 14/19] drm/atomic-helper: implementatations for legacy interfaces
Well, except page_flip since that requires async commit, which isn't there yet. For the functions which changes planes there's a bit of trickery involved to keep the fb refcounting working. But otherwise fairly straight-forward atomic updates. The property setting functions are still a bit incomplete. Once we have generic properties (e.g. rotation, but also all the properties needed by the atomic ioctl) we need to filter those out and parse them in the helper. Preferrably with the same function as used by the real atomic ioctl implementation. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 481 include/drm/drm_atomic_helper.h | 21 ++ 2 files changed, 502 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d5d2eb2908cc..1b13394cf020 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -939,3 +939,484 @@ void drm_atomic_helper_swap_state(struct drm_device *dev, } } EXPORT_SYMBOL(drm_atomic_helper_swap_state); + +/** + * drm_atomic_helper_update_plane - Helper for primary plane update using atomic + * @plane: plane object to update + * @crtc: owning CRTC of owning plane + * @fb: framebuffer to flip onto plane + * @crtc_x: x offset of primary plane on crtc + * @crtc_y: y offset of primary plane on crtc + * @crtc_w: width of primary plane rectangle on crtc + * @crtc_h: height of primary plane rectangle on crtc + * @src_x: x offset of @fb for panning + * @src_y: y offset of @fb for panning + * @src_w: width of source rectangle in @fb + * @src_h: height of source rectangle in @fb + * + * Provides a default plane update handler using the atomic driver interface. + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_helper_update_plane(struct drm_plane *plane, + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + int crtc_x, int crtc_y, + unsigned int crtc_w, unsigned int crtc_h, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h) +{ + struct drm_atomic_state *state; + struct drm_plane_state *plane_state; + int ret = 0; + + state = drm_atomic_state_alloc(plane->dev); + if (!state) + return -ENOMEM; + + state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); +retry: + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + ret = PTR_ERR(plane_state); + if (ret == -EDEADLK) + goto backoff; + else + goto fail; + } + + plane_state->crtc = crtc; + plane_state->fb = fb; + plane_state->crtc_x = crtc_x; + plane_state->crtc_y = crtc_y; + plane_state->crtc_h = crtc_h; + plane_state->crtc_w = crtc_w; + plane_state->src_x = src_x; + plane_state->src_y = src_y; + plane_state->src_h = src_h; + plane_state->src_w = src_w; + + ret = drm_atomic_commit(state); + if (ret == -EDEADLK) + goto backoff; +fail: + drm_atomic_state_free(state); + + return ret; +backoff: + drm_atomic_legacy_backoff(state); + drm_atomic_state_clear(state); + + /* +* Someone might have exchanged the framebuffer while we dropped locks +* in the backoff code. We need to fix up the fb refcount tracking the +* core does for us. +*/ + plane->old_fb = plane->fb; + + goto retry; +} +EXPORT_SYMBOL(drm_atomic_helper_update_plane); + +/** + * drm_atomic_helper_disable_plane - Helper for primary plane disable using * atomic + * @plane: plane to disable + * + * Provides a default plane disablle handler using the atomic driver interface. + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_helper_disable_plane(struct drm_plane *plane) +{ + struct drm_atomic_state *state; + struct drm_plane_state *plane_state; + int ret = 0; + + state = drm_atomic_state_alloc(plane->dev); + if (!state) + return -ENOMEM; + + state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc); +retry: + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + ret = PTR_ERR(plane_state); + if (ret == -EDEADLK) + goto backoff; + else + goto fail; + } + + plane_state->crtc = NULL; + plane_state->fb = NULL; + plane_state->crtc_x = 0; + plane_state->crtc_y = 0; + plane_state->crtc_h = 0; + plane_state->crtc_w = 0; + plane_state->src_x = 0; + plane_state->src_y = 0; + plane_state->s
[PATCH 16/19] drm/atomic-helpers: document how to implement async commit
No helper function to do it all yet provided since no driver has support for driver core fences yet. Which we'd need to make the implementation really generic. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 37 + 1 file changed, 37 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9f7c45b91fe2..423f6bcec362 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -716,6 +716,43 @@ int drm_atomic_helper_commit(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_helper_commit); /** + * DOC: Implementing async commit + * + * For now the atomic helpers don't support async commit directly. If there is + * real need it could be added though, using the dma-buf fence infrastructure + * for generic synchronization with outstanding rendering. + * + * For now drivers have to implement async commit themselves, with the following + * sequence being the recommened one: + * + * 1. Run drm_atomic_helper_prepare_planes() first. This is the only function + * which commit needs to call which can fail, so we want to run it first and + * synchronously. + * + * 2. Synchronize with any outstanding async commit worker threads which might + * affect the new state update. This can be done by either cancelling or + * flushing the work items, depending upon whether the driver can deal with + * cancelled updates. Note that it is important to ensure that the framebuffer + * cleanup is still done when cancelling. + * + * For sufficient parallelism it is recommended to have a work item per crtc + * (for updates which don't touch global state) and a global one. Then we only + * need to synchronize with the crtc work items for changed crtcs and the global + * work item, which allows nice concurrent updates on disjoint sets of crtcs. + * + * 3. The software state is updated synchronously with + * drm_atomic_helper_swap_state. Doing this under the protection of all modeset + * locks means concurrent callers never see inconsistent state. And doing this + * while it's guranateed that no relevant async worker runs means that async + * workers do not need grab any locks. Actually they must not grab locks, for + * otherwise the work flushing will deadlock. + * + * 4. Schedule a work item to do all subsequent steps, using the split-out + * commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and + * then cleaning up the framebuffers after one vblank has passed. + */ + +/** * drm_atomic_helper_prepare_planes - prepare plane resources after commit * @dev: DRM device * @state: atomic state object with old state structures -- 2.0.1
[PATCH 17/19] drm/atomic-helper: implement ->page_flip
Currently there is no way to implement async flips using atomic, that essentially requires us to be able to cancel pending requests mid-flight. To be able to do that (and I guess we want this since vblank synced updates whic opportunistically cancel still pending updates seem to be wanted) we'd need to add a mandatory cancellation mode. Depending upon the exact semantics we decide upon that could mean that userspace will not get completion events, or will get them all stacked up. So reject async updates for now. Also async updates usually means not vblank synced at all, and I guess for drivers which want to support this they should simply add a special pageflip handler (since usually you need a special flip cmd to achieve this). That kind of async flip is pretty much exclusively just used for games and benchmarks where dropping just one frame means you'll get a headshot or something bad like that ... And so slight amounts of tearing is acceptable. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 84 + include/drm/drm_atomic_helper.h | 5 +++ 2 files changed, 89 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 423f6bcec362..b1ef7a1e038c 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1463,3 +1463,87 @@ backoff: goto retry; } EXPORT_SYMBOL(drm_atomic_helper_connector_set_property); + +/** + * drm_atomic_helper_set_config - set a new config from userspace + * @crtc: DRM crtc + * @fb: DRM framebuffer + * @event: optional DRM event to signal upon completion + * @flags: flip flags for non-vblank sync'ed updates + * + * Provides a default page flip using the atomic driver interface. + * + * Note that for now so called async page flips (i.e. updates which are not + * synchronized to vblank) are not supported, since the atomic interfaces have + * no provisions for this yet. + * + * Returns: + * Returns 0 on success, negative errno numbers on failure. + */ +int drm_atomic_helper_page_flip(struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t flags) +{ + struct drm_plane *plane = crtc->primary; + struct drm_atomic_state *state; + struct drm_plane_state *plane_state; + struct drm_crtc_state *crtc_state; + int ret = 0; + + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) + return -EINVAL; + + state = drm_atomic_state_alloc(plane->dev); + if (!state) + return -ENOMEM; + + state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); +retry: + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) { + ret = PTR_ERR(crtc_state); + if (ret == -EDEADLK) + goto backoff; + else + goto fail; + } + crtc_state->event = event; + + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + ret = PTR_ERR(plane_state); + if (ret == -EDEADLK) + goto backoff; + else + goto fail; + } + + plane_state->crtc = crtc; + plane_state->fb = fb; + + ret = drm_atomic_async_commit(state); + if (ret == -EDEADLK) + goto backoff; + + /* Driver takes ownership of state on successful async commit. */ + if (ret == 0) + return 0; +fail: + drm_atomic_state_free(state); + + return ret; +backoff: + drm_atomic_legacy_backoff(state); + drm_atomic_state_clear(state); + + /* +* Someone might have exchanged the framebuffer while we dropped locks +* in the backoff code. We need to fix up the fb refcount tracking the +* core does for us. +*/ + plane->old_fb = plane->fb; + + goto retry; +} +EXPORT_SYMBOL(drm_atomic_helper_page_flip); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 0f48e0ffb614..3400c2b7e6ae 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -70,5 +70,10 @@ int drm_atomic_helper_plane_set_property(struct drm_plane *plane, int drm_atomic_helper_connector_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t val); +int drm_atomic_helper_page_flip(struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event, + uint32_t flags); + #endif /* DRM_ATOMIC_HELPER_H_ */ -- 2.0.1
[PATCH 18/19] drm: trylock modest locking for fbdev panics
In the fbdev code we want to do trylocks only to avoid deadlocks and other ugly issues. Thus far we've only grabbed the overall modeset lock, but that already failed to exclude a pile of potential concurrent operations. With proper atomic support this will be worse. So add a trylock mode to the modeset locking code which attempts all locks only with trylocks, if possible. We need to track this in the locking functions themselves and can't restrict this to drivers since driver-private w/w mutexes must be treated the same way. There's still the issue that other driver private locks aren't handled here at all, but well can't have everything. With this we will at least not regress, even once atomic allows lots of concurrent kms activity. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fb_helper.c| 10 drivers/gpu/drm/drm_modeset_lock.c | 51 +++--- include/drm/drm_modeset_lock.h | 6 + 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 3144db9dc0f1..66a438ab4e7f 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -419,11 +419,11 @@ static bool drm_fb_helper_force_kernel_mode(void) if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) continue; - /* NOTE: we use lockless flag below to avoid grabbing other -* modeset locks. So just trylock the underlying mutex -* directly: + /* +* NOTE: Use trylock mode to avoid deadlocks and sleeping in +* panic context. */ - if (!mutex_trylock(&dev->mode_config.mutex)) { + if (!__drm_modeset_lock_all(dev, true)) { error = true; continue; } @@ -432,7 +432,7 @@ static bool drm_fb_helper_force_kernel_mode(void) if (ret) error = true; - mutex_unlock(&dev->mode_config.mutex); + drm_modeset_unlock_all(dev); } return error; } diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 412b396af740..42ba9ca699ad 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c @@ -56,27 +56,27 @@ */ -/** - * drm_modeset_lock_all - take all modeset locks - * @dev: drm device - * - * This function takes all modeset locks, suitable where a more fine-grained - * scheme isn't (yet) implemented. Locks must be dropped with - * drm_modeset_unlock_all. - */ -void drm_modeset_lock_all(struct drm_device *dev) +int __drm_modeset_lock_all(struct drm_device *dev, + bool trylock) { struct drm_mode_config *config = &dev->mode_config; struct drm_modeset_acquire_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (WARN_ON(!ctx)) - return; + ctx = kzalloc(sizeof(*ctx), + trylock ? GFP_ATOMIC : GFP_KERNEL); + if (!ctx) + return -ENOMEM; - mutex_lock(&config->mutex); + if (trylock) { + if (!mutex_trylock(&config->mutex)) + return -EBUSY; + } else { + mutex_lock(&config->mutex); + } drm_modeset_acquire_init(ctx, 0); + ctx->trylock_only = trylock; retry: ret = drm_modeset_lock(&config->connection_mutex, ctx); @@ -95,13 +95,29 @@ retry: drm_warn_on_modeset_not_all_locked(dev); - return; + return 0; fail: if (ret == -EDEADLK) { drm_modeset_backoff(ctx); goto retry; } + + return ret; +} +EXPORT_SYMBOL(__drm_modeset_lock_all); + +/** + * drm_modeset_lock_all - take all modeset locks + * @dev: drm device + * + * This function takes all modeset locks, suitable where a more fine-grained + * scheme isn't (yet) implemented. Locks must be dropped with + * drm_modeset_unlock_all. + */ +void drm_modeset_lock_all(struct drm_device *dev) +{ + WARN_ON(__drm_modeset_lock_all(dev, false) != 0); } EXPORT_SYMBOL(drm_modeset_lock_all); @@ -287,7 +303,12 @@ static inline int modeset_lock(struct drm_modeset_lock *lock, WARN_ON(ctx->contended); - if (interruptible && slow) { + if (ctx->trylock_only) { + if (!ww_mutex_trylock(&lock->mutex)) + return -EBUSY; + else + return 0; + } else if (interruptible && slow) { ret = ww_mutex_lock_slow_interruptible(&lock->mutex, &ctx->ww_ctx); } else if (interruptible) { ret = ww_mutex_lock_interruptible(&lock->mutex, &ctx->ww_ctx); diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h index d38e1508f11a..a3f736d24382 100644 --- a/include/drm/drm_modeset
[PATCH 19/19] drm/atomic-helpers: functions for state duplicate/destroy/reset
The atomic users and helpers assume that there is always a obj->state structure around. Which means drivers need to somehow create that at driver load time. Also it should obviously reset hardware state, so needs to be reset upon resume. Finally the destroy/duplicate_state functions are an awful lot of boilerplate if the driver doesn't need anything beyond the default state objects. So add helper functions for all of this. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 21 + include/drm/drm_atomic_helper.h | 19 +++ 2 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index b1ef7a1e038c..9e188605f72f 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1547,3 +1547,24 @@ backoff: goto retry; } EXPORT_SYMBOL(drm_atomic_helper_page_flip); + +void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc) +{ + kfree(crtc->state); + crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL); +} +EXPORT_SYMBOL(drm_atomic_helper_crtc_reset); + +struct drm_crtc_state * +drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc) +{ + return kmemdup(crtc->state, sizeof(*crtc->state), GFP_KERNEL); +} +EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); + +void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + kfree(state); +} +EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 3400c2b7e6ae..dccc44065abf 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -75,5 +75,24 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, struct drm_pending_vblank_event *event, uint32_t flags); +/* default implementations for state handling */ +void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); +struct drm_crtc_state * +drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc); +void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state); + +void drm_atomic_helper_plane_reset(struct drm_plane *plane); +struct drm_plane_state * +drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane); +void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, + struct drm_plane_state *state); + +void drm_atomic_helper_connector_reset(struct drm_connector *connector); +struct drm_connector_state * +drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector); +void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, + struct drm_connector_state *state); + #endif /* DRM_ATOMIC_HELPER_H_ */ -- 2.0.1
[PATCH 15/19] drm/plane-helper: Add async mode to prepare_fb
Currently all helpers use ->prepare_fb for synchronous state updates, so we need the driver callback to wait for any outstanding rendering. But with async commit we really only want to reserve the framebuffer, but not stall for rendering. That should be done in the asynchronous worker. So add a boolean for this. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 12 +--- drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/drm_plane_helper.c | 4 ++-- include/drm/drm_atomic_helper.h | 3 ++- include/drm/drm_plane_helper.h | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 1b13394cf020..9f7c45b91fe2 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -673,7 +673,7 @@ int drm_atomic_helper_commit(struct drm_device *dev, if (async) return -EBUSY; - ret = drm_atomic_helper_prepare_planes(dev, state); + ret = drm_atomic_helper_prepare_planes(dev, state, false); if (ret) return ret; @@ -719,16 +719,22 @@ EXPORT_SYMBOL(drm_atomic_helper_commit); * drm_atomic_helper_prepare_planes - prepare plane resources after commit * @dev: DRM device * @state: atomic state object with old state structures + * @async: asynchronous commit * * This function prepares plane state, specifically framebuffers, for the new * configuration. If any failure is encountered this function will call * ->cleanup_fb on any already successfully prepared framebuffer. * + * If @async is true the driver callbacks should not wait for outstanding + * render, but instead ensure that the asynchronous commit work item is stalled + * sufficiently long. + * * Returns: * 0 on success, negative error code on failure. */ int drm_atomic_helper_prepare_planes(struct drm_device *dev, -struct drm_atomic_state *state) +struct drm_atomic_state *state, +bool async) { int nplanes = dev->mode_config.num_total_plane; int ret, i; @@ -746,7 +752,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, fb = state->plane_states[i]->fb; if (fb && funcs->prepare_fb) { - ret = funcs->prepare_fb(plane, fb); + ret = funcs->prepare_fb(plane, fb, async); if (ret) goto fail; } diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7e838104e72e..1382842782f3 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -993,7 +993,7 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, plane_state->fb); + ret = plane_funcs->prepare_fb(plane, plane_state->fb, false); if (ret) goto fail; } diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 7befbf017afe..6903f50012c5 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -435,7 +435,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, fb); + ret = plane_funcs->prepare_fb(plane, fb, false); if (ret) goto fail; } @@ -514,7 +514,7 @@ int drm_plane_helper_disable(struct drm_plane *plane) } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, fb); + ret = plane_funcs->prepare_fb(plane, fb, false); if (ret) goto fail; } diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 8cd6fe7a48e5..0f48e0ffb614 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -40,7 +40,8 @@ void drm_atomic_helper_commit_post_planes(struct drm_device *dev, struct drm_atomic_state *old_state); int drm_atomic_helper_prepare_planes(struct drm_device *dev, -struct drm_atomic_state *state); +struct drm_atomic_state *state, +bool async); void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *state); void drm_atomic_helper_cleanup_planes(struct drm_device *dev, diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index a6f3a8ed3394..48543149055b 100644 --- a/include/drm/drm_plane_helper.h +++
[PATCH V6 0/8] drm/exynos: few patches to enhance bridge chip support
Hi Ajay, Am 25.07.2014 21:22, schrieb Ajay Kumar: > This series is based on exynos-drm-next branch of Inki Dae's tree at: > git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git > > I have tested this after adding few DT changes for exynos5250-snow, > exynos5420-peach-pit and exynos5800-peach-pi boards. I'm trying to test this with a modified exynos5250-spring DT based off kgene's for-next branch due to DT, and I run into the following: CC drivers/gpu/drm/bridge/ptn3460.o drivers/gpu/drm/bridge/ptn3460.c: In function ?ptn3460_post_encoder_init?: drivers/gpu/drm/bridge/ptn3460.c:275:2: error: implicit declaration of function ?drm_connector_register? [-Werror=implicit-function-declaration] drm_connector_register(&ptn_bridge->connector); ^ cc1: some warnings being treated as errors scripts/Makefile.build:257: recipe for target 'drivers/gpu/drm/bridge/ptn3460.o' failed make[4]: *** [drivers/gpu/drm/bridge/ptn3460.o] Error 1 scripts/Makefile.build:404: recipe for target 'drivers/gpu/drm/bridge' failed make[3]: *** [drivers/gpu/drm/bridge] Error 2 make[3]: *** Warte auf noch nicht beendete Prozesse... scripts/Makefile.build:404: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:404: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2 Makefile:899: recipe for target 'drivers' failed make: *** [drivers] Error 2 Any hint which prerequisite I'm missing? Didn't spot it in Inki's tree, and it must be new since v4. Thanks, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg
[PATCH 1/8] all: include config.h only when available and use its defines
... rather than explicitly redefining HAVE_STDINT_H and _GNU_SOURCE. Signed-off-by: Emil Velikov --- intel/test_decode.c | 5 +++-- libkms/api.c | 2 ++ libkms/dumb.c | 4 +++- libkms/exynos.c | 4 +++- libkms/intel.c| 4 +++- libkms/linux.c| 2 ++ libkms/nouveau.c | 4 +++- libkms/radeon.c | 4 +++- libkms/vmwgfx.c | 4 +++- tests/drmstat.c | 2 ++ tests/modetest/buffers.c | 2 ++ tests/modetest/cursor.c | 2 ++ tests/modetest/modetest.c | 2 ++ tests/vbltest/vbltest.c | 2 ++ 14 files changed, 35 insertions(+), 8 deletions(-) diff --git a/intel/test_decode.c b/intel/test_decode.c index b710f34..bef9d99 100644 --- a/intel/test_decode.c +++ b/intel/test_decode.c @@ -21,7 +21,9 @@ * IN THE SOFTWARE. */ -#define _GNU_SOURCE +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -33,7 +35,6 @@ #include #include -#include "config.h" #include "intel_bufmgr.h" #include "intel_chipset.h" diff --git a/libkms/api.c b/libkms/api.c index 5befaa0..b512c42 100644 --- a/libkms/api.c +++ b/libkms/api.c @@ -26,7 +26,9 @@ **/ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include #include diff --git a/libkms/dumb.c b/libkms/dumb.c index 440efb3..794282f 100644 --- a/libkms/dumb.c +++ b/libkms/dumb.c @@ -26,7 +26,9 @@ **/ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/libkms/exynos.c b/libkms/exynos.c index 93e36a1..243915b 100644 --- a/libkms/exynos.c +++ b/libkms/exynos.c @@ -11,7 +11,9 @@ * option) any later version. */ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/libkms/intel.c b/libkms/intel.c index abae452..92f1cf2 100644 --- a/libkms/intel.c +++ b/libkms/intel.c @@ -26,7 +26,9 @@ **/ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/libkms/linux.c b/libkms/linux.c index 9b4f29e..17e1d58 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -30,7 +30,9 @@ */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include #include diff --git a/libkms/nouveau.c b/libkms/nouveau.c index 608092f..2de827d 100644 --- a/libkms/nouveau.c +++ b/libkms/nouveau.c @@ -26,7 +26,9 @@ **/ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/libkms/radeon.c b/libkms/radeon.c index f5e382a..29375c4 100644 --- a/libkms/radeon.c +++ b/libkms/radeon.c @@ -26,7 +26,9 @@ **/ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c index d594b3b..598f383 100644 --- a/libkms/vmwgfx.c +++ b/libkms/vmwgfx.c @@ -26,7 +26,9 @@ **/ -#define HAVE_STDINT_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #define _FILE_OFFSET_BITS 64 #include diff --git a/tests/drmstat.c b/tests/drmstat.c index c51cbc6..5935d07 100644 --- a/tests/drmstat.c +++ b/tests/drmstat.c @@ -28,7 +28,9 @@ * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 8206ce3..29b520d 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -24,7 +24,9 @@ * IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include diff --git a/tests/modetest/cursor.c b/tests/modetest/cursor.c index 7077f20..60f240a 100644 --- a/tests/modetest/cursor.c +++ b/tests/modetest/cursor.c @@ -22,7 +22,9 @@ * IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 7d436b5..92efb82 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -37,7 +37,9 @@ * TODO: use cairo to write the mode info on the selected output once * the mode has been programmed, along with possible test patterns. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 2a09d28..50e29dc 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -37,7 +37,9 @@ * TODO: use cairo to write the mode info on the selected output once * the mode has been programmed, along with possible tes
[PATCH 2/8] libkms: remove explicit define _FILE_OFFSET_BITS 64
configure.ac has AC_SYS_LARGEFILE which provides the define and/or approapriate magic when required. Signed-off-by: Emil Velikov --- libkms/dumb.c| 1 - libkms/exynos.c | 1 - libkms/intel.c | 1 - libkms/nouveau.c | 1 - libkms/radeon.c | 1 - libkms/vmwgfx.c | 1 - 6 files changed, 6 deletions(-) diff --git a/libkms/dumb.c b/libkms/dumb.c index 794282f..5702543 100644 --- a/libkms/dumb.c +++ b/libkms/dumb.c @@ -29,7 +29,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include diff --git a/libkms/exynos.c b/libkms/exynos.c index 243915b..92e329c 100644 --- a/libkms/exynos.c +++ b/libkms/exynos.c @@ -14,7 +14,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include diff --git a/libkms/intel.c b/libkms/intel.c index 92f1cf2..b006ea4 100644 --- a/libkms/intel.c +++ b/libkms/intel.c @@ -29,7 +29,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include diff --git a/libkms/nouveau.c b/libkms/nouveau.c index 2de827d..15c012e 100644 --- a/libkms/nouveau.c +++ b/libkms/nouveau.c @@ -29,7 +29,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include diff --git a/libkms/radeon.c b/libkms/radeon.c index 29375c4..938321b 100644 --- a/libkms/radeon.c +++ b/libkms/radeon.c @@ -29,7 +29,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c index 598f383..08163a1 100644 --- a/libkms/vmwgfx.c +++ b/libkms/vmwgfx.c @@ -29,7 +29,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#define _FILE_OFFSET_BITS 64 #include #include -- 2.0.2
[PATCH 0/8] Upstreaming the Android build and misc fixes
Hello list, Recently I've had a go at the Anroid builds and I felt ... inspired that there are (at least) two downstream repositories that have the relevant Android build, yet all of them use 6+month old libdrm. Making even builds a pain in the neck :'( Are there any objections if we get the android build upstream ? AFAICS it's nicely isolated from everything else + I've managed to reuse all the source/headers lists. Note that the series lacks a couple of patches from the downstream repos, yet adds support for radeon, nouveau and freedreno :) The missing fixes are - s/mmap/mmap64/, dma-bufs support + other intel specific "hacks". If people are happy with the series then we can take a look at the final bits. Cheers, Emil
[PATCH 3/8] libdrm, freedreno, intel, nouveau, radeon: add Makefile.sources
Will be used to consolidate the required sources lists as well as the install-able headers. This is turn will help us to avoid the duplication with the upcoming Android build support. Signed-off-by: Emil Velikov --- Makefile.am | 13 - Makefile.sources | 12 freedreno/Makefile.am| 24 +++- freedreno/Makefile.sources | 24 include/drm/Makefile.am | 20 include/drm/Makefile.sources | 18 ++ intel/Makefile.am| 16 intel/Makefile.sources | 14 ++ nouveau/Makefile.am | 11 --- nouveau/Makefile.sources | 9 + radeon/Makefile.am | 22 -- radeon/Makefile.sources | 19 +++ 12 files changed, 119 insertions(+), 83 deletions(-) create mode 100644 Makefile.sources create mode 100644 freedreno/Makefile.sources create mode 100644 include/drm/Makefile.sources create mode 100644 intel/Makefile.sources create mode 100644 nouveau/Makefile.sources create mode 100644 radeon/Makefile.sources diff --git a/Makefile.am b/Makefile.am index 826c30d..16704df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,8 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +include Makefile.sources + ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} pkgconfigdir = @pkgconfigdir@ @@ -62,17 +64,10 @@ libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm AM_CFLAGS = \ $(VALGRIND_CFLAGS) -libdrm_la_SOURCES =\ - xf86drm.c \ - xf86drmHash.c \ - xf86drmRandom.c \ - xf86drmSL.c \ - xf86drmMode.c \ - xf86atomic.h\ - libdrm_lists.h +libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} -libdrminclude_HEADERS = xf86drm.h xf86drmMode.h +libdrminclude_HEADERS = $(LIBDRM_HEADERS) EXTRA_DIST = libdrm.pc.in include/drm/* diff --git a/Makefile.sources b/Makefile.sources new file mode 100644 index 000..fbf9635 --- /dev/null +++ b/Makefile.sources @@ -0,0 +1,12 @@ +LIBDRM_FILES := \ + xf86drm.c \ + xf86drmHash.c \ + xf86drmRandom.c \ + xf86drmSL.c \ + xf86drmMode.c \ + xf86atomic.h \ + libdrm_lists.h + +LIBDRM_HEADERS := \ + xf86drm.h \ + xf86drmMode.h diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am index 7903e5b..55de79d 100644 --- a/freedreno/Makefile.am +++ b/freedreno/Makefile.am @@ -1,4 +1,5 @@ AUTOMAKE_OPTIONS=subdir-objects +include Makefile.sources AM_CFLAGS = \ $(WARN_CFLAGS) \ @@ -12,29 +13,10 @@ libdrm_freedreno_ladir = $(libdir) libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined libdrm_freedreno_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ -libdrm_freedreno_la_SOURCES = \ - freedreno_device.c \ - freedreno_pipe.c \ - freedreno_priv.h \ - freedreno_ringbuffer.c \ - freedreno_bo.c \ - kgsl/kgsl_bo.c \ - kgsl/kgsl_device.c \ - kgsl/kgsl_drm.h \ - kgsl/kgsl_pipe.c \ - kgsl/kgsl_priv.h \ - kgsl/kgsl_ringbuffer.c \ - kgsl/msm_kgsl.h \ - msm/msm_bo.c \ - msm/msm_device.c \ - msm/msm_drm.h \ - msm/msm_pipe.c \ - msm/msm_priv.h \ - msm/msm_ringbuffer.c \ - list.h +libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES) libdrm_freedrenocommonincludedir = ${includedir}/freedreno -libdrm_freedrenocommoninclude_HEADERS = freedreno_drmif.h freedreno_ringbuffer.h +libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_HEADERS) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_freedreno.pc diff --git a/freedreno/Makefile.sources b/freedreno/Makefile.sources new file mode 100644 index 000..f78cd12 --- /dev/null +++ b/freedreno/Makefile.sources @@ -0,0 +1,24 @@ +LIBDRM_FREEDRENO_FILES := \ + freedreno_device.c \ + freedreno_pipe.c \ + freedreno_priv.h \ + freedreno_ringbuffer.c \ + freedreno_bo.c \ + kgsl/kgsl_bo.c \ + kgsl/kgsl_device.c \ + kgsl/kgsl_drm.h \ + kgsl/kgsl_pipe.c \ + kgsl/kgsl_priv.h \ + kgsl/kgsl_ringbuffer.c \ + kgsl/msm_kgsl.h \ + msm/msm_bo.c \ + msm/msm_device.c \ + msm/msm_drm.h \ + msm/msm_pipe.c \ + msm/msm_priv.h \ + msm/msm_ringbuffer.c \ + list.h + +LIBDRM_FREEDRENO_HEADERS := \ + freedreno_drmif.h \ + freedreno_ringbuffer.h diff --git a/include/drm/Makefile.am b/include/drm/Makefile.am index 2bc34d2..83b1eae 100644 --- a/include/drm/Makefile.am +++ b/include/drm/Makefile.am @@ -22,23 +22,11 @@ # however, r300 and via need their reg headers installed in o
[PATCH 4/8] libdrm,intel: Add Android build
Contains the following patches squashed in: commit f340a8b9f2b84d5762553bef046914e0bde20795 Author: Chad Versace Date: Wed, 21 Dec 2011 11:43:57 -0800 libdrm,intel: Add Android makefiles (v2) This enables libdrm.so and libdrm_intel.so to build on Android IceCreamSandwich. v2: Link libdrm_intel to libpciaccess. Change-Id: Ie5ed4bc0e6b4f9f819e3ec44488e385c35e97128 Signed-off-by: Chad Versace commit 8fb3f42389dea34218ed1fe59550ec2abb4d6953 Author: Andrew Boie Date: Wed, 26 Sep 2012 13:32:05 -0700 libdrm, libdrm_intel: Skip driver name checks These libraries have 'optional' tags, which means they won't get built unless something else depends on them or they are added to PRODUCT_PACKAGES. There's no need for additional filtering. Change-Id: I5d90969f38671f8144c0dc27d47144b3f09a15ce Signed-off-by: Andrew Boie --- Android.mk | 45 + intel/Android.mk | 50 ++ 2 files changed, 95 insertions(+) create mode 100644 Android.mk create mode 100644 intel/Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 000..afe59ce --- /dev/null +++ b/Android.mk @@ -0,0 +1,45 @@ +# +# Copyright ? 2011 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LIBDRM_TOP := $(LOCAL_PATH) + +# Import variables LIBDRM_FILES, LIBDRM_HEADERS +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libdrm +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(LIBDRM_FILES) + +LOCAL_C_INCLUDES := \ + $(LIBDRM_TOP)/include/drm + +LOCAL_CFLAGS := \ + -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +include $(BUILD_SHARED_LIBRARY) + +include $(LOCAL_PATH)/intel/Android.mk diff --git a/intel/Android.mk b/intel/Android.mk new file mode 100644 index 000..5c48a95 --- /dev/null +++ b/intel/Android.mk @@ -0,0 +1,50 @@ +# +# Copyright ? 2011 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Import variables LIBDRM_INTEL_FILES, LIBDRM_INTEL_HEADERS +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libdrm_intel +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) + +LOCAL_C_INCLUDES := \ + $(LIBDRM_TOP) \ + $(LIBDRM_TOP)/intel \ + $(LIBDRM_TOP)/include/drm \ + external/libpciaccess/include + +LOCAL_CFLAGS := \ + -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_SHARED_LIBRARIES := \ + libdrm \ + libpciaccess + +include $(BUILD_SHARED_LIBRARY) -- 2.0.2
[PATCH 5/8] libdrm,intel: rework android header handling
Contains the following patches squashed in: commit 99247a5bd724ddcf0f06a5518baad207c53f1e2b Author: Haitao Huang Date: Fri, 27 Apr 2012 13:20:53 -0500 Android.mk: use LOCAL_COPY_HEADERS to export headers. Export necessary header files used by other components for Android, such as libva intel-driver, gralloc, hwcomposer, etc. Change-Id: I2feabf6941379ef4d756e942f30eba059de641f1 Signed-off-by: Haitao Huang [chad: Fixed inconsistent indentation.] Signed-off-by: Chad Versace commit 7d0b528cb69995d7ea4e29b2daa1e3b28a362f42 Author: Emil Velikov Date: Sun, 27 Jul 2014 18:22:41 +0100 android: reuse headers lists, separate libdrm from intel headers Rather than having a duplicate copy of the headers list(s), reuse the existing one(s). Distinguish that the intel headers should be copied when libdrm_intel is used. Signed-off-by: Emil Velikov commit 361de3ba4cadd5357596d1537bb3f216d281532b Author: Piotr Luc Date: Fri, 14 Jun 2013 13:00:39 +0200 Export include dir from libdrm BZ: 116218 Google introduced new method of specifying include path(s) between modules. This allows a module to include header from a library without directly specifyining by includer the path where headers are located. The method requires from library that holds headers to export include path(s) in LOCAL_EXPORT_C_INCLUDE_DIRS variable. These exported include path(s) are automatically added to include path(s) of modules that have name of the library in the LOCAL_SHARED_LIBRARIES or LOCAL_STATIC_LIBRARIES list. This change sets LOCAL_EXPORT_C_INCLUDE_DIRS to folders that contain headers file that used by other modules in order to export these paths. Change-Id: Id1ac885b31ef2efe194e0289fbcaecd9eb533df0 Signed-off-by: Piotr Luc Reviewed-on: http://android.intel.com:8080/113562 Reviewed-by: cactus Reviewed-by: Luc, Piotr Reviewed-by: Purushothaman, Vijay A Reviewed-by: Stimson, Dale B Tested-by: Stimson, Dale B Reviewed-by: buildbot Tested-by: buildbot commit 2bf22fcbd4cbb9e7c7764d5eff0bb4e75ab1a005 Author: Emil Velikov Date: 27 Jul 2014 18:27:21 +0100 android: Separate libdrm and intel LOCAL_EXPORT_C_INCLUDE_DIRS Signed-off-by: Emil Velikov --- Android.mk | 13 - intel/Android.mk | 5 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index afe59ce..ec340b4 100644 --- a/Android.mk +++ b/Android.mk @@ -1,5 +1,5 @@ # -# Copyright ? 2011 Intel Corporation +# Copyright ? 2011-2012 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -28,11 +28,16 @@ LIBDRM_TOP := $(LOCAL_PATH) # Import variables LIBDRM_FILES, LIBDRM_HEADERS include $(LOCAL_PATH)/Makefile.sources +# Import variables LIBDRM_INCLUDE_HEADERS, LIBDRM_INCLUDE_VMWGFX_HEADERS +include $(LOCAL_PATH)/include/drm/Makefile.sources LOCAL_MODULE := libdrm LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(LIBDRM_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS += \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/include/drm LOCAL_C_INCLUDES := \ $(LIBDRM_TOP)/include/drm @@ -40,6 +45,12 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := \ -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_COPY_HEADERS := \ + $(LIBDRM_HEADERS) \ + $(addprefix include/drm/,$(LIBDRM_INCLUDE_HEADERS)) \ + $(addprefix include/drm/,$(LIBDRM_INCLUDE_VMWGFX_HEADERS)) + +LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/intel/Android.mk diff --git a/intel/Android.mk b/intel/Android.mk index 5c48a95..8f6d6e3 100644 --- a/intel/Android.mk +++ b/intel/Android.mk @@ -33,6 +33,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := libdrm LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS += \ + $(LOCAL_PATH)/intel LOCAL_C_INCLUDES := \ $(LIBDRM_TOP) \ @@ -43,6 +45,9 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := \ -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_COPY_HEADERS := $(LIBDRM_INTEL_HEADERS) +LOCAL_COPY_HEADERS_TO := libdrm + LOCAL_SHARED_LIBRARIES := \ libdrm \ libpciaccess -- 2.0.2
[PATCH 6/8] radeon: add Android build support
Signed-off-by: Emil Velikov --- Android.mk| 1 + radeon/Android.mk | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 radeon/Android.mk diff --git a/Android.mk b/Android.mk index ec340b4..b3fbb5b 100644 --- a/Android.mk +++ b/Android.mk @@ -54,3 +54,4 @@ LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/intel/Android.mk +include $(LOCAL_PATH)/radeon/Android.mk diff --git a/radeon/Android.mk b/radeon/Android.mk new file mode 100644 index 000..8c267df --- /dev/null +++ b/radeon/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Import variables LIBDRM_RADEON_FILES, LIBDRM_RADEON_HEADERS +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libdrm_radeon +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS += \ + $(LOCAL_PATH)/radeon + +LOCAL_C_INCLUDES := \ + $(LIBDRM_TOP) \ + $(LIBDRM_TOP)/radeon \ + $(LIBDRM_TOP)/include/drm + +LOCAL_CFLAGS := \ + -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_COPY_HEADERS := $(LIBDRM_RADEON_HEADERS) +LOCAL_COPY_HEADERS_TO := libdrm + +LOCAL_SHARED_LIBRARIES := \ + libdrm + +include $(BUILD_SHARED_LIBRARY) -- 2.0.2
[PATCH 8/8] freedreno: add Android build support
Cc: freedreno at lists.freedesktop.org Signed-off-by: Emil Velikov --- Android.mk | 1 + freedreno/Android.mk | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 freedreno/Android.mk diff --git a/Android.mk b/Android.mk index eb54bf7..b3bf411 100644 --- a/Android.mk +++ b/Android.mk @@ -53,6 +53,7 @@ LOCAL_COPY_HEADERS := \ LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY) +include $(LOCAL_PATH)/freedreno/Android.mk include $(LOCAL_PATH)/intel/Android.mk include $(LOCAL_PATH)/nouveau/Android.mk include $(LOCAL_PATH)/radeon/Android.mk diff --git a/freedreno/Android.mk b/freedreno/Android.mk new file mode 100644 index 000..e91b623 --- /dev/null +++ b/freedreno/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Import variables LIBDRM_FREEDRENO_FILES, LIBDRM_FREEDRENO_HEADERS +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libdrm_freedreno +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS += \ + $(LOCAL_PATH)/freedreno + +LOCAL_C_INCLUDES := \ + $(LIBDRM_TOP) \ + $(LIBDRM_TOP)/freedreno \ + $(LIBDRM_TOP)/include/drm + +LOCAL_CFLAGS := \ + -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_COPY_HEADERS := $(LIBDRM_FREEDRENO_HEADERS) +LOCAL_COPY_HEADERS_TO := libdrm + +LOCAL_SHARED_LIBRARIES := \ + libdrm + +include $(BUILD_SHARED_LIBRARY) -- 2.0.2
[PATCH 7/8] nouveau: add Android build support
Signed-off-by: Emil Velikov --- Android.mk | 1 + nouveau/Android.mk | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 nouveau/Android.mk diff --git a/Android.mk b/Android.mk index b3fbb5b..eb54bf7 100644 --- a/Android.mk +++ b/Android.mk @@ -54,4 +54,5 @@ LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/intel/Android.mk +include $(LOCAL_PATH)/nouveau/Android.mk include $(LOCAL_PATH)/radeon/Android.mk diff --git a/nouveau/Android.mk b/nouveau/Android.mk new file mode 100644 index 000..28350bd --- /dev/null +++ b/nouveau/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Import variables LIBDRM_NOUVEAU_FILES, LIBDRM_NOUVEAU_HEADERS +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libdrm_nouveau +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS += \ + $(LOCAL_PATH)/nouveau + +LOCAL_C_INCLUDES := \ + $(LIBDRM_TOP) \ + $(LIBDRM_TOP)/nouveau \ + $(LIBDRM_TOP)/include/drm + +LOCAL_CFLAGS := \ + -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_COPY_HEADERS := $(LIBDRM_NOUVEAU_HEADERS) +LOCAL_COPY_HEADERS_TO := libdrm + +LOCAL_SHARED_LIBRARIES := \ + libdrm + +include $(BUILD_SHARED_LIBRARY) -- 2.0.2
[PATCH] drm/radeon: adjust default radeon_vm_block_size v2
On Sat, Jul 26, 2014 at 9:34 AM, Christian K?nig wrote: > Hey Alex, > > can you use this version instead of the one you already have in > drm-next-3.17-wip? It depends on a change from drm-fixes-3.16, so you need > to merge (or rebase) your -next branch to apply it. > > Apart from that I also have a couple of more VM changes for 3.17, but those > need a merge with the latest 3.16 fixes as well. > Ok. I'll drop the patch for now. I'll send a pull with all the additional patches that depend on fixes once Dave merges it. Alex > Thanks, > Christian. > > Am 19.07.2014 um 13:55 schrieb Christian K?nig: > >> From: Christian K?nig >> >> v2: rebase on vm_size scale change. Adjust vm_size default to 8, >> Better handle the default and smaller values. >> >> Signed-off-by: Christian K?nig >> --- >> drivers/gpu/drm/radeon/radeon_device.c | 14 +- >> drivers/gpu/drm/radeon/radeon_drv.c| 6 +++--- >> 2 files changed, 16 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/radeon_device.c >> b/drivers/gpu/drm/radeon/radeon_device.c >> index a8537d7..38e13b0 100644 >> --- a/drivers/gpu/drm/radeon/radeon_device.c >> +++ b/drivers/gpu/drm/radeon/radeon_device.c >> @@ -1077,7 +1077,19 @@ static void radeon_check_arguments(struct >> radeon_device *rdev) >> /* defines number of bits in page table versus page directory, >> * a page is 4KB so we have 12 bits offset, minimum 9 bits in the >> * page table and the remaining bits are in the page directory */ >> - if (radeon_vm_block_size < 9) { >> + if (radeon_vm_block_size == -1) { >> + >> + /* Total bits covered by PD + PTs */ >> + unsigned bits = ilog2(radeon_vm_size) + 17; >> + >> + /* Make sure the PD is 4K in size up to 8GB address space. >> + Above that split equal between PD and PTs */ >> + if (radeon_vm_size <= 8) >> + radeon_vm_block_size = bits - 9; >> + else >> + radeon_vm_block_size = (bits + 3) / 2; >> + >> + } else if (radeon_vm_block_size < 9) { >> dev_warn(rdev->dev, "VM page table size (%d) to small\n", >> radeon_vm_block_size); >> radeon_vm_block_size = 9; >> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c >> b/drivers/gpu/drm/radeon/radeon_drv.c >> index e9e3610..59b74d2 100644 >> --- a/drivers/gpu/drm/radeon/radeon_drv.c >> +++ b/drivers/gpu/drm/radeon/radeon_drv.c >> @@ -173,8 +173,8 @@ int radeon_dpm = -1; >> int radeon_aspm = -1; >> int radeon_runtime_pm = -1; >> int radeon_hard_reset = 0; >> -int radeon_vm_size = 4; >> -int radeon_vm_block_size = 9; >> +int radeon_vm_size = 8; >> +int radeon_vm_block_size = -1; >> int radeon_deep_color = 0; >> MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch >> registers"); >> @@ -246,7 +246,7 @@ module_param_named(hard_reset, radeon_hard_reset, int, >> 0444); >> MODULE_PARM_DESC(vm_size, "VM address space size in gigabytes (default >> 4GB)"); >> module_param_named(vm_size, radeon_vm_size, int, 0444); >> -MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default >> 9)"); >> +MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default >> depending on vm_size)"); >> module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); >> MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = >> disable (default))"); > >