Re: [PATCH] drm/amd/powerplay: ensure loop does not wraparound on decrement
Am 17.05.2017 20:13, schrieb Colin King: > From: Colin Ian King > > The current for loop decrements i when it is zero and this causes > a wrap-around back to ~0 because i is unsigned. In the unlikely event > that mask is 0, the loop will run forever. Fix this so we can't loop > forever. > > Detected by CoverityScan, CID#1435469 ("Unsigned compared against 0") > > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > index ad30f5d3a10d..d92c9b9b15be 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c > @@ -4199,7 +4199,7 @@ static int vega10_force_clock_level(struct pp_hwmgr > *hwmgr, > } > data->smc_state_table.gfx_boot_level = i; > > - for (i = 31; i >= 0; i--) { > + for (i = 32; --i; ) { > if (mask & (1 << i)) > break; > } nitpicking: we notices at several points that programmers are bad at counting backwards. Is there a reason not to start with i=0 ? re, wh ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 14/21] drm/sun4i: tcon: multiply the vtotal when not in interlace
On Wed, May 17, 2017 at 05:50:45PM +0800, Chen-Yu Tsai wrote: > On Wed, May 17, 2017 at 3:40 PM, Maxime Ripard > wrote: > > It appears that the total vertical resolution needs to be doubled when > > we're not in interlaced. Make sure that is the case. > > > > Signed-off-by: Maxime Ripard > > --- > > drivers/gpu/drm/sun4i/sun4i_tcon.c | 25 + > > 1 file changed, 21 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > index 62e254aedb57..a0f9a8a516c7 100644 > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > @@ -153,7 +153,7 @@ static int sun4i_tcon_get_clk_delay(struct > > drm_display_mode *mode, > > void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon, > > struct drm_display_mode *mode) > > { > > - unsigned int bp, hsync, vsync; > > + unsigned int bp, hsync, vsync, vtotal; > > u8 clk_delay; > > u32 val = 0; > > > > @@ -192,9 +192,26 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon, > > DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n", > > mode->crtc_vtotal, bp); > > > > + /* > > +* The vertical resolution needs to be doubled in all > > +* cases. We could use crtc_vtotal and always multiply by two, > > +* but that leads to a rounding error in interlace when vtotal > > +* is odd. > > +* > > +* This happens with TV's PAL for example, where vtotal will > > +* be 625, crtc_vtotal 312, and thus crtc_vtotal * 2 will be > > +* 624, which apparently confuses the hardware. > > +* > > +* To work around this, we will always use vtotal, and > > +* multiply by two only if we're not in interlace. > > +*/ > > + vtotal = mode->vtotal; > > + if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) > > + vtotal = vtotal * 2; > > + > > /* Set vertical display timings */ > > regmap_write(tcon->regs, SUN4I_TCON0_BASIC2_REG, > > -SUN4I_TCON0_BASIC2_V_TOTAL(mode->crtc_vtotal * 2) | > > +SUN4I_TCON0_BASIC2_V_TOTAL(vtotal) | > > SUN4I_TCON0_BASIC2_V_BACKPORCH(bp)); > > > > /* Set Hsync and Vsync length */ > > @@ -279,9 +296,9 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, > > /* Set vertical display timings */ > > bp = mode->crtc_vtotal - mode->crtc_vsync_start; > > DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n", > > -mode->vtotal, bp); > > +mode->crtc_vtotal, bp); > > You should duplicate the logic from channel 0 to channel 1. > In fact, interlaced modes happen predominantly on channel 1, > for composite and HDMI modes. Gaah, you're right, this was obviously meant for the channel 1.. I'll resend. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [REGRESSION] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo
On Wed, May 17, 2017 at 11:08:23PM +0200, Nicolai Stange wrote: > I'm experiencing a boot failure on next-20170515: > > BUG: unable to handle kernel NULL pointer dereference at 07cb > IP: radeon_driver_load_kms+0xeb/0x230 [radeon] [snip] > Bisection lead to commit 7ffb0ce31cf9 ("drm/radeon: Don't register > Thunderbolt eGPU with vga_switcheroo"). Reverting this commit on top of > next-20170515 fixes the issue for me. > > My box is a Dell laptop which most certainly hasn't got any Thunderbolt > circuitry. Thanks a lot Nicolai for reporting this, my apologies for the breakage which turns out to be a dereference of rdev->pdev before it's set. :-( 14: e8 e7 c0 0e 00 callq 0xec100 ; radeon_has_atpx() 19: 84 c0 test %al,%al 1b: 74 9a je 0xffb7 1d: 41 f7 c5 00 00 02 00test $0x2,%r13d ; flags & RADEON_IS_IGP 24: 75 91 jne0xffb7 26: 49 8b 44 24 10 mov0x10(%r12),%rax ; rax = rdev 2b:* 0f b6 90 cb 07 00 00movzbl 0x7cb(%rax),%edx <-- trapping instruction Could you verify if the patch below fixes the issue for you? Thanks! Lukas -- >8 -- diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index e3e7cb1..4761f27 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -116,7 +116,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) if ((radeon_runtime_pm != 0) && radeon_has_atpx() && ((flags & RADEON_IS_IGP) == 0) && - !pci_is_thunderbolt_attached(rdev->pdev)) + !pci_is_thunderbolt_attached(dev->pdev)) flags |= RADEON_IS_PX; /* radeon_device_init should report only fatal error ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2 -v2] drm: drop drm_[cm]alloc* helpers
Am 17.05.2017 um 14:23 schrieb Michal Hocko: As it turned out my allyesconfig on x86_64 wasn't sufficient and 0day build machinery found a failure on arm architecture. It was clearly a typo. Now I have pushed this to my build battery with cross arch compilers and it passes so there shouldn't more surprises hopefully. Here is the v2. --- From 4a00b3ade5ca4514f7affd8de6f7119c8d5c5a86 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Tue, 16 May 2017 11:00:47 +0200 Subject: [PATCH -v2] drm: drop drm_[cm]alloc* helpers Now that drm_[cm]alloc* helpers are simple one line wrappers around kvmalloc_array and drm_free_large is just kvfree alias we can drop them and replace by their native forms. This shouldn't introduce any functional change. Changes since v1 - fix typo in drivers/gpu//drm/etnaviv/etnaviv_gem.c - noticed by 0day build robot Suggested-by: Daniel Vetter Signed-off-by: Michal Hocko Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c| 16 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 19 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +-- drivers/gpu/drm/drm_gem.c | 6 +-- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 12 ++--- drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c| 4 +- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 12 ++--- drivers/gpu/drm/exynos/exynos_drm_gem.c| 11 +++-- drivers/gpu/drm/i915/i915_debugfs.c| 4 +- drivers/gpu/drm/i915/i915_gem.c| 4 +- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 34 +++--- drivers/gpu/drm/i915/i915_gem_gtt.c| 6 +-- drivers/gpu/drm/i915/i915_gem_userptr.c| 8 ++-- drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c | 12 ++--- drivers/gpu/drm/msm/msm_gem.c | 10 ++-- drivers/gpu/drm/radeon/radeon_cs.c | 11 +++-- drivers/gpu/drm/radeon/radeon_gem.c| 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 4 +- drivers/gpu/drm/radeon/radeon_vm.c | 4 +- drivers/gpu/drm/ttm/ttm_tt.c | 13 +++--- drivers/gpu/drm/udl/udl_dmabuf.c | 2 +- drivers/gpu/drm/udl/udl_gem.c | 2 +- drivers/gpu/drm/vc4/vc4_gem.c | 15 +++--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 27 +-- include/drm/drmP.h | 1 - include/drm/drm_mem_util.h | 53 -- 26 files changed, 126 insertions(+), 173 deletions(-) delete mode 100644 include/drm/drm_mem_util.h diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index a6649874e6ce..9f0247cdda5e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -96,7 +96,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, int r; unsigned long total_size = 0; - array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry)); + array = kvmalloc_array(num_entries, sizeof(struct amdgpu_bo_list_entry), GFP_KERNEL); if (!array) return -ENOMEM; memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry)); @@ -148,7 +148,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, for (i = 0; i < list->num_entries; ++i) amdgpu_bo_unref(&list->array[i].robj); - drm_free_large(list->array); + kvfree(list->array); list->gds_obj = gds_obj; list->gws_obj = gws_obj; @@ -163,7 +163,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, error_free: while (i--) amdgpu_bo_unref(&array[i].robj); - drm_free_large(array); + kvfree(array); return r; } @@ -224,7 +224,7 @@ void amdgpu_bo_list_free(struct amdgpu_bo_list *list) amdgpu_bo_unref(&list->array[i].robj); mutex_destroy(&list->lock); - drm_free_large(list->array); + kvfree(list->array); kfree(list); } @@ -244,8 +244,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, int r; - info = drm_malloc_ab(args->in.bo_number, -sizeof(struct drm_amdgpu_bo_list_entry)); + info = kvmalloc_array(args->in.bo_number, +sizeof(struct drm_amdgpu_bo_list_entry), GFP_KERNEL); if (!info) return -ENOMEM; @@ -311,11 +311,11 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, memset(args, 0, sizeof(*args)); args->out.list_handle = handle; - drm_free_large(info); + kvfree(info); return 0; error_free: - drm_free_large(info); + kvfree(info); return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/a
Re: [PATCH 2/4] dt-bindings: Document the Raspberry Pi Touchscreen nodes.
Hi, On 05/17/2017 12:16 AM, Eric Anholt wrote: Laurent Pinchart writes: Hi Eric, On Tuesday 16 May 2017 09:47:49 Eric Anholt wrote: Rob Herring writes: On Mon, May 15, 2017 at 7:03 PM, Eric Anholt wrote: Laurent Pinchart writes: Hi Eric, Thank you for the patch. On Thursday 11 May 2017 16:56:23 Eric Anholt wrote: The Raspberry Pi 7" Touchscreen is a DPI touchscreen panel with DSI->DPI bridge and touchscreen controller integrated, that connects to the Raspberry Pi through its 15-pin "DSI" connector (some lines are DSI, some lines are I2C). This device is represented in the DT as three nodes (DSI device, I2C device, panel). Input will be left to a separate binding later, as it will be a basic I2C client device. Signed-off-by: Eric Anholt --- .../raspberrypi,7inch-touchscreen-bridge.txt | 68 ++ .../panel/raspberrypi,7inch-touchscreen-panel.txt | 7 +++ 2 files changed, 75 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/raspberrypi,7inch-touc hscreen-bridge.txt create mode 100644 Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touch screen-panel.txt diff --git a/Documentation/devicetree/bindings/display/bridge/raspberrypi,7inch-to uchscreen-bridge.txt b/Documentation/devicetree/bindings/display/bridge/raspberrypi,7inch-to uchscreen-bridge.txt new file mode 100644 index ..a5669beaf68f --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/raspberrypi,7inch-to uchscreen-bridge.txt @@ -0,0 +1,68 @@ +Official 7" (800x480) Raspberry Pi touchscreen panel's bridge. + +This DSI panel contains: + +- TC358762 DSI->DPI bridge +- Atmel microcontroller on I2C for power sequencing the DSI bridge and + controlling backlight +- Touchscreen controller on I2C for touch input + +and this covers the TC358762 bridge and Atmel microcontroller, while +../panel/raspberrypi,7inch-touchscreen-panel.txt covers the panel. The TC358762 is a standalone bridge that doesn't depend on the ATTiny microcontroller used by the RPI. As it's usable standalone, I believe this binding should be split in two. Do you have a plan for how I would implement a driver on top of that binding change, though? Note that we don't program the Toshiba directly, we only send commands to the Atmel. I agree. If it is a black box and the interface to the host is defined by the Atmel uC firmware, then that's what the DT should describe. Perhaps a diagram here or pointer to one would help and remove mentioning what kind of bridge chip it is. It's a *very* black box. I have some non-public schematics that don't even say what panel is involved, and no documentation of the uc interface. The driver code is just replicating the firmware's programming sequence. I would certainly love to be building a generic TC358762 driver, which would be a lot more satisfying. I just don't think it's doable for this panel. Given that, what do I need to do to the DT? Should I just drop mention of the Toshiba and talk about this being a bridge with a custom microcontroller firmware? I think that would be best, yes. Could you share a simple block-diagram of the hardware ? It would help turning my random advices into semi-random advices :-) In terms of physical connections: [15-pin "DSI" connector on 2835] | | | I2C | DSI | | / \SPI | [TS] [Atmel]--[TC358762] \| \PWM| \ | DPI [some backlight]--[some unknown panel] The binding I'm trying to create is to expose what's necessary for a driver that talks I2C to the Atmel, which then controls the PWM and does the command sequence over SPI to the Toshiba that sets up its end of the DSI link. The bridge (Atmel + TC358762 combination) here looks like it's primarily an i2c device (i.e, the control bus is i2c). Therefore, the drm-bridge driver here should be an i2c driver instead of a mipi_dsi_driver. We have the facility to create a mipi DSI device without the need to have a corresponding node in DT. The ADV7533 and TC358767 drivers are examples of that. The following is what the binding could look like, it's same as what Rob also mentioned previously in the thread. Thanks, Archit dsi1: dsi@7e70 { #address-cells = <1>; #size-cells = <0>; <...> /* The SoC's DSI input/output port */ ports { #address-cells = <1>; #size-cells = <0>; /* port@0 if needed */ port@1 { dsi_out_port: endpoint { reg = <1>; remote-endpoint = <&bridge_dsi_port>; }; }; }; }; i2c_dsi: i2c { compatible = "i2c-gpio"; #address-cells = <1>; #size-cells = <0>; gpios = <&gpio 28 0 &gpio 29 0>;
Re: [PATCH v3 1/3] drm: Plumb modifiers through plane init
On Wed, May 17, 2017 at 05:26:14PM -0700, Ben Widawsky wrote: > On 17-05-17 11:17:57, Liviu Dudau wrote: > > On Tue, May 16, 2017 at 02:31:24PM -0700, Ben Widawsky wrote: > > > This is the plumbing for supporting fb modifiers on planes. Modifiers > > > have already been introduced to some extent, but this series will extend > > > this to allow querying modifiers per plane. Based on this, the client to > > > enable optimal modifications for framebuffers. > > > > > > This patch simply allows the DRM drivers to initialize their list of > > > supported modifiers upon initializing the plane. > > > > > > v2: A minor addition from Daniel > > > > > > v3: Updated commit message > > > s/INVALID/DRM_FORMAT_MOD_INVALID (Liviu) > > > Remove some excess newlines (Liviu) > > > Update comment for > 64 modifiers (Liviu) > > > > > > Cc: Liviu Dudau > > > Reviewed-by: Daniel Stone (v2) > > > Signed-off-by: Ben Widawsky > > > > Minor nits, see below, but otherwise: > > > > Reviewed-by: Liviu Dudau > > > > Thanks, > > Liviu > > > > Thank you. I took them all but the memcpy change, which I'm pretty sure is > okay. > Take a quick look again and let me know. [snip] > > > > + * format is encoded as a bit and the current code only supports a u64. > > > + */ > > > + if (WARN_ON(format_count > 64)) > > > + return -EINVAL; > > > + > > > + if (format_modifiers) { > > > + const uint64_t *temp_modifiers = format_modifiers; > > > + while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) > > > + format_modifier_count++; > > > + } > > > + > > > + plane->modifier_count = format_modifier_count; > > > + plane->modifiers = kmalloc_array(format_modifier_count, > > > + sizeof(format_modifiers[0]), > > > + GFP_KERNEL); > > > + > > > + if (format_modifier_count && !plane->modifiers) { > > > + DRM_DEBUG_KMS("out of memory when allocating plane\n"); > > > + kfree(plane->format_types); > > > + drm_mode_object_unregister(dev, &plane->base); > > > + return -ENOMEM; > > > + } > > > + > > > if (name) { > > > va_list ap; > > > > > > @@ -117,12 +145,15 @@ int drm_universal_plane_init(struct drm_device > > > *dev, struct drm_plane *plane, > > > } > > > if (!plane->name) { > > > kfree(plane->format_types); > > > + kfree(plane->modifiers); > > > drm_mode_object_unregister(dev, &plane->base); > > > return -ENOMEM; > > > } > > > > > > memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); > > > plane->format_count = format_count; > > > + memcpy(plane->modifiers, format_modifiers, > > > +format_modifier_count * sizeof(format_modifiers[0])); > > > > I'm still worried that we can reach the memcpy with a NULL format_modifiers > > and we are opening > > a security hole here. > > > > I didn't notice your feedback here before, I apologize. I'm pretty certain you > can't get here with !format_modifiers (well you can, but then the 'n' for > memcpy > will be 0). format_modifier_count is only !0 if format_modifiers is !NULL. That is a valid point. It then makes me ask why we even go through the dance of allocating a 0 array for plane->modifiers, can we not skip the whole thing around plane->modifiers if format_modifiers is NULL? [snip] > -- > Ben Widawsky, Intel Open Source Technology Center Thanks for the effort, Liviu -- | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --- ¯\_(ツ)_/¯ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v2 2/3] drm: Create a format/modifier blob
On Wed, May 17, 2017 at 05:46:18PM -0700, Ben Widawsky wrote: > On 17-05-17 01:06:16, Emil Velikov wrote: > >Hi Ben, > > > >On 16 May 2017 at 22:31, Ben Widawsky wrote: > >> Updated blob layout (Rob, Daniel, Kristian, xerpi) > >> > >> v2: > >> * Removed __packed, and alignment (.+) > >> * Fix indent in drm_format_modifier fields (Liviu) > >> * Remove duplicated modifier > 64 check (Liviu) > >> * Change comment about modifier (Liviu) > >> * Remove arguments to blob creation, use plane instead (Liviu) > >> * Fix data types (Ben) > >> * Make the blob part of uapi (Daniel) > >> > >> Cc: Rob Clark > >> Cc: Daniel Stone > >> Cc: Kristian H. Kristensen > >> Cc: Liviu Dudau > >> Signed-off-by: Ben Widawsky > >> Reviewed-by: Daniel Stone > > > >I think this is almost perfect, barring the UAPI nitpick. > >The rest is somewhat of a bikeshedding. > > > >With the UAPI resolved, regardless of the rest > >Reviewed-by: Emil Velikov > > > > > >> --- a/drivers/gpu/drm/drm_plane.c > >> +++ b/drivers/gpu/drm/drm_plane.c > > > >> +static int create_in_format_blob(struct drm_device *dev, struct drm_plane > >> *plane) > >> +{ > >> + const struct drm_mode_config *config = &dev->mode_config; > >> + const uint64_t *temp_modifiers = plane->modifiers; > >> + unsigned int format_modifier_count = 0; > >> + struct drm_property_blob *blob = NULL; > >> + struct drm_format_modifier *mod; > >> + size_t blob_size = 0, formats_size, modifiers_size; > >There's no need to initialize blob and blob_size here. > > > >> + struct drm_format_modifier_blob *blob_data; > >> + int i, j, ret = 0; > >Make i and j unsigned to match format_modifier_count and > >plane->format_count respectively. > >Then expand ret in the only place where it's used? > > > > Oh. ret has lost it's utility over the iterations of this patch. Make i and j > unsigned and dropped ret. Unsigned loop iterators will likely bite someone some day, especially if they're called something like 'i', 'j', etc. IMO it's best to keep them signed. > > >> + > >> + if (plane->modifiers) > >> + while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) > >> + format_modifier_count++; > >> + > >> + formats_size = sizeof(*plane->format_types) * plane->format_count; > >> + if (WARN_ON(!formats_size)) { > >> + /* 0 formats are never expected */ > >> + return 0; > >> + } > >> + > >> + modifiers_size = > >> + sizeof(struct drm_format_modifier) * format_modifier_count; > >> + > >> + blob_size = sizeof(struct drm_format_modifier_blob); > >> + blob_size += ALIGN(formats_size, 8); > >Worth having the "Modifiers offset is a pointer..." comment moved/copied > >here? > > > > Yes it is. > > >> + blob_size += modifiers_size; > >> + > >> + blob = drm_property_create_blob(dev, blob_size, NULL); > >> + if (IS_ERR(blob)) > >> + return -1; > >> + > >Maybe propagate the exact error... Hmm we don't seem to check if > >create_in_format_blob fails either so perhaps it's not worth it. > > > > > > In this case it's almost definitely ENOMEM. All values should be verified - I > think the other errors are there for when userspace is utilizing blob > creation. > > So I'll just leave it. > > >> --- a/include/uapi/drm/drm_mode.h > >> +++ b/include/uapi/drm/drm_mode.h > >> @@ -665,6 +665,56 @@ struct drm_mode_atomic { > >> __u64 user_data; > >> }; > >> > >> +struct drm_format_modifier_blob { > >> +#define FORMAT_BLOB_CURRENT 1 > >> + /* Version of this blob format */ > >> + u32 version; > >> + > >> + /* Flags */ > >> + u32 flags; > >> + > >> + /* Number of fourcc formats supported */ > >> + u32 count_formats; > >> + > >> + /* Where in this blob the formats exist (in bytes) */ > >> + u32 formats_offset; > >> + > >> + /* Number of drm_format_modifiers */ > >> + u32 count_modifiers; > >> + > >> + /* Where in this blob the modifiers exist (in bytes) */ > >> + u32 modifiers_offset; > >> + > >> + /* u32 formats[] */ > >> + /* struct drm_format_modifier modifiers[] */ > >> +}; > >> + > >> +struct drm_format_modifier { > >> + /* Bitmask of formats in get_plane format list this info applies > >> to. The > >> +* offset allows a sliding window of which 64 formats (bits). > >> +* > >> +* Some examples: > >> +* In today's world with < 65 formats, and formats 0, and 2 are > >> +* supported > >> +* 0x0005 > >> +*^-offset = 0, formats = 5 > >> +* > >> +* If the number formats grew to 128, and formats 98-102 are > >> +* supported with the modifier: > G>> +* > >> +* 0x003c > >> +*^ > >> +*|__offset = 64, formats = 0x3c > >> +* >
Re: [PATCH v3] drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
Hi Rob, On 18 May 2017 at 02:39, Robert Foss wrote: > Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI > as a convenience. > > Ideally the DRM_ROTATE_ and DRM_REFLECT_ property ids are looked up > through the atomic API, but realizing that userspace is likely to take > shortcuts and assume that the enum values are what is sent over the > wire. > > As a result these defines are provided purely as a convenience to > userspace applications. > > Signed-off-by: Robert Foss > --- > Changes since v2: > - Changed define prefix from DRM_MODE_PROP_ to DRM_MODE_ > - Fix compilation errors > - Changed comment formatting > - Deduplicated comment lines > - Clarified DRM_MODE_PROP_REFLECT_ comment > > Changes since v1: > - Moved defines from drm.h to drm_mode.h > - Changed define prefix from DRM_ to DRM_MODE_PROP_ > - Updated uses of the defines to the new prefix > - Removed include from drm_rect.c > - Stopped using the BIT() macro > Reviewed-by: Emil Velikov -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH v2 2/3] drm: Create a format/modifier blob
On 18 May 2017 at 01:46, Ben Widawsky wrote: >>> + blob_size += modifiers_size; >>> + >>> + blob = drm_property_create_blob(dev, blob_size, NULL); >>> + if (IS_ERR(blob)) >>> + return -1; >>> + >> >> Maybe propagate the exact error... Hmm we don't seem to check if >> create_in_format_blob fails either so perhaps it's not worth it. >> >> > > In this case it's almost definitely ENOMEM. All values should be verified - > I > think the other errors are there for when userspace is utilizing blob > creation. > > So I'll just leave it. > Ack, sure thing. >>> --- a/include/uapi/drm/drm_mode.h >>> +++ b/include/uapi/drm/drm_mode.h >>> @@ -665,6 +665,56 @@ struct drm_mode_atomic { >>> __u64 user_data; >>> }; >>> >>> +struct drm_format_modifier_blob { >>> +#define FORMAT_BLOB_CURRENT 1 >>> + /* Version of this blob format */ >>> + u32 version; >>> + >>> + /* Flags */ >>> + u32 flags; >>> + >>> + /* Number of fourcc formats supported */ >>> + u32 count_formats; >>> + >>> + /* Where in this blob the formats exist (in bytes) */ >>> + u32 formats_offset; >>> + >>> + /* Number of drm_format_modifiers */ >>> + u32 count_modifiers; >>> + >>> + /* Where in this blob the modifiers exist (in bytes) */ >>> + u32 modifiers_offset; >>> + >>> + /* u32 formats[] */ >>> + /* struct drm_format_modifier modifiers[] */ >>> +}; >>> + >>> +struct drm_format_modifier { >>> + /* Bitmask of formats in get_plane format list this info applies >>> to. The >>> +* offset allows a sliding window of which 64 formats (bits). >>> +* >>> +* Some examples: >>> +* In today's world with < 65 formats, and formats 0, and 2 are >>> +* supported >>> +* 0x0005 >>> +*^-offset = 0, formats = 5 >>> +* >>> +* If the number formats grew to 128, and formats 98-102 are >>> +* supported with the modifier: > > G>> +* >>> >>> +* 0x003c >>> +*^ >>> +*|__offset = 64, formats = 0x3c >>> +* >>> +*/ >>> + __u64 formats; >>> + __u32 offset; >>> + __u32 pad; >>> + >>> + /* The modifier that applies to the >get_plane format list >>> bitmask. */ >>> + __u64 modifier; >> >> Please drop the leading __ from the type names in UAPI headers. >> > > Many other structures have the __, can you explain why please (this has > probably > been beaten to death already; but I don't know)? > Got confused there for a moment, apologies. Using the __ types is correct. It is drm_format_modifier_blob that should be updated to follow suit. -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3] drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
On Wed, May 17, 2017 at 09:39:11PM -0400, Robert Foss wrote: > +/* > + * DRM_MODE_REFLECT_ > + * > + * Signals that the contents of a drm plane has been reflected in > + * the axis. Still vague. Also you didn't respond to my comment about the use of past tense. > + * > + * This define is provided as a convenience, looking up the property id > + * using the name->prop id lookup is the preferred method. > + */ > +#define DRM_MODE_REFLECT_X (1<<4) > +#define DRM_MODE_REFLECT_Y (1<<5) > + > +/* > + * DRM_MODE_REFLECT_MASK > + * > + * Bitmask used to look for drm plane reflections. > + */ > +#define DRM_MODE_REFLECT_MASK (\ > + DRM_MODE_REFLECT_X | \ > + DRM_MODE_REFLECT_Y) > + > + > struct drm_mode_modeinfo { > __u32 clock; > __u16 hdisplay; > -- > 2.11.0.453.g787f75f05 -- Ville Syrjälä Intel OTC ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v5 3/3] drm/i915: Add format modifiers for Intel
On 18 May 2017 at 02:14, Ben Widawsky wrote: > On 17-05-17 01:20:50, Emil Velikov wrote: >> >> Hi Ben, >> >> A couple of small questions/suggestions that I hope you find useful. >> Please don't block any of this work based on my comments. >> >> On 16 May 2017 at 22:31, Ben Widawsky wrote: >> >>> +static bool intel_primary_plane_format_mod_supported(struct drm_plane >>> *plane, >>> +uint32_t format, >>> +uint64_t modifier) >>> +{ >>> + struct drm_i915_private *dev_priv = to_i915(plane->dev); >>> + >>> + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) >>> + return false; >>> + >>> + if (INTEL_GEN(dev_priv) >= 9) >>> + return skl_mod_supported(format, modifier); >>> + else if (INTEL_GEN(dev_priv) >= 4) >>> + return i965_mod_supported(format, modifier); >>> + else >>> + return i8xx_mod_supported(format, modifier); >>> + >> >> Nit: if you rewrite this as below, the control flow should be clearer. >> Thus the 'return false;' at the end, will be [more] obvious that it's >> unreachable ;-) >> >> if (INTEL_GEN(dev_priv) >= 9) >> return skl_mod_supported(format, modifier); >> >> if (INTEL_GEN(dev_priv) >= 4) >> return i965_mod_supported(format, modifier); >> >> return i8xx_mod_supported(format, modifier); >> >> > > It's a good point, however many other blocks of code do the same thing, and > I > think the nature of if/else if/else implies unreachable. I can add > unreachable()... In fact, I just did. > > The "implies" argument is a bit odd, but that's just bikesheding, so feel free to ignore me. >>> + return false; >>> +} >>> + >> >> >> >>> --- a/drivers/gpu/drm/i915/intel_sprite.c >>> +++ b/drivers/gpu/drm/i915/intel_sprite.c >> >> >>> +static bool intel_sprite_plane_format_mod_supported(struct drm_plane >>> *plane, >>> +uint32_t format, >>> +uint64_t modifier) >>> +{ >>> + struct drm_i915_private *dev_priv = to_i915(plane->dev); >>> + >>> + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) >>> + return false; >>> + >>> + BUG_ON(plane->base.type != DRM_PLANE_TYPE_OVERLAY); >>> + >>> + switch (format) { >>> + case DRM_FORMAT_XBGR2101010: >>> + case DRM_FORMAT_ABGR2101010: >>> + if (IS_VALLEYVIEW(dev_priv) || >>> IS_CHERRYVIEW(dev_priv)) >>> + return true; >>> + break; >>> + case DRM_FORMAT_RGB565: >>> + case DRM_FORMAT_ABGR: >>> + case DRM_FORMAT_ARGB: >>> + if (INTEL_GEN(dev_priv) >= 9 || >>> IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) >>> + return true; >>> + break; >>> + case DRM_FORMAT_XBGR: >>> + if (INTEL_GEN(dev_priv) >= 6) >>> + return true; >>> + break; >>> + case DRM_FORMAT_XRGB: >>> + case DRM_FORMAT_YUYV: >>> + case DRM_FORMAT_YVYU: >>> + case DRM_FORMAT_UYVY: >>> + case DRM_FORMAT_VYUY: >>> + return true; >>> + } >>> + >>> + return false; >>> +} >>> + >>> +const struct drm_plane_funcs intel_sprite_plane_funcs = { >>> +.update_plane = drm_atomic_helper_update_plane, >>> +.disable_plane = drm_atomic_helper_disable_plane, >>> +.destroy = intel_plane_destroy, >>> +.set_property = drm_atomic_helper_plane_set_property, >>> +.atomic_get_property = intel_plane_atomic_get_property, >>> +.atomic_set_property = intel_plane_atomic_set_property, >>> +.atomic_duplicate_state = intel_plane_duplicate_state, >>> +.atomic_destroy_state = intel_plane_destroy_state, >>> +.format_mod_supported = intel_sprite_plane_format_mod_supported, >>> +}; >>> + >> >> Having a dull moment - is intel_sprite_plane_funcs (+ >> intel_sprite_plane_format_mod_supported) unused or I'm seeing things? >> If one is to keep it, for future work, perhaps it's worth adding a 2-3 >> word comment, >> >> Regards, >> Emil > > > Not sure how this happened, it is a mistake. I've spotted an actual bug alongside my bikeshedding, Yay! Fwiw Reviewed-by: Emil Velikov -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3] drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
On Wed, May 17, 2017 at 09:39:11PM -0400, Robert Foss wrote: > Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI > as a convenience. > > Ideally the DRM_ROTATE_ and DRM_REFLECT_ property ids are looked up > through the atomic API, but realizing that userspace is likely to take > shortcuts and assume that the enum values are what is sent over the > wire. > > As a result these defines are provided purely as a convenience to > userspace applications. > > Signed-off-by: Robert Foss > --- > Changes since v2: > - Changed define prefix from DRM_MODE_PROP_ to DRM_MODE_ > - Fix compilation errors > - Changed comment formatting > - Deduplicated comment lines > - Clarified DRM_MODE_PROP_REFLECT_ comment > > Changes since v1: > - Moved defines from drm.h to drm_mode.h > - Changed define prefix from DRM_ to DRM_MODE_PROP_ > - Updated uses of the defines to the new prefix > - Removed include from drm_rect.c > - Stopped using the BIT() macro > > drivers/gpu/drm/arm/malidp_drv.h| 2 +- > drivers/gpu/drm/arm/malidp_planes.c | 18 - > drivers/gpu/drm/armada/armada_overlay.c | 2 +- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 20 +- > drivers/gpu/drm/drm_atomic.c| 2 +- > drivers/gpu/drm/drm_atomic_helper.c | 2 +- > drivers/gpu/drm/drm_blend.c | 43 ++--- > drivers/gpu/drm/drm_fb_helper.c | 4 +- > drivers/gpu/drm/drm_plane_helper.c | 2 +- > drivers/gpu/drm/drm_rect.c | 36 +- > drivers/gpu/drm/i915/i915_debugfs.c | 14 +++ > drivers/gpu/drm/i915/intel_atomic_plane.c | 6 +-- > drivers/gpu/drm/i915/intel_display.c| 50 > - > drivers/gpu/drm/i915/intel_fbc.c| 2 +- > drivers/gpu/drm/i915/intel_fbdev.c | 2 +- > drivers/gpu/drm/i915/intel_sprite.c | 20 +- > drivers/gpu/drm/imx/ipuv3-plane.c | 2 +- > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 30 +++ > drivers/gpu/drm/nouveau/nv50_display.c | 2 +- > drivers/gpu/drm/omapdrm/omap_drv.c | 4 +- > drivers/gpu/drm/omapdrm/omap_fb.c | 18 - > drivers/gpu/drm/omapdrm/omap_plane.c| 16 > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- > include/drm/drm_blend.h | 21 +-- > include/uapi/drm/drm_mode.h | 49 +++- > 25 files changed, 201 insertions(+), 170 deletions(-) > > diff --git a/drivers/gpu/drm/arm/malidp_drv.h > b/drivers/gpu/drm/arm/malidp_drv.h > index 040311ffcaec..2e2033140efc 100644 > --- a/drivers/gpu/drm/arm/malidp_drv.h > +++ b/drivers/gpu/drm/arm/malidp_drv.h > @@ -65,6 +65,6 @@ void malidp_de_planes_destroy(struct drm_device *drm); > int malidp_crtc_init(struct drm_device *drm); > > /* often used combination of rotational bits */ > -#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270) > +#define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270) > > #endif /* __MALIDP_DRV_H__ */ > diff --git a/drivers/gpu/drm/arm/malidp_planes.c > b/drivers/gpu/drm/arm/malidp_planes.c > index 814fda23cead..063a8d2b0be3 100644 > --- a/drivers/gpu/drm/arm/malidp_planes.c > +++ b/drivers/gpu/drm/arm/malidp_planes.c > @@ -80,7 +80,7 @@ static void malidp_plane_reset(struct drm_plane *plane) > state = kzalloc(sizeof(*state), GFP_KERNEL); > if (state) { > state->base.plane = plane; > - state->base.rotation = DRM_ROTATE_0; > + state->base.rotation = DRM_MODE_ROTATE_0; > plane->state = &state->base; > } > } > @@ -221,7 +221,7 @@ static int malidp_de_plane_check(struct drm_plane *plane, > return ret; > > /* packed RGB888 / BGR888 can't be rotated or flipped */ > - if (state->rotation != DRM_ROTATE_0 && > + if (state->rotation != DRM_MODE_ROTATE_0 && > (fb->format->format == DRM_FORMAT_RGB888 || >fb->format->format == DRM_FORMAT_BGR888)) > return -EINVAL; > @@ -315,12 +315,12 @@ static void malidp_de_plane_update(struct drm_plane > *plane, > val &= ~LAYER_ROT_MASK; > > /* setup the rotation and axis flip bits */ > - if (plane->state->rotation & DRM_ROTATE_MASK) > - val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) << > + if (plane->state->rotation & DRM_MODE_ROTATE_MASK) > + val |= ilog2(plane->state->rotation & DRM_MODE_ROTATE_MASK) << > LAYER_ROT_OFFSET; > - if (plane->state->rotation & DRM_REFLECT_X) > + if (plane->state->rotation & DRM_MODE_REFLECT_X) > val |= LAYER_H_FLIP; > - if (plane->state->rotation & DRM_REFLECT_Y) > + if (plane->state->rotation & DRM_MODE_REFLECT_Y) > val |= LAYER_V_FLI
Re: [PATCH] drm/pl111: Add a debugfs node to dump our registers.
On Wednesday, 2017-05-17 17:56:40 -0700, Eric Anholt wrote: > While debugging an X11 display failure, I wanted to see where we were > actually scanning out from. This is probably generally useful to > others that might be working on this device. > > Signed-off-by: Eric Anholt > --- > drivers/gpu/drm/pl111/Makefile| 2 ++ > drivers/gpu/drm/pl111/pl111_debugfs.c | 55 > +++ > drivers/gpu/drm/pl111/pl111_drm.h | 3 ++ > drivers/gpu/drm/pl111/pl111_drv.c | 4 +++ > 4 files changed, 64 insertions(+) > create mode 100644 drivers/gpu/drm/pl111/pl111_debugfs.c > > diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile > index 01caee727c13..59483d610ef5 100644 > --- a/drivers/gpu/drm/pl111/Makefile > +++ b/drivers/gpu/drm/pl111/Makefile > @@ -2,4 +2,6 @@ pl111_drm-y +=pl111_connector.o \ > pl111_display.o \ > pl111_drv.o > > +pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o > + > obj-$(CONFIG_DRM_PL111) += pl111_drm.o > diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c > b/drivers/gpu/drm/pl111/pl111_debugfs.c > new file mode 100644 > index ..ee13a060cddf > --- /dev/null > +++ b/drivers/gpu/drm/pl111/pl111_debugfs.c > @@ -0,0 +1,55 @@ > +/* > + * Copyright © 2017 Broadcom > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include > +#include > +#include > +#include > +#include "pl111_drm.h" > + > +#define REGDEF(reg) { reg, #reg } > +static const struct { > + uint32_t reg; > + const char *name; > +} pl111_reg_defs[] = { > + REGDEF(CLCD_TIM0), > + REGDEF(CLCD_TIM1), > + REGDEF(CLCD_TIM2), > + REGDEF(CLCD_TIM3), > + REGDEF(CLCD_UBAS), > + REGDEF(CLCD_PL111_CNTL), > + REGDEF(CLCD_PL111_IENB), > +}; > + > +int pl111_debugfs_regs(struct seq_file *m, void *unused) > +{ > + struct drm_info_node *node = (struct drm_info_node *)m->private; > + struct drm_device *dev = node->minor->dev; > + struct pl111_drm_dev_private *priv = dev->dev_private; > + int i; nit: this will print a warning; s/int/unsigned/ ? PS: I love how little code everything in this driver takes :] > + > + for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) { > + seq_printf(m, "%s (0x%04x): 0x%08x\n", > +pl111_reg_defs[i].name, pl111_reg_defs[i].reg, > +readl(priv->regs + pl111_reg_defs[i].reg)); > + } > + > + return 0; > +} > + > +static const struct drm_info_list pl111_debugfs_list[] = { > + {"regs", pl111_debugfs_regs, 0}, > +}; > + > +int > +pl111_debugfs_init(struct drm_minor *minor) > +{ > + return drm_debugfs_create_files(pl111_debugfs_list, > + ARRAY_SIZE(pl111_debugfs_list), > + minor->debugfs_root, minor); > +} > diff --git a/drivers/gpu/drm/pl111/pl111_drm.h > b/drivers/gpu/drm/pl111/pl111_drm.h > index 4162c6aa5dbb..5c685bfc8fdc 100644 > --- a/drivers/gpu/drm/pl111/pl111_drm.h > +++ b/drivers/gpu/drm/pl111/pl111_drm.h > @@ -25,6 +25,8 @@ > > #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2) > > +struct drm_minor; > + > struct pl111_drm_connector { > struct drm_connector connector; > struct drm_panel *panel; > @@ -60,5 +62,6 @@ int pl111_encoder_init(struct drm_device *dev); > int pl111_dumb_create(struct drm_file *file_priv, > struct drm_device *dev, > struct drm_mode_create_dumb *args); > +int pl111_debugfs_init(struct drm_minor *minor); > > #endif /* _PL111_DRM_H_ */ > diff --git a/drivers/gpu/drm/pl111/pl111_drv.c > b/drivers/gpu/drm/pl111/pl111_drv.c > index 9d1467492cb9..f79c24859a30 100644 > --- a/drivers/gpu/drm/pl111/pl111_drv.c > +++ b/drivers/gpu/drm/pl111/pl111_drv.c > @@ -173,6 +173,10 @@ static struct drm_driver pl111_drm_driver = { > .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > .gem_prime_export = drm_gem_prime_export, > .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, > + > +#if defined(CONFIG_DEBUG_FS) > + .debugfs_init = pl111_debugfs_init, > +#endif > }; > > #ifdef CONFIG_ARM_AMBA > -- > 2.11.0 > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PULL] drm-intel-fixes
Hi Dave, drm/i915 fixes for v4.12-rc2. BR, Jani. The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6: Linux 4.12-rc1 (2017-05-13 13:19:49 -0700) are available in the git repository at: git://anongit.freedesktop.org/git/drm-intel tags/drm-intel-fixes-2017-05-18-1 for you to fetch changes up to 2f720aac936dc7a301b757d3b197d86c333d59b8: drm/i915: don't do allocate_va_range again on PIN_UPDATE (2017-05-15 14:44:33 +0300) drm/i915 fixes for v4.12-rc2 Ander Conselvan de Oliveira (1): drm/i915/glk: Fix DSI "*ERROR* ULPS is still active" messages Chuanxiao Dong (1): drm/i915/gvt: not to restore in-context mmio Colin Ian King (1): drm/i915/gvt: fix typo: "supporte" -> "support" Jani Nikula (1): Merge tag 'gvt-fixes-2017-05-11' of https://github.com/01org/gvt-linux into drm-intel-fixes Matthew Auld (1): drm/i915: don't do allocate_va_range again on PIN_UPDATE Ping Gao (1): drm/i915/gvt: avoid unnecessary vgpu switch Ville Syrjälä (2): drm/i915: Fix runtime PM for LPE audio drm/i915: Fix rawclk readout for g4x drivers/gpu/drm/i915/gvt/handlers.c | 2 +- drivers/gpu/drm/i915/gvt/render.c | 3 +++ drivers/gpu/drm/i915/gvt/sched_policy.c | 8 ++-- drivers/gpu/drm/i915/i915_gem_gtt.c | 12 drivers/gpu/drm/i915/i915_reg.h | 10 +++--- drivers/gpu/drm/i915/intel_cdclk.c | 6 ++ drivers/gpu/drm/i915/intel_dsi.c| 7 +++ drivers/gpu/drm/i915/intel_lpe_audio.c | 5 + sound/x86/intel_hdmi_audio.c| 4 9 files changed, 35 insertions(+), 22 deletions(-) -- Jani Nikula, Intel Open Source Technology Center ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/omap: fix tiled buffer stride calculations
omap_gem uses page alignment for buffer stride. The related calculations are a bit off, though, as byte stride of 4096 gets aligned to 8192, instead of 4096. This patch fixes those calculations. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, size_t size = PAGE_SIZE * n; loff_t off = mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); if (m > 1) { int i; @@ -424,7 +424,7 @@ static int fault_2d(struct drm_gem_object *obj, * into account in some of the math, so figure out virtual stride * in pages */ - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); /* We don't use vmf->pgoff since that has the fake offset: */ pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/4] drm/dp: start a DPCD based DP sink/branch device quirk database
On Wed, 17 May 2017, Clint Taylor wrote: > On 05/17/2017 07:25 AM, Jani Nikula wrote: >> Face the fact, there are Display Port sink and branch devices out there >> in the wild that don't follow the Display Port specifications, or they >> have bugs, or just otherwise require special treatment. Start a common >> quirk database the drivers can query based on the DP device >> identification. At least for now, we leave the workarounds for the >> drivers to implement as they see fit. >> >> For starters, add a branch device that can't handle full 24-bit main >> link M and N attributes properly. Naturally, the workaround of reducing >> main link attributes for all devices ended up in regressions for other >> devices. So here we are. >> >> v2: Rebase on DRM DP desc read helpers >> >> Cc: Ville Syrjälä >> Cc: Dhinakaran Pandiyan >> Cc: Clint Taylor >> Cc: Adam Jackson >> Cc: Harry Wentland >> Signed-off-by: Jani Nikula >> --- >> drivers/gpu/drm/drm_dp_helper.c | 52 >> +++-- >> include/drm/drm_dp_helper.h | 32 + >> 2 files changed, 82 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_dp_helper.c >> b/drivers/gpu/drm/drm_dp_helper.c >> index 52e0ca9a5bb1..8c3797283c3b 100644 >> --- a/drivers/gpu/drm/drm_dp_helper.c >> +++ b/drivers/gpu/drm/drm_dp_helper.c >> @@ -1209,6 +1209,51 @@ int drm_dp_stop_crc(struct drm_dp_aux *aux) >> } >> EXPORT_SYMBOL(drm_dp_stop_crc); >> >> +struct dpcd_quirk { >> +u8 oui[3]; >> +bool is_branch; >> +u32 quirks; >> +}; >> + >> +#define OUI(first, second, third) { (first), (second), (third) } >> + >> +static const struct dpcd_quirk dpcd_quirk_list[] = { >> +/* Analogix 7737 needs reduced M and N at HBR2 link rates */ >> +{ OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) }, >> +}; >> + >> +#undef OUI >> + >> +/* >> + * Get a bit mask of DPCD quirks for the sink/branch device identified by >> + * ident. The quirk data is shared but it's up to the drivers to act on the >> + * data. >> + * >> + * For now, only the OUI (first three bytes) is used, but this may be >> extended >> + * to device identification string and hardware/firmware revisions later. >> + */ >> +static u32 >> +drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch) >> +{ >> +const struct dpcd_quirk *quirk; >> +u32 quirks = 0; >> +int i; >> + >> +for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) { >> +quirk = &dpcd_quirk_list[i]; >> + >> +if (quirk->is_branch != is_branch) >> +continue; >> + >> +if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui) != 0)) >> +continue; > > Oops, All branch devices appear to have the quirk applied. The memcmp > should be closed before the !=0 Now that's embarrassing. Thanks for catching this. BR, Jani. > > if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0) > > > [ 659.496861] [drm:drm_dp_read_desc] DP branch: OUI 00-1c-f8 dev-ID > 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0001 > [ 659.549017] [drm:drm_dp_read_desc] DP branch: OUI 00-22-b9 dev-ID > 7737 HW-rev 10.12 SW-rev 6.4 quirks 0x0001 > [ 659.630449] [drm:drm_dp_read_desc] DP sink: OUI ee-ff-c0 dev-ID \001 > HW-rev 0.0 SW-rev 0.0 quirks 0x > > This was actually good to find out that LSPCON didn't like the reduced M > and N from the quirk at HBR2. > > -Clint > >> + >> +quirks |= quirk->quirks; >> +} >> + >> +return quirks; >> +} >> + >> /** >>* drm_dp_read_desc - read sink/branch descriptor from DPCD >>* @aux: DisplayPort AUX channel >> @@ -1231,14 +1276,17 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct >> drm_dp_desc *desc, >> if (ret < 0) >> return ret; >> >> +desc->quirks = drm_dp_get_quirks(ident, is_branch); >> + >> dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); >> >> -DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev >> %d.%d\n", >> +DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d >> quirks 0x%04x\n", >>is_branch ? "branch" : "sink", >>(int)sizeof(ident->oui), ident->oui, >>dev_id_len, ident->device_id, >>ident->hw_rev >> 4, ident->hw_rev & 0xf, >> - ident->sw_major_rev, ident->sw_minor_rev); >> + ident->sw_major_rev, ident->sw_minor_rev, >> + desc->quirks); >> >> return 0; >> } >> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h >> index aee5b96b51d7..717cb8496725 100644 >> --- a/include/drm/drm_dp_helper.h >> +++ b/include/drm/drm_dp_helper.h >> @@ -1090,12 +1090,44 @@ struct drm_dp_dpcd_ident { >> /** >>* struct drm_dp_desc - DP branch/sink device descriptor >>* @ident: DP device identification from DPCD 0x400 (sink) or 0x500 >> (branch). >> + * @quirks: Quirks; us
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
Hi Tomi, Thank you for the patch. On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: > omap_gem uses page alignment for buffer stride. The related calculations > are a bit off, though, as byte stride of 4096 gets aligned to 8192, > instead of 4096. This patch fixes those calculations. > > Signed-off-by: Tomi Valkeinen > --- > drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c > b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 > 100644 > --- a/drivers/gpu/drm/omapdrm/omap_gem.c > +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, > size_t size = PAGE_SIZE * n; > loff_t off = mmap_offset(obj) + > (entry->obj_pgoff << PAGE_SHIFT); > - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); How about int m = round_up(omap_obj->width << fmt, PAGE_SIZE); instead of open-coding it ? I find that a bit easier to understand. By the way, shifting left by fmt should be fine for TILFMT_8BIT, TILFMT_16BIT and TILFMT_32BIT that evaluate to 0, 1 and 2 respectively, but how does it work with TILFMT_PAGE ? fmt is computed by gem2fmt() in call cases, which returns TILFMT_PAGE in the default case (no tiled flag set). Can this happen in practice ? > > if (m > 1) { > int i; > @@ -424,7 +424,7 @@ static int fault_2d(struct drm_gem_object *obj, >* into account in some of the math, so figure out virtual stride >* in pages >*/ > - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); > > /* We don't use vmf->pgoff since that has the fake offset: */ > pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT; -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/4] drm/dp: device identification and quirks ~v3
Update on [1]. BR, Jani. [1] cover.1495030890.git.jani.nikula@intel.com">http://mid.mail-archive.com/cover.1495030890.git.jani.nikula@intel.com Jani Nikula (4): drm/dp: add helper for reading DP sink/branch device desc from DPCD drm/i915: use drm DP helper to read DPCD desc drm/dp: start a DPCD based DP sink/branch device quirk database drm/i915: Detect USB-C specific dongles before reducing M and N drivers/gpu/drm/drm_dp_helper.c | 83 drivers/gpu/drm/i915/i915_drv.h | 3 +- drivers/gpu/drm/i915/intel_display.c | 22 ++ drivers/gpu/drm/i915/intel_dp.c | 45 +-- drivers/gpu/drm/i915/intel_dp_mst.c | 5 ++- drivers/gpu/drm/i915/intel_drv.h | 13 +- drivers/gpu/drm/i915/intel_lspcon.c | 2 +- include/drm/drm_dp_helper.h | 51 ++ 8 files changed, 166 insertions(+), 58 deletions(-) -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 4/4] drm/i915: Detect USB-C specific dongles before reducing M and N
The Analogix 7737 DP to HDMI converter requires reduced M and N values when to operate correctly at HBR2. We tried to reduce the M/N values for all devices in commit 9a86cda07af2 ("drm/i915/dp: reduce link M/N parameters"), but that regressed some other sinks. Detect this IC by its OUI value of 0x0022B9 via the DPCD quirk list, and only reduce the M/N values for that. v2 by Jani: Rebased on the DP quirk database v3 by Jani: Rebased on the reworked DP quirk database v4 by Jani: Improve commit message (Daniel) Fixes: 9a86cda07af2 ("drm/i915/dp: reduce link M/N parameters") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93578 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100755 Cc: Jani Nikula Cc: Dhinakaran Pandiyan Cc: Ville Syrjälä Reviewed-by: Daniel Vetter Signed-off-by: Clint Taylor Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/intel_display.c | 22 ++ drivers/gpu/drm/i915/intel_dp.c | 8 ++-- drivers/gpu/drm/i915/intel_dp_mst.c | 5 - 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 17883a84b8c1..31ca580e47ae 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -611,7 +611,8 @@ struct intel_link_m_n { void intel_link_compute_m_n(int bpp, int nlanes, int pixel_clock, int link_clock, - struct intel_link_m_n *m_n); + struct intel_link_m_n *m_n, + bool reduce_m_n); /* Interface history: * diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8217ed0e7132..ea4f116bd410 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6116,7 +6116,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc, pipe_config->fdi_lanes = lane; intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock, - link_bw, &pipe_config->fdi_m_n); + link_bw, &pipe_config->fdi_m_n, false); ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config); if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) { @@ -6292,7 +6292,8 @@ intel_reduce_m_n_ratio(uint32_t *num, uint32_t *den) } static void compute_m_n(unsigned int m, unsigned int n, - uint32_t *ret_m, uint32_t *ret_n) + uint32_t *ret_m, uint32_t *ret_n, + bool reduce_m_n) { /* * Reduce M/N as much as possible without loss in precision. Several DP @@ -6300,9 +6301,11 @@ static void compute_m_n(unsigned int m, unsigned int n, * values. The passed in values are more likely to have the least * significant bits zero than M after rounding below, so do this first. */ - while ((m & 1) == 0 && (n & 1) == 0) { - m >>= 1; - n >>= 1; + if (reduce_m_n) { + while ((m & 1) == 0 && (n & 1) == 0) { + m >>= 1; + n >>= 1; + } } *ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX); @@ -6313,16 +6316,19 @@ static void compute_m_n(unsigned int m, unsigned int n, void intel_link_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, int link_clock, - struct intel_link_m_n *m_n) + struct intel_link_m_n *m_n, + bool reduce_m_n) { m_n->tu = 64; compute_m_n(bits_per_pixel * pixel_clock, link_clock * nlanes * 8, - &m_n->gmch_m, &m_n->gmch_n); + &m_n->gmch_m, &m_n->gmch_n, + reduce_m_n); compute_m_n(pixel_clock, link_clock, - &m_n->link_m, &m_n->link_n); + &m_n->link_m, &m_n->link_n, + reduce_m_n); } static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2a5f385e8f44..1ae9de5cf39c 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1627,6 +1627,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, int link_avail, link_clock; int common_len; uint8_t link_bw, rate_select; + bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, + DP_DPCD_QUIRK_LIMITED_M_N); common_len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->max_link_rate); @@ -1759,7 +1761,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, intel_link_compute_m_n(bpp, lane_count, adjust
[PATCH 3/4] drm/dp: start a DPCD based DP sink/branch device quirk database
Face the fact, there are Display Port sink and branch devices out there in the wild that don't follow the Display Port specifications, or they have bugs, or just otherwise require special treatment. Start a common quirk database the drivers can query based on the DP device identification. At least for now, we leave the workarounds for the drivers to implement as they see fit. For starters, add a branch device that can't handle full 24-bit main link Mdiv and Ndiv main link attributes properly. Naturally, the workaround of reducing main link attributes for all devices ended up in regressions for other devices. So here we are. v2: Rebase on DRM DP desc read helpers v3: Fix the OUI memcmp blunder (Clint) Cc: Ville Syrjälä Cc: Dhinakaran Pandiyan Cc: Clint Taylor Cc: Adam Jackson Cc: Harry Wentland Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_dp_helper.c | 52 +++-- include/drm/drm_dp_helper.h | 32 + 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 52e0ca9a5bb1..213fb837e1c4 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -1209,6 +1209,51 @@ int drm_dp_stop_crc(struct drm_dp_aux *aux) } EXPORT_SYMBOL(drm_dp_stop_crc); +struct dpcd_quirk { + u8 oui[3]; + bool is_branch; + u32 quirks; +}; + +#define OUI(first, second, third) { (first), (second), (third) } + +static const struct dpcd_quirk dpcd_quirk_list[] = { + /* Analogix 7737 needs reduced M and N at HBR2 link rates */ + { OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) }, +}; + +#undef OUI + +/* + * Get a bit mask of DPCD quirks for the sink/branch device identified by + * ident. The quirk data is shared but it's up to the drivers to act on the + * data. + * + * For now, only the OUI (first three bytes) is used, but this may be extended + * to device identification string and hardware/firmware revisions later. + */ +static u32 +drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch) +{ + const struct dpcd_quirk *quirk; + u32 quirks = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) { + quirk = &dpcd_quirk_list[i]; + + if (quirk->is_branch != is_branch) + continue; + + if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0) + continue; + + quirks |= quirk->quirks; + } + + return quirks; +} + /** * drm_dp_read_desc - read sink/branch descriptor from DPCD * @aux: DisplayPort AUX channel @@ -1231,14 +1276,17 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, if (ret < 0) return ret; + desc->quirks = drm_dp_get_quirks(ident, is_branch); + dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); - DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n", + DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n", is_branch ? "branch" : "sink", (int)sizeof(ident->oui), ident->oui, dev_id_len, ident->device_id, ident->hw_rev >> 4, ident->hw_rev & 0xf, - ident->sw_major_rev, ident->sw_minor_rev); + ident->sw_major_rev, ident->sw_minor_rev, + desc->quirks); return 0; } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index aee5b96b51d7..717cb8496725 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1090,12 +1090,44 @@ struct drm_dp_dpcd_ident { /** * struct drm_dp_desc - DP branch/sink device descriptor * @ident: DP device identification from DPCD 0x400 (sink) or 0x500 (branch). + * @quirks: Quirks; use drm_dp_has_quirk() to query for the quirks. */ struct drm_dp_desc { struct drm_dp_dpcd_ident ident; + u32 quirks; }; int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, bool is_branch); +/** + * enum drm_dp_quirk - Display Port sink/branch device specific quirks + * + * Display Port sink and branch devices in the wild have a variety of bugs, try + * to collect them here. The quirks are shared, but it's up to the drivers to + * implement workarounds for them. + */ +enum drm_dp_quirk { + /** +* @DP_DPCD_QUIRK_LIMITED_M_N: +* +* The device requires main link attributes Mdiv and Ndiv to be limited +* to 16 bits. +*/ + DP_DPCD_QUIRK_LIMITED_M_N, +}; + +/** + * drm_dp_has_quirk() - does the DP device have a specific quirk + * @desc: Device decriptor filled by drm_dp_read_desc() + * @quirk: Quirk to query for + * + * Return true if DP device identified by @desc has @quirk. + */ +static inline boo
[PATCH 2/4] drm/i915: use drm DP helper to read DPCD desc
Switch to using the common DP helpers instead of using our own. v2: also remove leftover struct intel_dp_desc (Daniel) Reviewed-by: Daniel Vetter Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/intel_dp.c | 37 - drivers/gpu/drm/i915/intel_drv.h| 13 + drivers/gpu/drm/i915/intel_lspcon.c | 2 +- 3 files changed, 6 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4a6feb6a69bd..2a5f385e8f44 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1548,37 +1548,6 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) DRM_DEBUG_KMS("common rates: %s\n", str); } -bool -__intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc) -{ - u32 base = drm_dp_is_branch(intel_dp->dpcd) ? DP_BRANCH_OUI : - DP_SINK_OUI; - - return drm_dp_dpcd_read(&intel_dp->aux, base, desc, sizeof(*desc)) == - sizeof(*desc); -} - -bool intel_dp_read_desc(struct intel_dp *intel_dp) -{ - struct intel_dp_desc *desc = &intel_dp->desc; - bool oui_sup = intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & - DP_OUI_SUPPORT; - int dev_id_len; - - if (!__intel_dp_read_desc(intel_dp, desc)) - return false; - - dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id)); - DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n", - drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink", - (int)sizeof(desc->oui), desc->oui, oui_sup ? "" : "(NS)", - dev_id_len, desc->device_id, - desc->hw_rev >> 4, desc->hw_rev & 0xf, - desc->sw_major_rev, desc->sw_minor_rev); - - return true; -} - int intel_dp_max_link_rate(struct intel_dp *intel_dp) { @@ -3662,7 +3631,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp) if (!intel_dp_read_dpcd(intel_dp)) return false; - intel_dp_read_desc(intel_dp); + drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc, +drm_dp_is_branch(intel_dp->dpcd)); if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) dev_priv->no_aux_handshake = intel_dp->dpcd[DP_MAX_DOWNSPREAD] & @@ -4677,7 +4647,8 @@ intel_dp_long_pulse(struct intel_connector *intel_connector) intel_dp_print_rates(intel_dp); - intel_dp_read_desc(intel_dp); + drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc, +drm_dp_is_branch(intel_dp->dpcd)); intel_dp_configure_mst(intel_dp); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bd500977b3fc..71f94a01aedd 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -938,14 +938,6 @@ enum link_m_n_set { M2_N2 }; -struct intel_dp_desc { - u8 oui[3]; - u8 device_id[6]; - u8 hw_rev; - u8 sw_major_rev; - u8 sw_minor_rev; -} __packed; - struct intel_dp_compliance_data { unsigned long edid; uint8_t video_pattern; @@ -996,7 +988,7 @@ struct intel_dp { /* Max rate for the current link */ int max_link_rate; /* sink or branch descriptor */ - struct intel_dp_desc desc; + struct drm_dp_desc desc; struct drm_dp_aux aux; enum intel_display_power_domain aux_power_domain; uint8_t train_set[4]; @@ -1571,9 +1563,6 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) } bool intel_dp_read_dpcd(struct intel_dp *intel_dp); -bool __intel_dp_read_desc(struct intel_dp *intel_dp, - struct intel_dp_desc *desc); -bool intel_dp_read_desc(struct intel_dp *intel_dp); int intel_dp_link_required(int pixel_clock, int bpp); int intel_dp_max_data_rate(int max_link_clock, int max_lanes); bool intel_digital_port_connected(struct drm_i915_private *dev_priv, diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c index 71cbe9c08932..5abef482eacf 100644 --- a/drivers/gpu/drm/i915/intel_lspcon.c +++ b/drivers/gpu/drm/i915/intel_lspcon.c @@ -240,7 +240,7 @@ bool lspcon_init(struct intel_digital_port *intel_dig_port) return false; } - intel_dp_read_desc(dp); + drm_dp_read_desc(&dp->aux, &dp->desc, drm_dp_is_branch(dp->dpcd)); DRM_DEBUG_KMS("Success: LSPCON init\n"); return true; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/4] drm/dp: add helper for reading DP sink/branch device desc from DPCD
Reviewed-by: Daniel Vetter Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_dp_helper.c | 35 +++ include/drm/drm_dp_helper.h | 19 +++ 2 files changed, 54 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 3e5f52110ea1..52e0ca9a5bb1 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -1208,3 +1208,38 @@ int drm_dp_stop_crc(struct drm_dp_aux *aux) return 0; } EXPORT_SYMBOL(drm_dp_stop_crc); + +/** + * drm_dp_read_desc - read sink/branch descriptor from DPCD + * @aux: DisplayPort AUX channel + * @desc: Device decriptor to fill from DPCD + * @is_branch: true for branch devices, false for sink devices + * + * Read DPCD 0x400 (sink) or 0x500 (branch) into @desc. Also debug log the + * identification. + * + * Returns 0 on success or a negative error code on failure. + */ +int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, +bool is_branch) +{ + struct drm_dp_dpcd_ident *ident = &desc->ident; + unsigned int offset = is_branch ? DP_BRANCH_OUI : DP_SINK_OUI; + int ret, dev_id_len; + + ret = drm_dp_dpcd_read(aux, offset, ident, sizeof(*ident)); + if (ret < 0) + return ret; + + dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); + + DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n", + is_branch ? "branch" : "sink", + (int)sizeof(ident->oui), ident->oui, + dev_id_len, ident->device_id, + ident->hw_rev >> 4, ident->hw_rev & 0xf, + ident->sw_major_rev, ident->sw_minor_rev); + + return 0; +} +EXPORT_SYMBOL(drm_dp_read_desc); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index f7007e544f29..aee5b96b51d7 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1079,4 +1079,23 @@ void drm_dp_aux_unregister(struct drm_dp_aux *aux); int drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc); int drm_dp_stop_crc(struct drm_dp_aux *aux); +struct drm_dp_dpcd_ident { + u8 oui[3]; + u8 device_id[6]; + u8 hw_rev; + u8 sw_major_rev; + u8 sw_minor_rev; +} __packed; + +/** + * struct drm_dp_desc - DP branch/sink device descriptor + * @ident: DP device identification from DPCD 0x400 (sink) or 0x500 (branch). + */ +struct drm_dp_desc { + struct drm_dp_dpcd_ident ident; +}; + +int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, +bool is_branch); + #endif /* _DRM_DP_HELPER_H_ */ -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm] xf86drm: fix compile error for declare i in for loop
On 17 May 2017 at 19:16, Eric Engestrom wrote: > On Wednesday, 2017-05-17 13:58:42 +, Yu, Qiang wrote: >> Hi Emil, >> >> I didn't modify the code. I'm using Ubuntu 14.04 gcc 4.8.4, the configure >> pass but >> fail when compile. >> >> I think my gcc support c99 but needs adding "-std=c99" to enable it, and the >> configure >> script add it into CC variable. > > From the AC_PROG_CC_C99 docs: >> If the C compiler is not in C99 mode by default, try to add an option >> to output variable `CC` to make it so. > > G... Add that to the pile of reasons to move away from autotools, > I suppose. > You do realise that cmake, meson and others have similar helper/macros, right? >> When just use "make", it's OK, but my build script uses >> "make CC=gcc". >> >> If you think current state is OK, I can change my build script for that. > > Yes, I think you should change your build command. It's a shame that > autotools has this bug, but we'd like to avoid changing our codebase to > work around these, and in this case, it would mean dropping the C99 > requirement and having to downgrade the whole codebase to something > older. > Again you're miles off, I'm afraid. Overrides is a make thing, which allows you to use [normally temporary] clever things. For example: - increase/decrease warning levels of part A in your project - change optimisation level of components B At the same time, if you do stupid things you get to pick the pieces. -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
On 18/05/17 13:59, Laurent Pinchart wrote: > Hi Tomi, > > Thank you for the patch. > > On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: >> omap_gem uses page alignment for buffer stride. The related calculations >> are a bit off, though, as byte stride of 4096 gets aligned to 8192, >> instead of 4096. This patch fixes those calculations. >> >> Signed-off-by: Tomi Valkeinen >> --- >> drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c >> b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 >> 100644 >> --- a/drivers/gpu/drm/omapdrm/omap_gem.c >> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c >> @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, >> size_t size = PAGE_SIZE * n; >> loff_t off = mmap_offset(obj) + >> (entry->obj_pgoff << PAGE_SHIFT); >> -const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); >> +const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); > > How about > > int m = round_up(omap_obj->width << fmt, PAGE_SIZE); > > instead of open-coding it ? I find that a bit easier to understand. That should be: round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE; Yes, I think that's more understandable. > By the way, shifting left by fmt should be fine for TILFMT_8BIT, TILFMT_16BIT > and TILFMT_32BIT that evaluate to 0, 1 and 2 respectively, but how does it > work with TILFMT_PAGE ? fmt is computed by gem2fmt() in call cases, which > returns TILFMT_PAGE in the default case (no tiled flag set). Can this happen > in practice ? These functions are only called for 2D buffers. I do find shifting by 'enum tiler_fmt' quite ugly, though... Tomi signature.asc Description: OpenPGP digital signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
Hi Tomi, On Thursday 18 May 2017 14:14:35 Tomi Valkeinen wrote: > On 18/05/17 13:59, Laurent Pinchart wrote: > > On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: > >> omap_gem uses page alignment for buffer stride. The related calculations > >> are a bit off, though, as byte stride of 4096 gets aligned to 8192, > >> instead of 4096. This patch fixes those calculations. > >> > >> Signed-off-by: Tomi Valkeinen > >> --- > >> > >> drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c > >> b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 > >> 100644 > >> --- a/drivers/gpu/drm/omapdrm/omap_gem.c > >> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > >> @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, > >>size_t size = PAGE_SIZE * n; > >>loff_t off = mmap_offset(obj) + > >>(entry->obj_pgoff << PAGE_SHIFT); > >> - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > >> + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); > > > > How about > > > > int m = round_up(omap_obj->width << fmt, PAGE_SIZE); > > > > instead of open-coding it ? I find that a bit easier to understand. > > That should be: > > round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE; Sorry, I meant DIV_ROUND_UP, not round_up. > Yes, I think that's more understandable. > > > By the way, shifting left by fmt should be fine for TILFMT_8BIT, > > TILFMT_16BIT and TILFMT_32BIT that evaluate to 0, 1 and 2 respectively, > > but how does it work with TILFMT_PAGE ? fmt is computed by gem2fmt() in > > call cases, which returns TILFMT_PAGE in the default case (no tiled flag > > set). Can this happen in practice ? > > These functions are only called for 2D buffers. I do find shifting by > 'enum tiler_fmt' quite ugly, though... So do I. This should be added to the infinite todo list :-) -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
On Thu, May 18, 2017 at 02:14:35PM +0300, Tomi Valkeinen wrote: > On 18/05/17 13:59, Laurent Pinchart wrote: > > Hi Tomi, > > > > Thank you for the patch. > > > > On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: > >> omap_gem uses page alignment for buffer stride. The related calculations > >> are a bit off, though, as byte stride of 4096 gets aligned to 8192, > >> instead of 4096. This patch fixes those calculations. > >> > >> Signed-off-by: Tomi Valkeinen > >> --- > >> drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c > >> b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 > >> 100644 > >> --- a/drivers/gpu/drm/omapdrm/omap_gem.c > >> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > >> @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, > >>size_t size = PAGE_SIZE * n; > >>loff_t off = mmap_offset(obj) + > >>(entry->obj_pgoff << PAGE_SHIFT); > >> - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > >> + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); > > > > How about > > > > int m = round_up(omap_obj->width << fmt, PAGE_SIZE); > > > > instead of open-coding it ? I find that a bit easier to understand. > > That should be: > > round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE; Or a bit more optimally just DIV_ROUND_UP() -- Ville Syrjälä Intel OTC ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
On 18/05/17 14:25, Laurent Pinchart wrote: > Hi Tomi, > > On Thursday 18 May 2017 14:14:35 Tomi Valkeinen wrote: >> On 18/05/17 13:59, Laurent Pinchart wrote: >>> On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: omap_gem uses page alignment for buffer stride. The related calculations are a bit off, though, as byte stride of 4096 gets aligned to 8192, instead of 4096. This patch fixes those calculations. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, size_t size = PAGE_SIZE * n; loff_t off = mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE); >>> >>> How about >>> >>> int m = round_up(omap_obj->width << fmt, PAGE_SIZE); >>> >>> instead of open-coding it ? I find that a bit easier to understand. >> >> That should be: >> >> round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE; > > Sorry, I meant DIV_ROUND_UP, not round_up. Ah, of course. Not my day... =) From: Tomi Valkeinen Date: Thu, 18 May 2017 11:51:51 +0300 Subject: [PATCH] drm/omap: fix tiled buffer stride calculations omap_gem uses page alignment for buffer stride. The related calculations are a bit off, though, as byte stride of 4096 gets aligned to 8192, instead of 4096. This patch changes the code to use DIV_ROUND_UP(), which fixes those calculations and makes them more readable. Signed-off-by: Tomi Valkeinen diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..5c5c86ddd6f4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, size_t size = PAGE_SIZE * n; loff_t off = mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); if (m > 1) { int i; @@ -424,7 +424,7 @@ static int fault_2d(struct drm_gem_object *obj, * into account in some of the math, so figure out virtual stride * in pages */ - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); /* We don't use vmf->pgoff since that has the fake offset: */ pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT; signature.asc Description: OpenPGP digital signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/sti:fix spelling mistake: "compoment" -> "component"
2017-05-14 0:41 GMT+02:00 Colin King : > From: Colin Ian King > > Trivial fix to spelling mistake in DRM_ERROR message Thanks for your patch, I merged it in drm-misc-next branch Benjamin > > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/sti/sti_compositor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/sti/sti_compositor.c > b/drivers/gpu/drm/sti/sti_compositor.c > index 11d4e885893a..6e4bf68262db 100644 > --- a/drivers/gpu/drm/sti/sti_compositor.c > +++ b/drivers/gpu/drm/sti/sti_compositor.c > @@ -129,7 +129,7 @@ static int sti_compositor_bind(struct device *dev, > } > break; > default: > - DRM_ERROR("Unknown subdev compoment type\n"); > + DRM_ERROR("Unknown subdev component type\n"); > return 1; > } > > -- > 2.11.0 > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/omap: fix tiled buffer stride calculations
Hi Tomi, On Thursday 18 May 2017 14:34:09 Tomi Valkeinen wrote: > On 18/05/17 14:25, Laurent Pinchart wrote: > > On Thursday 18 May 2017 14:14:35 Tomi Valkeinen wrote: > >> On 18/05/17 13:59, Laurent Pinchart wrote: > >>> On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote: > omap_gem uses page alignment for buffer stride. The related > calculations > are a bit off, though, as byte stride of 4096 gets aligned to 8192, > instead of 4096. This patch fixes those calculations. > > Signed-off-by: Tomi Valkeinen > --- > > drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c > b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4 > 100644 > --- a/drivers/gpu/drm/omapdrm/omap_gem.c > +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, > size_t size = PAGE_SIZE * n; > loff_t off = mmap_offset(obj) + > (entry->obj_pgoff << PAGE_SHIFT); > -const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > +const int m = 1 + (((omap_obj->width - 1) << fmt) / > PAGE_SIZE); > >>> > >>> How about > >>> > >>> int m = round_up(omap_obj->width << fmt, PAGE_SIZE); > >>> > >>> instead of open-coding it ? I find that a bit easier to understand. > >> > >> That should be: > >> > >> round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE; > > > > Sorry, I meant DIV_ROUND_UP, not round_up. > > Ah, of course. Not my day... =) > > From: Tomi Valkeinen > Date: Thu, 18 May 2017 11:51:51 +0300 > Subject: [PATCH] drm/omap: fix tiled buffer stride calculations > > omap_gem uses page alignment for buffer stride. The related calculations > are a bit off, though, as byte stride of 4096 gets aligned to 8192, > instead of 4096. > > This patch changes the code to use DIV_ROUND_UP(), which fixes those > calculations and makes them more readable. > > Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart > diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c > b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..5c5c86ddd6f4 > 100644 > --- a/drivers/gpu/drm/omapdrm/omap_gem.c > +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj, > size_t size = PAGE_SIZE * n; > loff_t off = mmap_offset(obj) + > (entry->obj_pgoff << PAGE_SHIFT); > - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); > > if (m > 1) { > int i; > @@ -424,7 +424,7 @@ static int fault_2d(struct drm_gem_object *obj, >* into account in some of the math, so figure out virtual stride >* in pages >*/ > - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); > + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); > > /* We don't use vmf->pgoff since that has the fake offset: */ > pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT; -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/atmel-hlcdc: Fix output initialization
drm_of_find_panel_or_bridge() is expecting np to point to the encoder node, not the bridge or panel this encoder is feeding. Moreover, the endpoint parameter passed to drm_of_find_panel_or_bridge() is always set to zero, which prevents us from probing all outputs. We also move the atmel_hlcdc_rgb_output allocation after the panel/bridge detection to avoid useless allocations. Reported-by: Alexandre Belloni Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 36 +--- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 65a3bd7a0c00..423dda2785d4 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c @@ -152,8 +152,7 @@ static const struct drm_connector_funcs atmel_hlcdc_panel_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, - const struct device_node *np) +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) { struct atmel_hlcdc_dc *dc = dev->dev_private; struct atmel_hlcdc_rgb_output *output; @@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, struct drm_bridge *bridge; int ret; + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, + &panel, &bridge); + if (ret) + return ret; + output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); if (!output) return -EINVAL; @@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, output->encoder.possible_crtcs = 0x1; - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); - if (ret) - return ret; - if (panel) { output->connector.dpms = DRM_MODE_DPMS_OFF; output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; @@ -220,22 +220,14 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int atmel_hlcdc_create_outputs(struct drm_device *dev) { - struct device_node *remote; - int ret = -ENODEV; - int endpoint = 0; - - while (true) { - /* Loop thru possible multiple connections to the output */ - remote = of_graph_get_remote_node(dev->dev->of_node, 0, - endpoint++); - if (!remote) - break; - - ret = atmel_hlcdc_attach_endpoint(dev, remote); - of_node_put(remote); - if (ret) - return ret; - } + int endpoint, ret = 0; + + for (endpoint = 0; !ret; endpoint++) + ret = atmel_hlcdc_attach_endpoint(dev, endpoint); + + /* At least one device was successfully attached.*/ + if (ret == -ENODEV && endpoint) + return 0; return ret; } -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm] xf86drm: fix compile error for declare i in for loop
On Thursday, 2017-05-18 12:10:31 +0100, Emil Velikov wrote: > On 17 May 2017 at 19:16, Eric Engestrom wrote: > > On Wednesday, 2017-05-17 13:58:42 +, Yu, Qiang wrote: > >> Hi Emil, > >> > >> I didn't modify the code. I'm using Ubuntu 14.04 gcc 4.8.4, the configure > >> pass but > >> fail when compile. > >> > >> I think my gcc support c99 but needs adding "-std=c99" to enable it, and > >> the configure > >> script add it into CC variable. > > > > From the AC_PROG_CC_C99 docs: > >> If the C compiler is not in C99 mode by default, try to add an option > >> to output variable `CC` to make it so. > > > > G... Add that to the pile of reasons to move away from autotools, > > I suppose. > > > You do realise that cmake, meson and others have similar helper/macros, right? The macro isn't my issue, the fact that it puts its flags in $CC instead of $*FLAGS is. This, as well as the fact that setting $CC beforehand overrides it (the macro should append), is what I consider a bug in autotools. (Honestly, I don't remember if cmake/meson/others do the same thing) > > >> When just use "make", it's OK, but my build script uses > >> "make CC=gcc". > >> > >> If you think current state is OK, I can change my build script for that. > > > > Yes, I think you should change your build command. It's a shame that > > autotools has this bug, but we'd like to avoid changing our codebase to > > work around these, and in this case, it would mean dropping the C99 > > requirement and having to downgrade the whole codebase to something > > older. > > > Again you're miles off, I'm afraid. > > Overrides is a make thing, which allows you to use [normally > temporary] clever things. > For example: > - increase/decrease warning levels of part A in your project > - change optimisation level of components B I have no issue with any of this, as long as flags are in $*FLAGS :) > > At the same time, if you do stupid things you get to pick the pieces. > > -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/pl111: Add a debugfs node to dump our registers.
On Thu, May 18, 2017 at 2:56 AM, Eric Anholt wrote: > While debugging an X11 display failure, I wanted to see where we were > actually scanning out from. This is probably generally useful to > others that might be working on this device. > > Signed-off-by: Eric Anholt Looks helpful: Reviewed-by: Linus Walleij Yours, Linus Walleij ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/i915: Check C for null pointer rather than B
From: Colin Ian King There are two occasions where pointer B is being check for a NULL when it should be pointer C instead. Fix these. Detected by CoverityScan, CID#1436348,1436349 ("Logically Dead Code") Fixes: 47624cc3301b60 ("drm/i915: Import the kfence selftests for i915_sw_fence") Signed-off-by: Colin Ian King --- drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c index 98baf10c28c6..c31d439fae3a 100644 --- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c @@ -311,7 +311,7 @@ static int test_AB_C(void *arg) } C = alloc_fence(); - if (!B) { + if (!C) { ret = -ENOMEM; goto err_B; } @@ -388,7 +388,7 @@ static int test_C_AB(void *arg) } C = alloc_fence(); - if (!B) { + if (!C) { ret = -ENOMEM; goto err_B; } -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm] xf86drm: fix compile error for declare i in for loop
On 18 May 2017 at 13:47, Eric Engestrom wrote: >> > Yes, I think you should change your build command. It's a shame that >> > autotools has this bug, but we'd like to avoid changing our codebase to >> > work around these, and in this case, it would mean dropping the C99 >> > requirement and having to downgrade the whole codebase to something >> > older. >> > >> Again you're miles off, I'm afraid. >> >> Overrides is a make thing, which allows you to use [normally >> temporary] clever things. >> For example: >> - increase/decrease warning levels of part A in your project >> - change optimisation level of components B > > I have no issue with any of this, as long as flags are in $*FLAGS :) > AFAICT things such as -std=c99 belong to CC, since it implies the compiler itself. In a same way the "single-Unix-approved" /usr/bin/c99 does "exec gcc -std=c99 ${1+"$@"}" -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99851] [drm:.r600_ring_test [radeon]] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD)
https://bugs.freedesktop.org/show_bug.cgi?id=99851 --- Comment #30 from erhar...@mailbox.org --- The same problem on my machine: # dmesg | grep -i drm [ 11.753729] [drm] radeon kernel modesetting enabled. [ 11.760535] [drm] initializing kernel modesetting (CEDAR 0x1002:0x68F9 0x1787:0x2291 0x00). [ 11.767360] [drm] register mmio base: 0x8014 [ 11.770683] [drm] register mmio size: 131072 [ 11.899433] [drm] GPU not posted. posting now... [ 11.903067] [drm] Detected VRAM RAM=512M, BAR=256M [ 11.903068] [drm] RAM width 64bits DDR [ 11.934284] [drm] radeon: 512M of VRAM memory ready [ 11.936547] [drm] radeon: 1024M of GTT memory ready. [ 11.938855] [drm] Loading CEDAR Microcode [ 13.060828] [drm] Internal thermal controller with fan control [ 13.075872] [drm] radeon: dpm initialized [ 13.099787] [drm] GART: num cpu pages 262144, num gpu pages 262144 [ 13.151601] [drm] PCIE GART of 1024M enabled (table at 0x0014C000). [ 13.166212] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 13.166214] [drm] Driver supports precise vblank timestamp query. [ 13.166323] [drm] radeon: irq initialized. [ 13.377755] [drm:0xd1d22d04] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD) # inxi -b System:Host: T801 Kernel: 4.11.1-gentoo ppc64 (32 bit) Console: tty 0 Distro: Gentoo Base System release 2.3 Machine: No /sys/class/dmi; using dmidecode: dmidecode is not installed. CPU: Dual core PPC970MP altivec supported (-MCP-) speed/max: 2300.00MHz/2300 MHz Graphics: Card-1: NVIDIA NV43 [GeForce 6600] Card-2: Advanced Micro Devices [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series] Display Server: X.org 1.19.3 drivers: fbdev,ati,radeon,nouveau tty size: 211x52 Advanced Data: N/A for root out of X But I can confirm the ring test succeeds on kernel 4.10.16. I will try to bisect starting from the 4.11-rcs. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/i915: Check C for null pointer rather than B
On Thu, May 18, 2017 at 02:39:42PM +0100, Colin King wrote: > From: Colin Ian King > > There are two occasions where pointer B is being check for a NULL > when it should be pointer C instead. Fix these. > > Detected by CoverityScan, CID#1436348,1436349 ("Logically Dead Code") > > Fixes: 47624cc3301b60 ("drm/i915: Import the kfence selftests for > i915_sw_fence") > Signed-off-by: Colin Ian King Thanks, obviously correct and not exercised by BAT so pushed. -Chris -- Chris Wilson, Intel Open Source Technology Centre ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/4] dt-bindings: Document the Raspberry Pi Touchscreen nodes.
Hi Eric, On Tuesday 16 May 2017 11:46:36 Eric Anholt wrote: [snip] > In terms of physical connections: > >[15-pin "DSI" connector on 2835] > > | I2C | DSI >/ \SPI | > [TS] [Atmel]--[TC358762] >\| > \PWM| > \ | DPI > [some backlight]--[some unknown panel] > > The binding I'm trying to create is to expose what's necessary for a > driver that talks I2C to the Atmel, which then controls the PWM and does > the command sequence over SPI to the Toshiba that sets up its end of the > DSI link. According to the documentation I've been able to find, the TC358762 has an SPI master port through which it can output the commands DCS received from the DSI port, and an I2C slave port through which it can be configured by an external device. If the connection between the microcontroller and the TC358762 is indeed SPI and not I2C, I assume it's used by the microcontroller to receive the DCS commands and perform control of the backlight (and possibly other components) accordingly. By the way, is there any place where I can find a leaked version of the non-public panel schematics ? ;-) As far as I can tell from your patch series, you don't need to send any command to the TC358762 over DSI. In that case I would model the panel in DT as an I2C device, as all control goes through the I2C bus. The DSI video data connection should then be modelled using the OF graph DT bindings. The result will be a black box panel with a custom black box panel driver, using a single DT node. There's no need for a separate bridge instance. That's the cleanest option I can come up with so far, and I agree that splitting TC358762 support into a standalone bridge driver makes no sense in this case. -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/4] dt-bindings: Document the Raspberry Pi Touchscreen nodes.
Hi Archit, On Thursday 18 May 2017 13:56:19 Archit Taneja wrote: > On 05/17/2017 12:16 AM, Eric Anholt wrote: [snip] > > In terms of physical connections: > >[15-pin "DSI" connector on 2835] > > > > | I2C | DSI > > > >/ \SPI | > > > > [TS] [Atmel]--[TC358762] > > > >\| > > > > \PWM| > > > > \ | DPI > > > > [some backlight]--[some unknown panel] > > > > The binding I'm trying to create is to expose what's necessary for a > > driver that talks I2C to the Atmel, which then controls the PWM and does > > the command sequence over SPI to the Toshiba that sets up its end of the > > DSI link. > > The bridge (Atmel + TC358762 combination) here looks like it's primarily > an i2c device (i.e, the control bus is i2c). Therefore, the drm-bridge > driver here should be an i2c driver instead of a mipi_dsi_driver. Glad to see we agree, that's what I've proposed in a separate answer :-) I'd go one step further though, there should be no DRM bridge, just a DRM panel. > We have the facility to create a mipi DSI device without the need to have > a corresponding node in DT. The ADV7533 and TC358767 drivers are examples > of that. > > The following is what the binding could look like, it's same as what Rob > also mentioned previously in the thread. > > Thanks, > Archit > > dsi1: dsi@7e70 { > #address-cells = <1>; > #size-cells = <0>; > <...> > > /* The SoC's DSI input/output port */ > ports { > #address-cells = <1>; > #size-cells = <0>; > > /* port@0 if needed */ > > port@1 { > dsi_out_port: endpoint { > reg = <1>; > remote-endpoint = <&bridge_dsi_port>; > }; > }; > }; > }; > > i2c_dsi: i2c { > compatible = "i2c-gpio"; > #address-cells = <1>; > #size-cells = <0>; > gpios = <&gpio 28 0 >&gpio 29 0>; > > /* the Atmel + TC35872 bridge */ > pitouchscreen_bridge: bridge@45 { This should thus be lcd@45. > compatible = "raspberrypi,touchscreen-bridge"; And this raspberrypi,7inch-touchscreen-panel. Shame we haven't standardized the vendor name prefix to rpi :-/ > reg = <0x45>; > > ports { > #address-cells = <1>; > #size-cells = <0>; > > port@0 { > reg = <0>; > bridge_dsi_port: endpoint { This should be named panel_dsi_port. > remote-endpoint = <&dsi_out_port>; > }; > }; > port@1 { > reg = <1>; > bridge_dpi_port: endpoint { > remote-endpoint = <&pitouchscreen_panel_port>; > }; > }; The second port is thus not needed. > }; So we can simplify this to port { panel_dsi_port: endpoint { remote-endpoint = <&dsi_out_port>; }; }; (no need for a ports node when there's a single port) > }; > }; > > lcd { > compatible = "raspberrypi,7inch-touchscreen-panel"; > ports { > #address-cells = <1>; > #size-cells = <0>; > port@0 { > reg = <0>; > pitouchscreen_panel_port: endpoint { > remote-endpoint = <&bridge_dpi_port>; > }; > }; > }; > }; And this node can go away. -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] gpu: host1x: select IOMMU_IOVA
On Thu, Apr 20, 2017 at 09:47:35AM +0300, Mikko Perttunen wrote: > Ah, had to forget something :) > > Reviewed-by: Mikko Perttunen Applied to -misc-fixes, thank you Sean > > On 19.04.2017 21:24, Arnd Bergmann wrote: > > When IOMMU_IOVA is not built-in but host1x is, we get a link error: > > > > drivers/gpu/host1x/dev.o: In function `host1x_remove': > > dev.c:(.text.host1x_remove+0x50): undefined reference to `put_iova_domain' > > drivers/gpu/host1x/dev.o: In function `host1x_probe': > > dev.c:(.text.host1x_probe+0x31c): undefined reference to `init_iova_domain' > > dev.c:(.text.host1x_probe+0x38c): undefined reference to `put_iova_domain' > > drivers/gpu/host1x/cdma.o: In function `host1x_cdma_init': > > cdma.c:(.text.host1x_cdma_init+0x238): undefined reference to `alloc_iova' > > cdma.c:(.text.host1x_cdma_init+0x2c0): undefined reference to `__free_iova' > > drivers/gpu/host1x/cdma.o: In function `host1x_cdma_deinit': > > cdma.c:(.text.host1x_cdma_deinit+0xb0): undefined reference to `free_iova' > > > > This adds the same select statement that we have for drm_tegra. > > > > Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support") > > Signed-off-by: Arnd Bergmann > > --- > > drivers/gpu/host1x/Kconfig | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig > > index b2fd029d67b3..91916326957f 100644 > > --- a/drivers/gpu/host1x/Kconfig > > +++ b/drivers/gpu/host1x/Kconfig > > @@ -1,6 +1,7 @@ > > config TEGRA_HOST1X > > tristate "NVIDIA Tegra host1x driver" > > depends on ARCH_TEGRA || (ARM && COMPILE_TEST) > > + select IOMMU_IOVA if IOMMU_SUPPORT > > help > > Driver for the NVIDIA Tegra host1x hardware. > > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-tegra" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sean Paul, Software Engineer, Google / Chromium OS ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atmel-hlcdc: Fix output initialization
On Thu, May 18, 2017 at 02:43:07PM +0200, Alexandre Belloni wrote: > On 18/05/2017 at 14:35:21 +0200, Boris Brezillon wrote: > > drm_of_find_panel_or_bridge() is expecting np to point to the encoder > > node, not the bridge or panel this encoder is feeding. > > Moreover, the endpoint parameter passed to drm_of_find_panel_or_bridge() > > is always set to zero, which prevents us from probing all outputs. > > > > We also move the atmel_hlcdc_rgb_output allocation after the > > panel/bridge detection to avoid useless allocations. > > > > Reported-by: Alexandre Belloni > Tested-by: Alexandre Belloni Applied to -misc-fixes, thank you Sean > > > Fixes: ebc944613567 ("drm: convert drivers to use > > drm_of_find_panel_or_bridge") > > Signed-off-by: Boris Brezillon > > --- > > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 36 > > +--- > > 1 file changed, 14 insertions(+), 22 deletions(-) > > > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > > index 65a3bd7a0c00..423dda2785d4 100644 > > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > > @@ -152,8 +152,7 @@ static const struct drm_connector_funcs > > atmel_hlcdc_panel_connector_funcs = { > > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > > }; > > > > -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, > > - const struct device_node *np) > > +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int > > endpoint) > > { > > struct atmel_hlcdc_dc *dc = dev->dev_private; > > struct atmel_hlcdc_rgb_output *output; > > @@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct > > drm_device *dev, > > struct drm_bridge *bridge; > > int ret; > > > > + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, > > + &panel, &bridge); > > + if (ret) > > + return ret; > > + > > output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); > > if (!output) > > return -EINVAL; > > @@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct > > drm_device *dev, > > > > output->encoder.possible_crtcs = 0x1; > > > > - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); > > - if (ret) > > - return ret; > > - > > if (panel) { > > output->connector.dpms = DRM_MODE_DPMS_OFF; > > output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; > > @@ -220,22 +220,14 @@ static int atmel_hlcdc_attach_endpoint(struct > > drm_device *dev, > > > > int atmel_hlcdc_create_outputs(struct drm_device *dev) > > { > > - struct device_node *remote; > > - int ret = -ENODEV; > > - int endpoint = 0; > > - > > - while (true) { > > - /* Loop thru possible multiple connections to the output */ > > - remote = of_graph_get_remote_node(dev->dev->of_node, 0, > > - endpoint++); > > - if (!remote) > > - break; > > - > > - ret = atmel_hlcdc_attach_endpoint(dev, remote); > > - of_node_put(remote); > > - if (ret) > > - return ret; > > - } > > + int endpoint, ret = 0; > > + > > + for (endpoint = 0; !ret; endpoint++) > > + ret = atmel_hlcdc_attach_endpoint(dev, endpoint); > > + > > + /* At least one device was successfully attached.*/ > > + if (ret == -ENODEV && endpoint) > > + return 0; > > > > return ret; > > } > > -- > > 2.7.4 > > > > -- > Alexandre Belloni, Free Electrons > Embedded Linux and Kernel engineering > http://free-electrons.com -- Sean Paul, Software Engineer, Google / Chromium OS ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm] xf86drm: fix compile error for declare i in for loop
On 18 May 2017 at 14:46, Emil Velikov wrote: > On 18 May 2017 at 13:47, Eric Engestrom wrote: > >>> > Yes, I think you should change your build command. It's a shame that >>> > autotools has this bug, but we'd like to avoid changing our codebase to >>> > work around these, and in this case, it would mean dropping the C99 >>> > requirement and having to downgrade the whole codebase to something >>> > older. >>> > >>> Again you're miles off, I'm afraid. >>> >>> Overrides is a make thing, which allows you to use [normally >>> temporary] clever things. >>> For example: >>> - increase/decrease warning levels of part A in your project >>> - change optimisation level of components B >> >> I have no issue with any of this, as long as flags are in $*FLAGS :) >> > AFAICT things such as -std=c99 belong to CC, since it implies the > compiler itself. > In a same way the "single-Unix-approved" /usr/bin/c99 does "exec gcc > -std=c99 ${1+"$@"}" > Final note, hope it's not getting too tedious. You really want to set the compiler/etc before configure stage. Changing anything at make time can and will fail. For example: a) configure adds -std=c99 to CFLAGS b) you change the compiler to sunpro/etc (uses -xc99/-c99/etc) c) boom. -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PULL] drm-misc-fixes for 4.12
Hi Dave, 2 fixes for you, one fixes a link error that seems to have been lurking for a while, but aggrevated by rc1. The second patch fixes a bug introduced in the find_panel_or_bridge cleanup set. drm-misc-fixes-2017-05-18: Driver Changes: - host1x: Fix link error when host1x is built-in and iova is a module (Arnd) - hlcdc: Fix arguments passed to drm_of_find_panel_or_bridge (Boris) Cc: Arnd Bergmann Cc: Boris Brezillon Thanks, Sean The following changes since commit dac94e29110cd606dec37673644caf2cf6fd1dde: Merge tag 'for-4.12/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm (2017-05-17 14:21:15 -0700) are available in the git repository at: git://anongit.freedesktop.org/git/drm-misc tags/drm-misc-fixes-2017-05-18 for you to fetch changes up to 6bee9b78a7a5ea257b24d93974538938c82b1169: drm/atmel-hlcdc: Fix output initialization (2017-05-18 10:56:43 -0400) Driver Changes: - host1x: Fix link error when host1x is built-in and iova is a module (Arnd) - hlcdc: Fix arguments passed to drm_of_find_panel_or_bridge (Boris) Cc: Arnd Bergmann Cc: Boris Brezillon Arnd Bergmann (1): gpu: host1x: select IOMMU_IOVA Boris Brezillon (1): drm/atmel-hlcdc: Fix output initialization drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 36 +--- drivers/gpu/host1x/Kconfig | 1 + 2 files changed, 15 insertions(+), 22 deletions(-) -- Sean Paul, Software Engineer, Google / Chromium OS ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/4] drm/dp: start a DPCD based DP sink/branch device quirk database
On 05/18/2017 04:10 AM, Jani Nikula wrote: Face the fact, there are Display Port sink and branch devices out there in the wild that don't follow the Display Port specifications, or they have bugs, or just otherwise require special treatment. Start a common quirk database the drivers can query based on the DP device identification. At least for now, we leave the workarounds for the drivers to implement as they see fit. For starters, add a branch device that can't handle full 24-bit main link Mdiv and Ndiv main link attributes properly. Naturally, the workaround of reducing main link attributes for all devices ended up in regressions for other devices. So here we are. v2: Rebase on DRM DP desc read helpers v3: Fix the OUI memcmp blunder (Clint) Tested-by: Clinton Taylor Reviewed-by: Clinton Taylor Cc: Ville Syrjälä Cc: Dhinakaran Pandiyan Cc: Clint Taylor Cc: Adam Jackson Cc: Harry Wentland Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_dp_helper.c | 52 +++-- include/drm/drm_dp_helper.h | 32 + 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 52e0ca9a5bb1..213fb837e1c4 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -1209,6 +1209,51 @@ int drm_dp_stop_crc(struct drm_dp_aux *aux) } EXPORT_SYMBOL(drm_dp_stop_crc); +struct dpcd_quirk { + u8 oui[3]; + bool is_branch; + u32 quirks; +}; + +#define OUI(first, second, third) { (first), (second), (third) } + +static const struct dpcd_quirk dpcd_quirk_list[] = { + /* Analogix 7737 needs reduced M and N at HBR2 link rates */ + { OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) }, +}; + +#undef OUI + +/* + * Get a bit mask of DPCD quirks for the sink/branch device identified by + * ident. The quirk data is shared but it's up to the drivers to act on the + * data. + * + * For now, only the OUI (first three bytes) is used, but this may be extended + * to device identification string and hardware/firmware revisions later. + */ +static u32 +drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch) +{ + const struct dpcd_quirk *quirk; + u32 quirks = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) { + quirk = &dpcd_quirk_list[i]; + + if (quirk->is_branch != is_branch) + continue; + + if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0) + continue; + + quirks |= quirk->quirks; + } + + return quirks; +} + /** * drm_dp_read_desc - read sink/branch descriptor from DPCD * @aux: DisplayPort AUX channel @@ -1231,14 +1276,17 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, if (ret < 0) return ret; + desc->quirks = drm_dp_get_quirks(ident, is_branch); + dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); - DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n", + DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n", is_branch ? "branch" : "sink", (int)sizeof(ident->oui), ident->oui, dev_id_len, ident->device_id, ident->hw_rev >> 4, ident->hw_rev & 0xf, - ident->sw_major_rev, ident->sw_minor_rev); + ident->sw_major_rev, ident->sw_minor_rev, + desc->quirks); return 0; } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index aee5b96b51d7..717cb8496725 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1090,12 +1090,44 @@ struct drm_dp_dpcd_ident { /** * struct drm_dp_desc - DP branch/sink device descriptor * @ident: DP device identification from DPCD 0x400 (sink) or 0x500 (branch). + * @quirks: Quirks; use drm_dp_has_quirk() to query for the quirks. */ struct drm_dp_desc { struct drm_dp_dpcd_ident ident; + u32 quirks; }; int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, bool is_branch); +/** + * enum drm_dp_quirk - Display Port sink/branch device specific quirks + * + * Display Port sink and branch devices in the wild have a variety of bugs, try + * to collect them here. The quirks are shared, but it's up to the drivers to + * implement workarounds for them. + */ +enum drm_dp_quirk { + /** +* @DP_DPCD_QUIRK_LIMITED_M_N: +* +* The device requires main link attributes Mdiv and Ndiv to be limited +* to 16 bits. +*/ + DP_DPCD_QUIRK_LIMITED_M_N, +}; + +/** + * drm_dp_has_quirk() - does the DP device have a specific quirk + * @desc: Device decriptor filled by drm_dp_read_desc() +
[GIT PULL v2] drm/hdlcd: fix for calculation of scanout address
Gentle ping on this. Thanks, Liviu Hi Dave, I'm not sure what is the best tree to target this, probably v4.12-rc1 if it is too late to make it into the pull request for this merge window. Just a patch that has been in linux-next for a very long time due to lack of feedback and me going on holiday for a while. Many thanks, Liviu The following changes since commit c02ed2e75ef4c74e41e421acb4ef1494671585e8: Linux 4.11-rc4 (2017-03-26 14:15:16 -0700) are available in the git repository at: git://linux-arm.org/linux-ld.git for-upstream/hdlcd for you to fetch changes up to 1de3cd4fb49f3463679c49afe0aa9ceb133f3e49: drm: hdlcd: Fix the calculation of the scanout start address (2017-03-27 14:55:58 +0100) Liviu Dudau (1): drm: hdlcd: Fix the calculation of the scanout start address drivers/gpu/drm/arm/hdlcd_crtc.c | 47 ++-- 1 file changed, 31 insertions(+), 16 deletions(-) -- | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --- ¯\_(ツ)_/¯ ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2 -v2] drm: drop drm_[cm]alloc* helpers
On Thu, May 18, 2017 at 10:16:38AM +0200, Christian König wrote: > Am 17.05.2017 um 14:23 schrieb Michal Hocko: > > As it turned out my allyesconfig on x86_64 wasn't sufficient and 0day > > build machinery found a failure on arm architecture. It was clearly a > > typo. Now I have pushed this to my build battery with cross arch > > compilers and it passes so there shouldn't more surprises hopefully. > > Here is the v2. > > --- > > From 4a00b3ade5ca4514f7affd8de6f7119c8d5c5a86 Mon Sep 17 00:00:00 2001 > > From: Michal Hocko > > Date: Tue, 16 May 2017 11:00:47 +0200 > > Subject: [PATCH -v2] drm: drop drm_[cm]alloc* helpers > > > > Now that drm_[cm]alloc* helpers are simple one line wrappers around > > kvmalloc_array and drm_free_large is just kvfree alias we can drop > > them and replace by their native forms. > > > > This shouldn't introduce any functional change. > > > > Changes since v1 > > - fix typo in drivers/gpu//drm/etnaviv/etnaviv_gem.c - noticed by 0day > >build robot > > > > Suggested-by: Daniel Vetter > > Signed-off-by: Michal Hocko > > Acked-by: Christian König Found another conflict in vgem (grew another user there in-between), fixed that up and applied both patches to drm-misc-next. Thanks, Daniel > > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c| 16 +++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 19 > > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +-- > > drivers/gpu/drm/drm_gem.c | 6 +-- > > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 12 ++--- > > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c| 4 +- > > drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 12 ++--- > > drivers/gpu/drm/exynos/exynos_drm_gem.c| 11 +++-- > > drivers/gpu/drm/i915/i915_debugfs.c| 4 +- > > drivers/gpu/drm/i915/i915_gem.c| 4 +- > > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 34 +++--- > > drivers/gpu/drm/i915/i915_gem_gtt.c| 6 +-- > > drivers/gpu/drm/i915/i915_gem_userptr.c| 8 ++-- > > drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c | 12 ++--- > > drivers/gpu/drm/msm/msm_gem.c | 10 ++-- > > drivers/gpu/drm/radeon/radeon_cs.c | 11 +++-- > > drivers/gpu/drm/radeon/radeon_gem.c| 2 +- > > drivers/gpu/drm/radeon/radeon_ring.c | 4 +- > > drivers/gpu/drm/radeon/radeon_vm.c | 4 +- > > drivers/gpu/drm/ttm/ttm_tt.c | 13 +++--- > > drivers/gpu/drm/udl/udl_dmabuf.c | 2 +- > > drivers/gpu/drm/udl/udl_gem.c | 2 +- > > drivers/gpu/drm/vc4/vc4_gem.c | 15 +++--- > > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 27 +-- > > include/drm/drmP.h | 1 - > > include/drm/drm_mem_util.h | 53 > > -- > > 26 files changed, 126 insertions(+), 173 deletions(-) > > delete mode 100644 include/drm/drm_mem_util.h > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > > index a6649874e6ce..9f0247cdda5e 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c > > @@ -96,7 +96,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, > > int r; > > unsigned long total_size = 0; > > - array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry)); > > + array = kvmalloc_array(num_entries, sizeof(struct > > amdgpu_bo_list_entry), GFP_KERNEL); > > if (!array) > > return -ENOMEM; > > memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry)); > > @@ -148,7 +148,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device > > *adev, > > for (i = 0; i < list->num_entries; ++i) > > amdgpu_bo_unref(&list->array[i].robj); > > - drm_free_large(list->array); > > + kvfree(list->array); > > list->gds_obj = gds_obj; > > list->gws_obj = gws_obj; > > @@ -163,7 +163,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device > > *adev, > > error_free: > > while (i--) > > amdgpu_bo_unref(&array[i].robj); > > - drm_free_large(array); > > + kvfree(array); > > return r; > > } > > @@ -224,7 +224,7 @@ void amdgpu_bo_list_free(struct amdgpu_bo_list *list) > > amdgpu_bo_unref(&list->array[i].robj); > > mutex_destroy(&list->lock); > > - drm_free_large(list->array); > > + kvfree(list->array); > > kfree(list); > > } > > @@ -244,8 +244,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void > > *data, > > int r; > > - info = drm_malloc_ab(args->in.bo_number, > > -sizeof(struct drm_amdgpu_bo_list_entry)); > > + info = kvmalloc_array(args->in.bo_number, > > +
[Bug 100437] IO_PAGE_FAULT is spammed in dmesg
https://bugs.freedesktop.org/show_bug.cgi?id=100437 --- Comment #8 from Öyvind Saether --- Motherboard: MSI-A88X-G45-GAMING APU: AMD A8-7600 Graphics card: MSI RX 470 8GB Kernel: 4.11.0-2.fc26.x86_64 Screens: 3 (1080 1440 1080) I can confirm that on cold boot I too get AMD-Vi: Event logged and IO_PAGE_FAULT device messages in my dmesg and various software using the GPU hangs and stutters (Chromium with GPU acceleration turned on, mpv etc). This goes away when rebooting the powered on system. In both cases these appear in dmesg: [1.795617] amdgpu: [powerplay] [AVFS] Something is broken. See log! [1.797502] amdgpu: [powerplay] Can't find requested voltage id in vdd_dep_on_sclk table! It seems a bit odd that this bug has the "workaround" which is turn it on then reboot it. If there are some useful commands I can type in to dump something that would help or logs I should paste then feel free to let me know. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3] drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
vmwgfx part: Reviewed-by: Sinclair Yeh On Wed, May 17, 2017 at 09:39:11PM -0400, Robert Foss wrote: > Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI > as a convenience. > > Ideally the DRM_ROTATE_ and DRM_REFLECT_ property ids are looked up > through the atomic API, but realizing that userspace is likely to take > shortcuts and assume that the enum values are what is sent over the > wire. > > As a result these defines are provided purely as a convenience to > userspace applications. > > Signed-off-by: Robert Foss > --- > Changes since v2: > - Changed define prefix from DRM_MODE_PROP_ to DRM_MODE_ > - Fix compilation errors > - Changed comment formatting > - Deduplicated comment lines > - Clarified DRM_MODE_PROP_REFLECT_ comment > > Changes since v1: > - Moved defines from drm.h to drm_mode.h > - Changed define prefix from DRM_ to DRM_MODE_PROP_ > - Updated uses of the defines to the new prefix > - Removed include from drm_rect.c > - Stopped using the BIT() macro > > drivers/gpu/drm/arm/malidp_drv.h| 2 +- > drivers/gpu/drm/arm/malidp_planes.c | 18 - > drivers/gpu/drm/armada/armada_overlay.c | 2 +- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 20 +- > drivers/gpu/drm/drm_atomic.c| 2 +- > drivers/gpu/drm/drm_atomic_helper.c | 2 +- > drivers/gpu/drm/drm_blend.c | 43 ++--- > drivers/gpu/drm/drm_fb_helper.c | 4 +- > drivers/gpu/drm/drm_plane_helper.c | 2 +- > drivers/gpu/drm/drm_rect.c | 36 +- > drivers/gpu/drm/i915/i915_debugfs.c | 14 +++ > drivers/gpu/drm/i915/intel_atomic_plane.c | 6 +-- > drivers/gpu/drm/i915/intel_display.c| 50 > - > drivers/gpu/drm/i915/intel_fbc.c| 2 +- > drivers/gpu/drm/i915/intel_fbdev.c | 2 +- > drivers/gpu/drm/i915/intel_sprite.c | 20 +- > drivers/gpu/drm/imx/ipuv3-plane.c | 2 +- > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 30 +++ > drivers/gpu/drm/nouveau/nv50_display.c | 2 +- > drivers/gpu/drm/omapdrm/omap_drv.c | 4 +- > drivers/gpu/drm/omapdrm/omap_fb.c | 18 - > drivers/gpu/drm/omapdrm/omap_plane.c| 16 > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- > include/drm/drm_blend.h | 21 +-- > include/uapi/drm/drm_mode.h | 49 +++- > 25 files changed, 201 insertions(+), 170 deletions(-) > > diff --git a/drivers/gpu/drm/arm/malidp_drv.h > b/drivers/gpu/drm/arm/malidp_drv.h > index 040311ffcaec..2e2033140efc 100644 > --- a/drivers/gpu/drm/arm/malidp_drv.h > +++ b/drivers/gpu/drm/arm/malidp_drv.h > @@ -65,6 +65,6 @@ void malidp_de_planes_destroy(struct drm_device *drm); > int malidp_crtc_init(struct drm_device *drm); > > /* often used combination of rotational bits */ > -#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270) > +#define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270) > > #endif /* __MALIDP_DRV_H__ */ > diff --git a/drivers/gpu/drm/arm/malidp_planes.c > b/drivers/gpu/drm/arm/malidp_planes.c > index 814fda23cead..063a8d2b0be3 100644 > --- a/drivers/gpu/drm/arm/malidp_planes.c > +++ b/drivers/gpu/drm/arm/malidp_planes.c > @@ -80,7 +80,7 @@ static void malidp_plane_reset(struct drm_plane *plane) > state = kzalloc(sizeof(*state), GFP_KERNEL); > if (state) { > state->base.plane = plane; > - state->base.rotation = DRM_ROTATE_0; > + state->base.rotation = DRM_MODE_ROTATE_0; > plane->state = &state->base; > } > } > @@ -221,7 +221,7 @@ static int malidp_de_plane_check(struct drm_plane *plane, > return ret; > > /* packed RGB888 / BGR888 can't be rotated or flipped */ > - if (state->rotation != DRM_ROTATE_0 && > + if (state->rotation != DRM_MODE_ROTATE_0 && > (fb->format->format == DRM_FORMAT_RGB888 || >fb->format->format == DRM_FORMAT_BGR888)) > return -EINVAL; > @@ -315,12 +315,12 @@ static void malidp_de_plane_update(struct drm_plane > *plane, > val &= ~LAYER_ROT_MASK; > > /* setup the rotation and axis flip bits */ > - if (plane->state->rotation & DRM_ROTATE_MASK) > - val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) << > + if (plane->state->rotation & DRM_MODE_ROTATE_MASK) > + val |= ilog2(plane->state->rotation & DRM_MODE_ROTATE_MASK) << > LAYER_ROT_OFFSET; > - if (plane->state->rotation & DRM_REFLECT_X) > + if (plane->state->rotation & DRM_MODE_REFLECT_X) > val |= LAYER_H_FLIP; > - if (plane->state->rotation & DRM_REFLECT_Y) > + if (plane->state->rotation & DRM_MODE_REFL
Re: (radeon?) WARNING: drivers/gpu/drm/drm_irq.c:1195 drm_vblank_put (v4.11-12441-g56868a4)
2017-05-11 5:51 GMT+03:00 Michel Dänzer : > On 11/05/17 04:33 AM, Tommi Rantala wrote: >> Complete kernel log: >> http://termbin.com/dzy5 >> >> [ 249.952546] [ cut here ] >> [ 249.952593] WARNING: CPU: 5 PID: 0 at >> /home/ttrantal/git/linux/drivers/gpu/drm/drm_irq.c:1195 >> drm_vblank_put+0xc4/0x120 [drm] >> [ 249.952596] Modules linked in: fuse tun bridge stp llc af_packet >> pl2303 usbserial shpchp acpi_cpufreq binfmt_misc amdgpu hid_generic >> uhci_hcd radeon 3c59x mii tg3 ehci_pci ehci_hcd i2c_algo_bit >> drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm >> agpgart unix autofs4 >> [ 249.952675] CPU: 5 PID: 0 Comm: swapper/5 Tainted: GW >> 4.11.0+ #4 >> [ 249.952678] Hardware name: Hewlett-Packard HP xw6600 >> Workstation/0A9Ch, BIOS 786F4 v01.46 09/20/2012 >> [ 249.952681] task: 88080aea task.stack: c900031b >> [ 249.952695] RIP: 0010:drm_vblank_put+0xc4/0x120 [drm] >> [ 249.952698] RSP: 0018:88080f003d70 EFLAGS: 00010046 >> [ 249.952703] RAX: RBX: 880801d53000 RCX: >> >> [ 249.952706] RDX: RSI: RDI: >> 88080a4ac000 >> [ 249.952709] RBP: 88080f003d88 R08: 0001 R09: >> 0003 >> [ 249.952711] R10: 88080f003d08 R11: 001da540 R12: >> 88080a4ac000 >> [ 249.952714] R13: R14: 0086 R15: >> 8808019a >> [ 249.952717] FS: () GS:88080f00() >> knlGS: >> [ 249.952720] CS: 0010 DS: ES: CR0: 80050033 >> [ 249.952723] CR2: 7f8bcc3a5810 CR3: 000808789000 CR4: >> 06e0 >> [ 249.952726] Call Trace: >> [ 249.952731] >> [ 249.952746] drm_crtc_vblank_put+0x1b/0x30 [drm] >> [ 249.952813] radeon_crtc_handle_flip+0xdc/0x140 [radeon] >> [ 249.952843] si_irq_process+0x610/0x1e90 [radeon] >> [ 249.952872] radeon_driver_irq_handler_kms+0x39/0xc0 [radeon] >> [ 249.952881] __handle_irq_event_percpu+0x60/0x580 >> [ 249.952887] handle_irq_event_percpu+0x20/0x90 >> [ 249.952892] handle_irq_event+0x46/0xb0 >> [ 249.952897] handle_edge_irq+0x13d/0x370 >> [ 249.952903] handle_irq+0x66/0x210 >> [ 249.952908] ? __local_bh_enable+0x34/0x50 >> [ 249.952914] do_IRQ+0x7e/0x1b0 >> [ 249.952920] common_interrupt+0x95/0x95 > > Weird, not sure how this could happen. Can you bisect? Hi, Bisection points to this (also manually applied commit 9739e74646 while testing, got kernel oops otherwise): commit 29dc0d1de18239cf3ef8bab578b8321ed340d81c Author: Daniel Vetter Date: Wed Mar 22 22:50:49 2017 +0100 drm: Roll out acquire context for the page_flip ioctl Again just prep work. Reviewed-by: Harry Wentland Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20170322215058.8671-11-daniel.vet...@ffwll.ch I'm also seeing some more warnings in this version: May 18 19:21:55 xw6600 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp14s0: link becomes ready May 18 19:21:57 xw6600 kernel: [ cut here ] May 18 19:21:57 xw6600 kernel: WARNING: CPU: 5 PID: 4607 at /home/ttrantal/git/linux/drivers/gpu/drm/drm_modeset_lock.c:193 drm_modeset_lock_crtc+0xe5/0x100 [drm] May 18 19:21:57 xw6600 kernel: Modules linked in: tun bridge stp llc af_packet pl2303 usbserial shpchp acpi_cpufreq binfmt_misc amdgpu hid_generic uhci_hcd radeon 3c59x mii i2c_algo_bit drm_kms_helper tg3 syscopyarea sysfillrect sysimgblt May 18 19:21:57 xw6600 kernel: CPU: 5 PID: 4607 Comm: gnome-shell Not tainted 4.11.0-rc3-00944-g29dc0d1-dirty #30 May 18 19:21:57 xw6600 kernel: Hardware name: Hewlett-Packard HP xw6600 Workstation/0A9Ch, BIOS 786F4 v01.46 09/20/2012 May 18 19:21:57 xw6600 kernel: Call Trace: May 18 19:21:57 xw6600 kernel: dump_stack+0x69/0x9b May 18 19:21:57 xw6600 kernel: __warn+0xff/0x140 May 18 19:21:57 xw6600 kernel: warn_slowpath_null+0x18/0x20 May 18 19:21:57 xw6600 kernel: drm_modeset_lock_crtc+0xe5/0x100 [drm] May 18 19:21:57 xw6600 kernel: drm_mode_cursor_common+0xbd/0x200 [drm] May 18 19:21:57 xw6600 kernel: drm_mode_cursor_ioctl+0x3c/0x40 [drm] May 18 19:21:57 xw6600 kernel: drm_ioctl+0x3ea/0x870 [drm] May 18 19:21:57 xw6600 kernel: ? drm_mode_setplane+0x1a0/0x1a0 [drm] May 18 19:21:57 xw6600 kernel: ? trace_hardirqs_on_caller+0x1ad/0x2c0 May 18 19:21:57 xw6600 kernel: ? trace_hardirqs_on+0xd/0x10 May 18 19:21:57 xw6600 kernel: radeon_drm_ioctl+0x6e/0x110 [radeon] May 18 19:21:57 xw6600 kernel: do_vfs_ioctl+0xac/0x9d0 May 18 19:21:57 xw6600 kernel: ? security_file_ioctl+0x4c/0x80 May 18 19:21:57 xw6600 kernel: SyS_ioctl+0x74/0x80 May 18 19:21:57 xw6600 kernel: entry_SYSCALL_64_fastpath+0x18/0xad May 18 19:21:57 xw6600 kernel: RIP: 0033:0x7f98d9e52787 May 18 19:21:57 xw6600 kernel: RSP: 002b:7ffe12ca5938 EFLAGS: 0246 ORIG_RAX: 0010 May 18 19:21:57 xw6600 kernel: RAX: ffda RBX: 0046 RCX
[PATCH 3/5] ASoC: hdmi-codec: remove multi detection support
From: Kuninori Morimoto DesignWare HDMI driver (= dw-hdmi) is supporting HDMI sound, and its probe function was calling sound binding function multiple times as same HDMI device different port. Because of this behavior, commit 9731f82d601 ("ASoC: hdmi-codec: enable multi probe for ...") was added for multi detection case. But, this DesignWare HDMI detection/bind code was exchanged/adjusted by commit 69497eb9234 ("drm: bridge: dw-hdmi: Implement DRM bridge..."). Now, all DesignWare HDMI sound ports are detected as 1 bindng function. Because of this, hdmi-codec multi detection support is no longer needed. Thus, this patch removes commit 9731f82d601 ("ASoC: hdmi-codec: enable multi probe for ..."), and its related commit 340327a62c4 ("ASoC: hdmi-codec: Fix hdmi_of_xlate_dai_name...") commit 8480ac56795 ("ASoC: hdmi-codec: remove HDMI device unregister") commit 0c343a35bfe ("ASoC: hdmi-codec: fix spelling mistake: ...) Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/hdmi-codec.c | 88 ++- 1 file changed, 3 insertions(+), 85 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index a3f1514..8659b76 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -25,17 +25,6 @@ #include /* This is only to get MAX_ELD_BYTES */ -struct hdmi_device { - struct device *dev; - struct list_head list; - int cnt; -}; -#define pos_to_hdmi_device(pos)container_of((pos), struct hdmi_device, list) -LIST_HEAD(hdmi_device_list); -static DEFINE_MUTEX(hdmi_mutex); - -#define DAI_NAME_SIZE 16 - #define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1 struct hdmi_codec_channel_map_table { @@ -702,6 +691,7 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, } static struct snd_soc_dai_driver hdmi_i2s_dai = { + .name = "i2s-hifi", .id = DAI_ID_I2S, .playback = { .stream_name = "Playback", @@ -716,6 +706,7 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, }; static const struct snd_soc_dai_driver hdmi_spdif_dai = { + .name = "spdif-hifi", .id = DAI_ID_SPDIF, .playback = { .stream_name = "Playback", @@ -728,32 +719,6 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, .pcm_new = hdmi_codec_pcm_new, }; -static char hdmi_dai_name[][DAI_NAME_SIZE] = { - "hdmi-hifi.0", - "hdmi-hifi.1", - "hdmi-hifi.2", - "hdmi-hifi.3", -}; - -static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, - struct of_phandle_args *args, - const char **dai_name) -{ - int id; - - if (args->args_count) - id = args->args[0]; - else - id = 0; - - if (id < ARRAY_SIZE(hdmi_dai_name)) { - *dai_name = hdmi_dai_name[id]; - return 0; - } - - return -EAGAIN; -} - static struct snd_soc_codec_driver hdmi_codec = { .component_driver = { .controls = hdmi_controls, @@ -762,7 +727,6 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), .dapm_routes= hdmi_routes, .num_dapm_routes= ARRAY_SIZE(hdmi_routes), - .of_xlate_dai_name = hdmi_of_xlate_dai_name, }, }; @@ -771,8 +735,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct hdmi_codec_priv *hcp; - struct hdmi_device *hd; - struct list_head *pos; int dai_count, i = 0; int ret; @@ -794,35 +756,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) if (!hcp) return -ENOMEM; - hd = NULL; - mutex_lock(&hdmi_mutex); - list_for_each(pos, &hdmi_device_list) { - struct hdmi_device *tmp = pos_to_hdmi_device(pos); - - if (tmp->dev == dev->parent) { - hd = tmp; - break; - } - } - - if (!hd) { - hd = devm_kzalloc(dev, sizeof(*hd), GFP_KERNEL); - if (!hd) { - mutex_unlock(&hdmi_mutex); - return -ENOMEM; - } - - hd->dev = dev->parent; - - list_add_tail(&hd->list, &hdmi_device_list); - } - mutex_unlock(&hdmi_mutex); - - if (hd->cnt >= ARRAY_SIZE(hdmi_dai_name)) { - dev_err(dev, "too many hdmi codec are detected\n"); - return -EINVAL; - } - hcp->hcd = *hcd; mutex_init(&hcp->current_stream_lock); @@ -835,14 +768,11 @@ static int hdmi_codec_probe(struct platform_device *pdev) hcp->daidr
[PATCH v3 12/16] drm/stm: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/stm/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/stm/Makefile b/drivers/gpu/drm/stm/Makefile index e114d45..a09ecf4 100644 --- a/drivers/gpu/drm/stm/Makefile +++ b/drivers/gpu/drm/stm/Makefile @@ -1,5 +1,3 @@ -ccflags-y := -Iinclude/drm - stm-drm-y := \ drv.o \ ltdc.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 02/16] drm/virtio: fix include notation and remove -Iinclude/drm flag
Include instead of relative path from include/drm, then remove the -Iinclude/drm compiler flag. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/virtio/Makefile | 2 -- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_drv.h | 8 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile index 3fb8eac..7684f61 100644 --- a/drivers/gpu/drm/virtio/Makefile +++ b/drivers/gpu/drm/virtio/Makefile @@ -2,8 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm - virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \ virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \ virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \ diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c index f51240a..73dc990 100644 --- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c +++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c @@ -24,8 +24,8 @@ */ #include +#include -#include "drmP.h" #include "virtgpu_drv.h" static int diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index 2d29b01..63d35c7 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -29,8 +29,8 @@ #include #include #include -#include "drmP.h" -#include "drm/drm.h" +#include +#include #include "virtgpu_drv.h" static struct drm_driver driver; diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 1328185..3a66abb 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -36,10 +36,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #define DRIVER_NAME "virtio_gpu" #define DRIVER_DESC "virtio GPU" diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 61f3a96..06cb16d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -26,9 +26,10 @@ */ #include -#include "virtgpu_drv.h" #include -#include "ttm/ttm_execbuf_util.h" +#include + +#include "virtgpu_drv.h" static void convert_to_hw_box(struct virtio_gpu_box *dst, const struct drm_virtgpu_3d_box *src) diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c index 4e8e27d..c1f2af4 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ttm.c +++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c @@ -25,11 +25,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 16/16] drm/via: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/via/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/via/Makefile b/drivers/gpu/drm/via/Makefile index d59e258..751fa8b 100644 --- a/drivers/gpu/drm/via/Makefile +++ b/drivers/gpu/drm/via/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm via-y:= via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o obj-$(CONFIG_DRM_VIA) +=via.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 14/16] drm/udl: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/udl/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/udl/Makefile b/drivers/gpu/drm/udl/Makefile index 195bcac..36f2e82 100644 --- a/drivers/gpu/drm/udl/Makefile +++ b/drivers/gpu/drm/udl/Makefile @@ -1,6 +1,3 @@ - -ccflags-y := -Iinclude/drm - udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o obj-$(CONFIG_DRM_UDL) := udl.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 04/16] drm/gma500: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/gma500/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile index 190e55f..c1c8dc1 100644 --- a/drivers/gpu/drm/gma500/Makefile +++ b/drivers/gpu/drm/gma500/Makefile @@ -1,7 +1,6 @@ # # KMS driver for the GMA500 # -ccflags-y += -I$(srctree)/include/drm gma500_gfx-y += \ accel_2d.o \ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/5] ASoC: add snd_soc_get_dai_id() function
From: Kuninori Morimoto ALSA SoC needs to know connected DAI ID for detecting. It is not a big problem if device/driver was only for sound, but getting DAI ID will be difficult if device includes both Video/Sound, like HDMI. To solve this issue, this patch adds new snd_soc_get_dai_id() and its related .of_xlate_dai_id callback on component driver. In below case, we can handle Sound port (= port@2) as ID = 0 if .of_xlate_dai_id has its support. hdmi { port@0 { /* VIDEO */ }; port@1 { /* VIDEO */ }; port@2 { /* SOUND */ }; }; Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 37 + 2 files changed, 40 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 5170fd8..9c94b97 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -803,6 +803,8 @@ struct snd_soc_component_driver { int (*of_xlate_dai_name)(struct snd_soc_component *component, struct of_phandle_args *args, const char **dai_name); + int (*of_xlate_dai_id)(struct snd_soc_component *comment, + struct device_node *endpoint); void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, int subseq); int (*stream_event)(struct snd_soc_component *, int event); @@ -1676,6 +1678,7 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, struct device_node **framemaster); +int snd_soc_get_dai_id(struct device_node *ep); int snd_soc_get_dai_name(struct of_phandle_args *args, const char **dai_name); int snd_soc_of_get_dai_name(struct device_node *of_node, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ab7a07f..9ba1837 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -4048,6 +4049,42 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); +int snd_soc_get_dai_id(struct device_node *ep) +{ + struct snd_soc_component *pos; + struct device_node *node; + int ret; + + node = of_graph_get_port_parent(ep); + + /* +* For example HDMI case, HDMI has video/sound port, +* but ALSA SoC needs sound port number only. +* Thus counting HDMI DT port/endpoint doesn't work. +* Then, it should have .of_xlate_dai_id +*/ + ret = -ENOTSUPP; + mutex_lock(&client_mutex); + list_for_each_entry(pos, &component_list, list) { + struct device_node *component_of_node = pos->dev->of_node; + + if (!component_of_node && pos->dev->parent) + component_of_node = pos->dev->parent->of_node; + + if (component_of_node != node) + continue; + + if (pos->driver->of_xlate_dai_id) + ret = pos->driver->of_xlate_dai_id(pos, ep); + + break; + } + mutex_unlock(&client_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_get_dai_id); + int snd_soc_get_dai_name(struct of_phandle_args *args, const char **dai_name) { -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/amd: include instead of "linux/delay.h"
Use <...> notation to include headers located in include/linux. While we are here, tweak the includes order a bit to sort them alphabetically. Signed-off-by: Masahiro Yamada --- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c| 4 ++-- drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++-- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 +++-- drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 8 +--- drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c | 5 +++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index ff4ae3d..963a9e0 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c @@ -22,10 +22,10 @@ */ #include "pp_debug.h" -#include "linux/delay.h" -#include +#include #include #include +#include #include #include "cgs_common.h" #include "power_state.h" diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c index f5e8fda..f6b4dd9 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c @@ -21,8 +21,8 @@ * */ +#include #include -#include "linux/delay.h" #include "hwmgr.h" #include "amd_acpi.h" #include "pp_acpi.h" diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 8f663ab..581374d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c @@ -21,11 +21,11 @@ * */ #include "pp_debug.h" +#include +#include #include #include -#include #include -#include "linux/delay.h" #include "pp_acpi.h" #include "ppatomctrl.h" #include "atombios.h" diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index 8394955..f4ab81b 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c @@ -20,10 +20,11 @@ * OTHER DEALINGS IN THE SOFTWARE. * */ + +#include +#include #include #include -#include -#include "linux/delay.h" #include "hwmgr.h" #include "amd_powerplay.h" diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c index 1f6744a..39c7091 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c @@ -20,11 +20,13 @@ * OTHER DEALINGS IN THE SOFTWARE. * */ -#include + +#include +#include #include #include -#include -#include "linux/delay.h" +#include + #include "cgs_common.h" #include "smu/smu_8_0_d.h" #include "smu/smu_8_0_sh_mask.h" diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c index c0d7576..2e954a4 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c @@ -20,15 +20,16 @@ * OTHER DEALINGS IN THE SOFTWARE. * */ -#include + +#include #include #include #include +#include #include #include "pp_instance.h" #include "smumgr.h" #include "cgs_common.h" -#include "linux/delay.h" MODULE_FIRMWARE("amdgpu/topaz_smc.bin"); MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin"); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] gpu: host1x: Refactor/fix channel allocation code
On 20.03.2017 21:44, Mikko Perttunen wrote: > This is largely a rewrite of the Host1x channel allocation > code in channel.c, bringing several changes: > > - The previous code could deadlock due to an interaction > between the 'reflock' mutex and CDMA timeout handling. > This gets rid of the mutex. > - In the future, per-user channel allocation will be > useful to have. This paves the way for that by allowing > host1x_channel_request to wait for a free channel, and > freeing channels when their refcount drops to zero. > - Support for more than 32 channels, required for Tegra186 > - General refactoring, including better encapsulation > of channel ownership handling into channel.c > > Signed-off-by: Mikko Perttunen > --- > Ran though test suite at github.com/cyndis/host1x_test. > Fixes the timeout test there. > > drivers/gpu/drm/tegra/gr2d.c | 6 +- > drivers/gpu/drm/tegra/gr3d.c | 6 +- > drivers/gpu/drm/tegra/vic.c| 6 +- > drivers/gpu/host1x/cdma.c | 2 +- > drivers/gpu/host1x/channel.c | 154 > +++-- > drivers/gpu/host1x/channel.h | 28 --- > drivers/gpu/host1x/debug.c | 49 +--- > drivers/gpu/host1x/dev.c | 6 +- > drivers/gpu/host1x/dev.h | 8 +- > drivers/gpu/host1x/hw/channel_hw.c | 12 +-- > include/linux/host1x.h | 1 - > 11 files changed, 155 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c > index 02cd3e37a6ec..936ce1a55987 100644 > --- a/drivers/gpu/drm/tegra/gr2d.c > +++ b/drivers/gpu/drm/tegra/gr2d.c > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2012-2013, NVIDIA Corporation. > + * Copyright (c) 2012-2017, NVIDIA Corporation. > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License version 2 as > @@ -38,7 +38,7 @@ static int gr2d_init(struct host1x_client *client) > > client->syncpts[0] = host1x_syncpt_request(client->dev, flags); > if (!client->syncpts[0]) { > - host1x_channel_free(gr2d->channel); > + host1x_channel_put(gr2d->channel); > return -ENOMEM; > } > > @@ -57,7 +57,7 @@ static int gr2d_exit(struct host1x_client *client) > return err; > > host1x_syncpt_free(client->syncpts[0]); > - host1x_channel_free(gr2d->channel); > + host1x_channel_put(gr2d->channel); > > return 0; > } > diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c > index 13f0d1b7cd98..da02230c58ef 100644 > --- a/drivers/gpu/drm/tegra/gr3d.c > +++ b/drivers/gpu/drm/tegra/gr3d.c > @@ -1,6 +1,6 @@ > /* > * Copyright (C) 2013 Avionic Design GmbH > - * Copyright (C) 2013 NVIDIA Corporation > + * Copyright (C) 2013-2017 NVIDIA Corporation > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License version 2 as > @@ -48,7 +48,7 @@ static int gr3d_init(struct host1x_client *client) > > client->syncpts[0] = host1x_syncpt_request(client->dev, flags); > if (!client->syncpts[0]) { > - host1x_channel_free(gr3d->channel); > + host1x_channel_put(gr3d->channel); > return -ENOMEM; > } > > @@ -67,7 +67,7 @@ static int gr3d_exit(struct host1x_client *client) > return err; > > host1x_syncpt_free(client->syncpts[0]); > - host1x_channel_free(gr3d->channel); > + host1x_channel_put(gr3d->channel); > > return 0; > } > diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c > index cd804e404a11..5a36adfc01f6 100644 > --- a/drivers/gpu/drm/tegra/vic.c > +++ b/drivers/gpu/drm/tegra/vic.c > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2015, NVIDIA Corporation. > + * Copyright (c) 2015-2017, NVIDIA Corporation. > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License version 2 as > @@ -182,7 +182,7 @@ static int vic_init(struct host1x_client *client) > free_syncpt: > host1x_syncpt_free(client->syncpts[0]); > free_channel: > - host1x_channel_free(vic->channel); > + host1x_channel_put(vic->channel); > detach_device: > if (tegra->domain) > iommu_detach_device(tegra->domain, vic->dev); > @@ -203,7 +203,7 @@ static int vic_exit(struct host1x_client *client) > return err; > > host1x_syncpt_free(client->syncpts[0]); > - host1x_channel_free(vic->channel); > + host1x_channel_put(vic->channel); > > if (vic->domain) { > iommu_detach_device(vic->domain, vic->dev); > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c > index 28541b280739..d7c1e269ed67 100644 > --- a/drivers/gpu/host1x/cdma.c > +++ b/drivers/gpu/host1x/cdma.c > @@ -1,7 +1,7 @@ > /* > * Tegra host1x Command
[PATCH 5/5] drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC
From: Kuninori Morimoto ALSA SoC needs to know connected DAI ID for probing. It is not a big problem if device/driver was only for sound, but getting DAI ID will be difficult if device includes both Video/Sound, like HDMI. To solve this issue, this patch adds new .get_dai_id callback on hdmi_codec_ops. dw-hdmi-i2s will assume that HDMI sound will be connected to reg = <2>. Then, ALSA SoC side will recognized it as DAI 0 ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; /* HDMI Video IN */ }; port@1 { reg = <1>; /* HDMI OUT */ }; port@2 { reg = <2>; /* HDMI Sound IN */ }; }; Signed-off-by: Kuninori Morimoto --- .../bindings/display/bridge/renesas,dw-hdmi.txt | 9 - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 21 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt index f6b3f36..81b6858 100644 --- a/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt +++ b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt @@ -25,7 +25,8 @@ Required properties: - clock-names: Shall contain "iahb" and "isfr" as defined in dw_hdmi.txt. - ports: See dw_hdmi.txt. The DWC HDMI shall have one port numbered 0 corresponding to the video input of the controller and one port numbered 1 - corresponding to its HDMI output. Each port shall have a single endpoint. + corresponding to its HDMI output, and one port numbered 2 corresponding to + sound input of the controller. Each port shall have a single endpoint. Optional properties: @@ -59,6 +60,12 @@ Example: remote-endpoint = <&hdmi0_con>; }; }; + port@2 { + reg = <2>; + rcar_dw_hdmi0_sound_in: endpoint { + remote-endpoint = <&hdmi_sound_out>; + }; + }; }; }; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index aaf287d..b2cf59f 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -82,9 +82,30 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); } +static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, + struct device_node *endpoint) +{ + struct of_endpoint of_ep; + int ret; + + ret = of_graph_parse_endpoint(endpoint, &of_ep); + if (ret < 0) + return ret; + + /* +* HDMI sound should be located as reg = <2> +* Then, it is sound port 0 +*/ + if (of_ep.port == 2) + return 0; + + return -EINVAL; +} + static struct hdmi_codec_ops dw_hdmi_i2s_ops = { .hw_params = dw_hdmi_i2s_hw_params, .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + .get_dai_id = dw_hdmi_i2s_get_dai_id, }; static int snd_dw_hdmi_probe(struct platform_device *pdev) -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/5] ASoC: add HDMI sound support for Codec
Hi Mark, Archit These supports HDMI sound for Codec. Now, SYNOPSYS dw-hdmi-i2s-audio driver is supporting HDMI I2S and is using hdmi-codec driver. Now, ALSA SoC supports OF-graph DT style, this means V4L2/ALSA SoC can share same DT bindings. But 1 issue is that ALSA SoC side needs to adjust port ID <-> Sound DAI matching. 1) - 4) are for these purpose. 1) - 4) : ASoC side patch for hdmi-codec 5) : V4L2 side patch for SYNOPSYS dw-hdmi Kuninori Morimoto (5): 1) ASoC: add snd_soc_get_dai_id() function 2) ASoC: simple-card-utils: support snd_soc_get_dai_id() 3) ASoC: hdmi-codec: remove multi detection support 4) ASoC: hdmi-codec: add .get_dai_id support 5) drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC .../bindings/display/bridge/renesas,dw-hdmi.txt| 9 ++- .../gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c| 21 + include/sound/hdmi-codec.h | 9 +++ include/sound/soc.h| 3 + sound/soc/codecs/hdmi-codec.c | 91 +++--- sound/soc/generic/simple-card-utils.c | 9 +++ sound/soc/soc-core.c | 37 + 7 files changed, 98 insertions(+), 81 deletions(-) -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 10/16] drm/savage: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/savage/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/savage/Makefile b/drivers/gpu/drm/savage/Makefile index d8f84ac..cfd436b 100644 --- a/drivers/gpu/drm/savage/Makefile +++ b/drivers/gpu/drm/savage/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y = -Iinclude/drm savage-y := savage_drv.o savage_bci.o savage_state.o obj-$(CONFIG_DRM_SAVAGE)+= savage.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] gpu: host1x: Refactor/fix channel allocation code
On 18.05.2017 14:55, Mikko Perttunen wrote: > On 18.05.2017 14:42, Dmitry Osipenko wrote: >> On 20.03.2017 21:44, Mikko Perttunen wrote: >>> ... >>> struct host1x_channel *host1x_channel_request(struct device *dev) >>> { >>> struct host1x *host = dev_get_drvdata(dev->parent); >>> +struct host1x_channel_list *chlist = &host->channel_list; >>> unsigned int max_channels = host->info->nb_channels; >>> struct host1x_channel *channel = NULL; >>> -unsigned long index; >>> +unsigned int index; >>> int err; >>> >>> -mutex_lock(&host->chlist_mutex); >>> +down(&chlist->alloc_sema); >>> + >> >> It's a bit hard to follow lockings in the code, could you please explain why >> you've added this semaphore? What problem it solves? > > Sure. The role of the semaphore is to allow the caller to sleep waiting for a > free channel, and also to be sure that a channel is available once the down() > call finishes. Currently the channel allocation model is such that each unit > allocates a single channel for itself, in which case this is not useful, but > with later chips with more available channels we can move to a model where a > channel is allocated for each userspace client. In this case we can allow the > application to sleep if there are no available channels. > > Of course, there is also the possibility of just returning -EBUSY if there are > no channels - that's probably fine too.. > Currently, the host1x_channel_request() is only invoked during the drivers probe routine, it has nothing to do with userspace. I'd suggest to drop that semaphore from the patch since it's unrelated to the current channel allocation model. -- Dmitry ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] gpu: host1x: Refactor/fix channel allocation code
On 18.05.2017 14:42, Dmitry Osipenko wrote: On 20.03.2017 21:44, Mikko Perttunen wrote: ... struct host1x_channel *host1x_channel_request(struct device *dev) { struct host1x *host = dev_get_drvdata(dev->parent); + struct host1x_channel_list *chlist = &host->channel_list; unsigned int max_channels = host->info->nb_channels; struct host1x_channel *channel = NULL; - unsigned long index; + unsigned int index; int err; - mutex_lock(&host->chlist_mutex); + down(&chlist->alloc_sema); + It's a bit hard to follow lockings in the code, could you please explain why you've added this semaphore? What problem it solves? Sure. The role of the semaphore is to allow the caller to sleep waiting for a free channel, and also to be sure that a channel is available once the down() call finishes. Currently the channel allocation model is such that each unit allocates a single channel for itself, in which case this is not useful, but with later chips with more available channels we can move to a model where a channel is allocated for each userspace client. In this case we can allow the application to sleep if there are no available channels. Of course, there is also the possibility of just returning -EBUSY if there are no channels - that's probably fine too.. Cheers, Mikko. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 03/16] drm/vmwgfx: fix include notation and remove -Iinclude/drm flag
Include instead of relative path from include/drm, then remove the -Iinclude/drm compiler flag. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/vmwgfx/Makefile | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 ++- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile index aac17a6..a365330 100644 --- a/drivers/gpu/drm/vmwgfx/Makefile +++ b/drivers/gpu/drm/vmwgfx/Makefile @@ -1,6 +1,3 @@ - -ccflags-y := -Iinclude/drm - vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \ vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \ diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c index 77cb7c6..99a7f4a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c @@ -25,8 +25,9 @@ * **/ +#include + #include "vmwgfx_drv.h" -#include "ttm/ttm_bo_api.h" /* * Size of inline command buffers. Try to make sure that a page size is a diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c index 443d1ed..bcc6d41 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c @@ -25,10 +25,11 @@ * **/ +#include + #include "vmwgfx_drv.h" #include "vmwgfx_resource_priv.h" #include "vmwgfx_binding.h" -#include "ttm/ttm_placement.h" struct vmw_user_context { struct ttm_base_object base; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c index 265c81e..6c026d7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c @@ -30,9 +30,10 @@ * whenever the backing MOB is evicted. */ +#include + #include "vmwgfx_drv.h" #include "vmwgfx_resource_priv.h" -#include #include "vmwgfx_so.h" /** diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index e57a0ba..6063c96 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -30,7 +30,7 @@ #include #include #include -#include "drmP.h" +#include #include "vmwgfx_msg.h" diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c index 92f8b1d..68f135c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c @@ -25,10 +25,11 @@ * **/ +#include + #include "vmwgfx_drv.h" #include "vmwgfx_resource_priv.h" #include "vmwgfx_binding.h" -#include "ttm/ttm_placement.h" struct vmw_shader { struct vmw_resource res; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 7681341..5900cff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -25,11 +25,12 @@ * **/ +#include + #include "vmwgfx_drv.h" #include "vmwgfx_resource_priv.h" #include "vmwgfx_so.h" #include "vmwgfx_binding.h" -#include #include "device_include/svga3d_surfacedefs.h" -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 13/16] drm/tdfx: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/tdfx/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/tdfx/Makefile b/drivers/gpu/drm/tdfx/Makefile index 0379f29..74bd4ae3 100644 --- a/drivers/gpu/drm/tdfx/Makefile +++ b/drivers/gpu/drm/tdfx/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm tdfx-y := tdfx_drv.o obj-$(CONFIG_DRM_TDFX) += tdfx.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 06/16] drm/i2c: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/i2c/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile index 43aa33b..a77acfc 100644 --- a/drivers/gpu/drm/i2c/Makefile +++ b/drivers/gpu/drm/i2c/Makefile @@ -1,5 +1,3 @@ -ccflags-y := -Iinclude/drm - ch7006-y := ch7006_drv.o ch7006_mode.o obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 09/16] drm/r128: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/r128/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/r128/Makefile b/drivers/gpu/drm/r128/Makefile index 1cc72ae..1a6700e 100644 --- a/drivers/gpu/drm/r128/Makefile +++ b/drivers/gpu/drm/r128/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm r128-y := r128_drv.o r128_cce.o r128_state.o r128_irq.o r128-$(CONFIG_COMPAT) += r128_ioc32.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 08/16] drm/omap: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/omapdrm/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile index 48b7b75..b391be7 100644 --- a/drivers/gpu/drm/omapdrm/Makefile +++ b/drivers/gpu/drm/omapdrm/Makefile @@ -6,7 +6,6 @@ obj-y += dss/ obj-y += displays/ -ccflags-y := -Iinclude/drm omapdrm-y := omap_drv.o \ omap_irq.o \ omap_debugfs.o \ -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/stm: add COMPILE_TEST to Kconfig
Add COMPILE_TEST for the compilation test coverage. Signed-off-by: Masahiro Yamada --- drivers/gpu/drm/stm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/Kconfig b/drivers/gpu/drm/stm/Kconfig index 2c4817f..722ad11 100644 --- a/drivers/gpu/drm/stm/Kconfig +++ b/drivers/gpu/drm/stm/Kconfig @@ -1,6 +1,6 @@ config DRM_STM tristate "DRM Support for STMicroelectronics SoC Series" - depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM) + depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM || COMPILE_TEST) select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atmel-hlcdc: Fix output initialization
On 18/05/2017 at 14:35:21 +0200, Boris Brezillon wrote: > drm_of_find_panel_or_bridge() is expecting np to point to the encoder > node, not the bridge or panel this encoder is feeding. > Moreover, the endpoint parameter passed to drm_of_find_panel_or_bridge() > is always set to zero, which prevents us from probing all outputs. > > We also move the atmel_hlcdc_rgb_output allocation after the > panel/bridge detection to avoid useless allocations. > > Reported-by: Alexandre Belloni Tested-by: Alexandre Belloni > Fixes: ebc944613567 ("drm: convert drivers to use > drm_of_find_panel_or_bridge") > Signed-off-by: Boris Brezillon > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 36 > +--- > 1 file changed, 14 insertions(+), 22 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > index 65a3bd7a0c00..423dda2785d4 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > @@ -152,8 +152,7 @@ static const struct drm_connector_funcs > atmel_hlcdc_panel_connector_funcs = { > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > }; > > -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, > -const struct device_node *np) > +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) > { > struct atmel_hlcdc_dc *dc = dev->dev_private; > struct atmel_hlcdc_rgb_output *output; > @@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device > *dev, > struct drm_bridge *bridge; > int ret; > > + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, > + &panel, &bridge); > + if (ret) > + return ret; > + > output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); > if (!output) > return -EINVAL; > @@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device > *dev, > > output->encoder.possible_crtcs = 0x1; > > - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); > - if (ret) > - return ret; > - > if (panel) { > output->connector.dpms = DRM_MODE_DPMS_OFF; > output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; > @@ -220,22 +220,14 @@ static int atmel_hlcdc_attach_endpoint(struct > drm_device *dev, > > int atmel_hlcdc_create_outputs(struct drm_device *dev) > { > - struct device_node *remote; > - int ret = -ENODEV; > - int endpoint = 0; > - > - while (true) { > - /* Loop thru possible multiple connections to the output */ > - remote = of_graph_get_remote_node(dev->dev->of_node, 0, > - endpoint++); > - if (!remote) > - break; > - > - ret = atmel_hlcdc_attach_endpoint(dev, remote); > - of_node_put(remote); > - if (ret) > - return ret; > - } > + int endpoint, ret = 0; > + > + for (endpoint = 0; !ret; endpoint++) > + ret = atmel_hlcdc_attach_endpoint(dev, endpoint); > + > + /* At least one device was successfully attached.*/ > + if (ret == -ENODEV && endpoint) > + return 0; > > return ret; > } > -- > 2.7.4 > -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 4/4] drm: rcar-du: Register a completion callback with VSP1
Em Fri, 5 May 2017 16:21:10 +0100 Kieran Bingham escreveu: > Currently we process page flip events on every display interrupt, > however this does not take into consideration the processing time needed > by the VSP1 utilised in the pipeline. > > Register a callback with the VSP driver to obtain completion events, and > track them so that we only perform page flips when the full display > pipeline has completed for the frame. > > Signed-off-by: Kieran Bingham > Reviewed-by: Laurent Pinchart > Signed-off-by: Laurent Pinchart For all parts of this series that touch drivers/media: Acked-by: Mauro Carvalho Chehab > --- > drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 8 ++-- > drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 1 + > drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 9 + > 3 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c > b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c > index 5f0664bcd12d..345eff72f581 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c > @@ -378,7 +378,7 @@ static void rcar_du_crtc_update_planes(struct > rcar_du_crtc *rcrtc) > * Page Flip > */ > > -static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) > +void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) > { > struct drm_pending_vblank_event *event; > struct drm_device *dev = rcrtc->crtc.dev; > @@ -650,6 +650,7 @@ static const struct drm_crtc_funcs crtc_funcs = { > static irqreturn_t rcar_du_crtc_irq(int irq, void *arg) > { > struct rcar_du_crtc *rcrtc = arg; > + struct rcar_du_device *rcdu = rcrtc->group->dev; > irqreturn_t ret = IRQ_NONE; > u32 status; > > @@ -658,7 +659,10 @@ static irqreturn_t rcar_du_crtc_irq(int irq, void *arg) > > if (status & DSSR_FRM) { > drm_crtc_handle_vblank(&rcrtc->crtc); > - rcar_du_crtc_finish_page_flip(rcrtc); > + > + if (rcdu->info->gen < 3) > + rcar_du_crtc_finish_page_flip(rcrtc); > + > ret = IRQ_HANDLED; > } > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h > b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h > index 15871fae7445..b199ed5adf36 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h > +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h > @@ -73,5 +73,6 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc); > > void rcar_du_crtc_route_output(struct drm_crtc *crtc, > enum rcar_du_output output); > +void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc); > > #endif /* __RCAR_DU_CRTC_H__ */ > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > index b0ff304ce3dc..c7bb96fbfab1 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c > @@ -28,6 +28,13 @@ > #include "rcar_du_kms.h" > #include "rcar_du_vsp.h" > > +static void rcar_du_vsp_complete(void *private) > +{ > + struct rcar_du_crtc *crtc = private; > + > + rcar_du_crtc_finish_page_flip(crtc); > +} > + > void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) > { > const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode; > @@ -35,6 +42,8 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) > struct vsp1_du_lif_config cfg = { > .width = mode->hdisplay, > .height = mode->vdisplay, > + .callback = rcar_du_vsp_complete, > + .callback_data = crtc, > }; > struct rcar_du_plane_state state = { > .state = { Thanks, Mauro ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 15/16] drm/vgem: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/vgem/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile index bfcdea1..cb5d413 100644 --- a/drivers/gpu/drm/vgem/Makefile +++ b/drivers/gpu/drm/vgem/Makefile @@ -1,4 +1,3 @@ -ccflags-y := -Iinclude/drm vgem-y := vgem_drv.o vgem_fence.o obj-$(CONFIG_DRM_VGEM) += vgem.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 15/29] drm/vc4: fix include notation and remove -Iinclude/drm flag
Hi Daniel, 2017-05-17 21:40 GMT+09:00 Daniel Vetter : > On Mon, Apr 24, 2017 at 01:50:33PM +0900, Masahiro Yamada wrote: >> Include instead of relative path from include/drm, then >> remove the -Iinclude/drm compiler flag. >> >> While we are here, use <...> instead of "..." for include/linux/*.h >> headers too. >> >> Signed-off-by: Masahiro Yamada > > This one doesn't apply anymore cleanly. Can you pls rebase onto latest > linux-next? I'm going through the remaining patches, up to this all merged > to drm-misc-next. > > Thanks, Daniel I rebased this one as you suggested and send v3 for the rest of the series. Please note I am also adding 12/16 : drm/stm: remove unneeded -Iinclude/drm compiler flag because a new user of -Iinclude/drm has appeared. Thanks! -- Best Regards Masahiro Yamada ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/5] ASoC: simple-card-utils: support snd_soc_get_dai_id()
From: Kuninori Morimoto ALSA SoC needs to know connected DAI ID for detecting. It is not a big problem if device/driver was only for sound, but getting DAI ID will be difficult if device includes both Video/Sound, like HDMI. To solve this issue, this patch adds new snd_soc_get_dai_id() and its related .of_xlate_dai_id callback on component driver. In below case, we can handle Sound port (= port@2) as ID = 0 if .of_xlate_dai_id has its support. hdmi { port@0 { /* VIDEO */ }; port@1 { /* VIDEO */ }; port@2 { /* SOUND */ }; }; Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 9 + 1 file changed, 9 insertions(+) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 5a3d51e..fe726e8 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -177,9 +177,18 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep) struct device_node *node; struct device_node *endpoint; int i, id; + int ret; + + ret = snd_soc_get_dai_id(ep); + if (ret != -ENOTSUPP) + return ret; node = of_graph_get_port_parent(ep); + /* +* Non HDMI sound case, counting port/endpoint on its DT +* is enough. Let's count it. +*/ i = 0; id = -1; for_each_endpoint_of_node(node, endpoint) { -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 01/16] drm/vc4: fix include notation and remove -Iinclude/drm flag
Include instead of relative path from include/drm, then remove the -Iinclude/drm compiler flag. While we are here, use <...> instead of "..." for include/linux/*.h and include/sound/*.h headers too. Signed-off-by: Masahiro Yamada --- Changes in v3: - Rebase drivers/gpu/drm/vc4/Makefile| 2 -- drivers/gpu/drm/vc4/vc4_crtc.c | 14 +++--- drivers/gpu/drm/vc4/vc4_dpi.c | 16 drivers/gpu/drm/vc4/vc4_drv.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 6 ++ drivers/gpu/drm/vc4/vc4_dsi.c | 28 ++-- drivers/gpu/drm/vc4/vc4_hdmi.c | 30 +++--- drivers/gpu/drm/vc4/vc4_hvs.c | 2 +- drivers/gpu/drm/vc4/vc4_kms.c | 12 ++-- drivers/gpu/drm/vc4/vc4_plane.c | 9 + drivers/gpu/drm/vc4/vc4_v3d.c | 6 +++--- 11 files changed, 62 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile index ab687fb..25bd5d3 100644 --- a/drivers/gpu/drm/vc4/Makefile +++ b/drivers/gpu/drm/vc4/Makefile @@ -1,5 +1,3 @@ -ccflags-y := -Iinclude/drm - # Please keep these build lists sorted! # core driver code diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 1b4dbe9..0bfc4d8 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,13 +32,13 @@ * ones that set the clock. */ -#include "drm_atomic.h" -#include "drm_atomic_helper.h" -#include "drm_crtc_helper.h" -#include "linux/clk.h" -#include "drm_fb_cma_helper.h" -#include "linux/component.h" -#include "linux/of_device.h" +#include +#include +#include +#include +#include +#include +#include #include "vc4_drv.h" #include "vc4_regs.h" diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c index c6d7039..39d6808 100644 --- a/drivers/gpu/drm/vc4/vc4_dpi.c +++ b/drivers/gpu/drm/vc4/vc4_dpi.c @@ -22,14 +22,14 @@ * ALT2 function. */ -#include "drm_atomic_helper.h" -#include "drm_crtc_helper.h" -#include "drm_edid.h" -#include "drm_panel.h" -#include "linux/clk.h" -#include "linux/component.h" -#include "linux/of_graph.h" -#include "linux/of_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include #include "vc4_drv.h" #include "vc4_regs.h" diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 8639749..136bb42 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -31,7 +31,7 @@ #include #include #include -#include "drm_fb_cma_helper.h" +#include #include #include "uapi/drm/vc4_drm.h" diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 5ba2813..a97556f 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -6,12 +6,10 @@ * published by the Free Software Foundation. */ -#include "drmP.h" -#include "drm_gem_cma_helper.h" -#include "drm_gem_cma_helper.h" - #include +#include #include +#include struct vc4_dev { struct drm_device *dev; diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index fdb3877..0ef41df 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -29,20 +29,20 @@ * hopefully present. */ -#include "drm_atomic_helper.h" -#include "drm_crtc_helper.h" -#include "drm_edid.h" -#include "drm_mipi_dsi.h" -#include "drm_panel.h" -#include "linux/clk.h" -#include "linux/clk-provider.h" -#include "linux/completion.h" -#include "linux/component.h" -#include "linux/dmaengine.h" -#include "linux/i2c.h" -#include "linux/of_address.h" -#include "linux/of_platform.h" -#include "linux/pm_runtime.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "vc4_drv.h" #include "vc4_regs.h" diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 3c2723f6..ed63d4e 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -42,21 +42,21 @@ * encoder block has CEC support. */ -#include "drm_atomic_helper.h" -#include "drm_crtc_helper.h" -#include "drm_edid.h" -#include "linux/clk.h" -#include "linux/component.h" -#include "linux/i2c.h" -#include "linux/of_address.h" -#include "linux/of_gpio.h" -#include "linux/of_platform.h" -#include "linux/pm_runtime.h" -#include "linux/rational.h" -#include "sound/dmaengine_pcm.h" -#include "sound/pcm_drm_eld.h" -#include "sound/pcm_params.h" -#include "sound/soc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "vc4_drv.h" #include "vc4_regs.h" diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index fd421ba..2b62fc5 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -22,7 +22,7 @@ * each CRTC. */ -#include
[PATCH 4/5] ASoC: hdmi-codec: add .get_dai_id support
From: Kuninori Morimoto ALSA SoC needs to know connected DAI ID for probing. It is not a big problem if device/driver was only for sound, but getting DAI ID will be difficult if device includes both Video/Sound, like HDMI. To solve this issue, this patch adds new .get_dai_id callback on hdmi_codec_ops Signed-off-by: Kuninori Morimoto --- include/sound/hdmi-codec.h| 9 + sound/soc/codecs/hdmi-codec.c | 13 + 2 files changed, 22 insertions(+) diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 915c435..9483c55 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -18,9 +18,11 @@ #ifndef __HDMI_CODEC_H__ #define __HDMI_CODEC_H__ +#include #include #include #include +#include #include /* @@ -87,6 +89,13 @@ struct hdmi_codec_ops { */ int (*get_eld)(struct device *dev, void *data, uint8_t *buf, size_t len); + + /* +* Getting DAI ID +* Optional +*/ + int (*get_dai_id)(struct snd_soc_component *comment, + struct device_node *endpoint); }; /* HDMI codec initalization data */ diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 8659b76..6d05161 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -719,6 +719,18 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, .pcm_new = hdmi_codec_pcm_new, }; +static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, +struct device_node *endpoint) +{ + struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); + int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ + + if (hcp->hcd.ops->get_dai_id) + ret = hcp->hcd.ops->get_dai_id(component, endpoint); + + return ret; +} + static struct snd_soc_codec_driver hdmi_codec = { .component_driver = { .controls = hdmi_controls, @@ -727,6 +739,7 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), .dapm_routes= hdmi_routes, .num_dapm_routes= ARRAY_SIZE(hdmi_routes), + .of_xlate_dai_id= hdmi_of_xlate_dai_id, }, }; -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 00/16] gpu/drm: remove -Iinclude/drm compiler flags from Makefile
Many Makefiles needed to add -Iinclude/drm as an include path, but the right thing to do is to include headers in the form #include This series fixes the source files, then rip off -Iinclude/drm flags. V3: rebased on commit bb2af9bda33 (drm-misc-next) Masahiro Yamada (16): drm/vc4: fix include notation and remove -Iinclude/drm flag drm/virtio: fix include notation and remove -Iinclude/drm flag drm/vmwgfx: fix include notation and remove -Iinclude/drm flag drm/gma500: remove unneeded -Iinclude/drm compiler flag drm/i810: remove unneeded -Iinclude/drm compiler flag drm/i2c: remove unneeded -Iinclude/drm compiler flag drm/mga: remove unneeded -Iinclude/drm compiler flag drm/omap: remove unneeded -Iinclude/drm compiler flag drm/r128: remove unneeded -Iinclude/drm compiler flag drm/savage: remove unneeded -Iinclude/drm compiler flag drm/sis: remove unneeded -Iinclude/drm compiler flag drm/stm: remove unneeded -Iinclude/drm compiler flag drm/tdfx: remove unneeded -Iinclude/drm compiler flag drm/udl: remove unneeded -Iinclude/drm compiler flag drm/vgem: remove unneeded -Iinclude/drm compiler flag drm/via: remove unneeded -Iinclude/drm compiler flag drivers/gpu/drm/gma500/Makefile | 1 - drivers/gpu/drm/i2c/Makefile | 2 -- drivers/gpu/drm/i810/Makefile| 1 - drivers/gpu/drm/mga/Makefile | 1 - drivers/gpu/drm/omapdrm/Makefile | 1 - drivers/gpu/drm/r128/Makefile| 1 - drivers/gpu/drm/savage/Makefile | 1 - drivers/gpu/drm/sis/Makefile | 1 - drivers/gpu/drm/stm/Makefile | 2 -- drivers/gpu/drm/tdfx/Makefile| 1 - drivers/gpu/drm/udl/Makefile | 3 --- drivers/gpu/drm/vc4/Makefile | 2 -- drivers/gpu/drm/vc4/vc4_crtc.c | 14 +++--- drivers/gpu/drm/vc4/vc4_dpi.c| 16 drivers/gpu/drm/vc4/vc4_drv.c| 2 +- drivers/gpu/drm/vc4/vc4_drv.h| 6 ++ drivers/gpu/drm/vc4/vc4_dsi.c| 28 ++-- drivers/gpu/drm/vc4/vc4_hdmi.c | 30 +++--- drivers/gpu/drm/vc4/vc4_hvs.c| 2 +- drivers/gpu/drm/vc4/vc4_kms.c| 12 ++-- drivers/gpu/drm/vc4/vc4_plane.c | 9 + drivers/gpu/drm/vc4/vc4_v3d.c| 6 +++--- drivers/gpu/drm/vgem/Makefile| 1 - drivers/gpu/drm/via/Makefile | 1 - drivers/gpu/drm/virtio/Makefile | 2 -- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_drv.h | 8 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +- drivers/gpu/drm/vmwgfx/Makefile | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 ++- 37 files changed, 88 insertions(+), 107 deletions(-) -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 07/16] drm/mga: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/mga/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/mga/Makefile b/drivers/gpu/drm/mga/Makefile index 6068478..49e972c 100644 --- a/drivers/gpu/drm/mga/Makefile +++ b/drivers/gpu/drm/mga/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o mga-$(CONFIG_COMPAT) += mga_ioc32.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 11/16] drm/sis: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/sis/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/sis/Makefile b/drivers/gpu/drm/sis/Makefile index 441c061..7bf4c13 100644 --- a/drivers/gpu/drm/sis/Makefile +++ b/drivers/gpu/drm/sis/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y = -Iinclude/drm sis-y := sis_drv.o sis_mm.o obj-$(CONFIG_DRM_SIS) += sis.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 05/16] drm/i810: remove unneeded -Iinclude/drm compiler flag
With the include directives under include/drm/ fixed, this flag is no longer needed. Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/gpu/drm/i810/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/i810/Makefile b/drivers/gpu/drm/i810/Makefile index 43844ec..639f859 100644 --- a/drivers/gpu/drm/i810/Makefile +++ b/drivers/gpu/drm/i810/Makefile @@ -2,7 +2,6 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -ccflags-y := -Iinclude/drm i810-y := i810_drv.o i810_dma.o obj-$(CONFIG_DRM_I810) += i810.o -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/amd/powerplay: fix a signedness bugs
Reviewed-by: Eric Huang On 2017-05-16 10:42 AM, Dan Carpenter wrote: Smatch complains about a signedness bug here: vega10_hwmgr.c:4202 vega10_force_clock_level() warn: always true condition '(i >= 0) => (0-u32max >= 0)' Fixes: 7b52db39a4c2 ("drm/amd/powerplay: fix bug sclk/mclk level can't be set on vega10.") Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index ad30f5d3a10d..2614af2f553f 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c @@ -4186,7 +4186,7 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr, enum pp_clock_type type, uint32_t mask) { struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend); - uint32_t i; + int i; if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) return -EINVAL; ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 101029] notebook does not work when not booted using nomodeset AMD APU
https://bugs.freedesktop.org/show_bug.cgi?id=101029 --- Comment #21 from Jan Vesely --- I have the same problem on carrizo+iceland nb (reported at [0,1]). I can confirm that the linked patch applied on top of 4.10.x fixes boot, and the machine can run 3d applications (tested glxgears) on both GPUs (running 3d apps on dGPU still causes null pointer dereference when the card goes back to suspend, but that's a separate issue). it also fixes the boot hang problem on ROCK[1] [0]https://bugzilla.redhat.com/show_bug.cgi?id=1448121 [1]https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/issues/20 -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 1/3] drm/stm: ltdc: Add bridge support
Philippe CORNU writes: > Add the bridge support, used by DSI host and HDMI/LVDS bridges. > > Signed-off-by: Philippe CORNU > @@ -987,19 +1024,36 @@ static struct drm_panel *ltdc_get_panel(struct > drm_device *ddev) > > port = of_graph_get_remote_port_parent(entity); > if (port) { > + struct drm_bridge *bridge; > + struct drm_panel *panel; > + > + bridge = of_drm_find_bridge(port); > panel = of_drm_find_panel(port); > - of_node_put(port); > + if (!bridge && !panel) { > + of_node_put(entity); > + return -EPROBE_DEFER; > + } > + > + if (bridge) { > + if (!ldev->bridge) { > + ldev->bridge = bridge; > + DRM_INFO("remote bridge %s\n", > + port->full_name); > + } > + } > + > if (panel) { > - DRM_DEBUG_DRIVER("remote panel %s\n", > + if (!ldev->panel) { > + ldev->panel = panel; > + DRM_INFO("remote panel %s\n", >port->full_name); > - } else { > - DRM_DEBUG_DRIVER("panel missing\n"); > - of_node_put(entity); > + } > } > + of_node_put(port); Is it possible to use drm_of_find_panel_or_bridge() instead? I don't think it makes sense to have both a bridge and a panel for the same node, does it? signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 101029] notebook does not work when not booted using nomodeset AMD APU
https://bugs.freedesktop.org/show_bug.cgi?id=101029 --- Comment #22 from Craig --- in that case, when will this patch be applied permanently in a kernel versus having to use the patch? I will be attempting to apply the patch soon and verify as well on the Ubuntu side. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/amd/display: default spd packet to invalid
Signed-off-by: Jeff Smith --- All of the encoder_info_frame's info packets are initialized to invalid in resource_build_info_frame except for spd. This appears to be simply an oversight. drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index ae8b221..f966f23 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -2152,6 +2152,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx) info->avi.valid = false; info->gamut.valid = false; info->vendor.valid = false; + info->spd.valid = false; info->hdrsmd.valid = false; info->vsc.valid = false; -- 2.9.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: Fix oops upon driver load on PowerXpress laptops
Nicolai Stange reports the following oops which is caused by dereferencing rdev->pdev before it's subsequently set by radeon_device_init(). Fix it. BUG: unable to handle kernel NULL pointer dereference at 07cb IP: radeon_driver_load_kms+0xeb/0x230 [radeon] PGD 0 P4D 0 Oops: [#1] SMP Modules linked in: amdkfd amd_iommu_v2 i915(+) radeon(+) i2c_algo_bit drm_kms_helper ttm e1000e drm sdhci_pci sdhci_acpi ptp sdhci crc32c_intel serio_raw mmc_core pps_core video i2c_hid hid_plantronics CPU: 4 PID: 389 Comm: systemd-udevd Not tainted 4.12.0-rc1-next-20170515+ #1 Hardware name: Dell Inc. Latitude E6540/0725FP, BIOS A10 06/26/2014 task: 97d62c8f task.stack: b96f01478000 RIP: 0010:radeon_driver_load_kms+0xeb/0x230 [radeon] RSP: 0018:b96f0147b9d0 EFLAGS: 00010246 RAX: RBX: 97d620085000 RCX: 00610037 RDX: RSI: 002b RDI: RBP: b96f0147b9e8 R08: 0002 R09: b96f0147b924 R10: R11: 97d62edd2ec0 R12: 97d628d5c000 R13: 00610037 R14: c0698280 R15: FS: 7f496363d8c0() GS:97d62eb0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 07cb CR3: 00022c14c000 CR4: 001406e0 Call Trace: drm_dev_register+0x146/0x1d0 [drm] drm_get_pci_dev+0x9a/0x180 [drm] radeon_pci_probe+0xb8/0xe0 [radeon] local_pci_probe+0x45/0xa0 pci_device_probe+0x14f/0x1a0 driver_probe_device+0x29c/0x450 __driver_attach+0xdf/0xf0 ? driver_probe_device+0x450/0x450 bus_for_each_dev+0x6c/0xc0 driver_attach+0x1e/0x20 bus_add_driver+0x170/0x270 driver_register+0x60/0xe0 ? 0xc0508000 __pci_register_driver+0x4c/0x50 drm_pci_init+0xeb/0x100 [drm] ? vga_switcheroo_register_handler+0x6a/0x90 ? 0xc0508000 radeon_init+0x98/0xb6 [radeon] do_one_initcall+0x52/0x1a0 ? __vunmap+0x81/0xb0 ? kmem_cache_alloc_trace+0x159/0x1b0 ? do_init_module+0x27/0x1f8 do_init_module+0x5f/0x1f8 load_module+0x27ce/0x2be0 SYSC_finit_module+0xdf/0x110 ? SYSC_finit_module+0xdf/0x110 SyS_finit_module+0xe/0x10 do_syscall_64+0x67/0x150 entry_SYSCALL64_slow_path+0x25/0x25 RIP: 0033:0x7f4962295679 RSP: 002b:7ffdd8c4f878 EFLAGS: 0246 ORIG_RAX: 0139 RAX: ffda RBX: 55c014ed8200 RCX: 7f4962295679 RDX: RSI: 7f4962dd19c5 RDI: 0010 RBP: 7f4962dd19c5 R08: R09: 7ffdd8c4f990 R10: 0010 R11: 0246 R12: R13: 55c014ed81a0 R14: 0002 R15: 55c0149d1fca Code: 5d 5d c3 8b 05 a7 05 14 00 49 81 cd 00 00 08 00 85 c0 74 a3 e8 e7 c0 0e 00 84 c0 74 9a 41 f7 c5 00 00 02 00 75 91 49 8b 44 24 10 <0f> b6 90 cb 07 00 00 f6 c2 20 74 1e e9 7b ff ff ff 48 8b 40 38 RIP: radeon_driver_load_kms+0xeb/0x230 [radeon] RSP: b96f0147b9d0 CR2: 07cb ---[ end trace 89cc4ba7e569c65c ]--- Reported-by: Nicolai Stange Fixes: 7ffb0ce31cf9 ("drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo") Signed-off-by: Lukas Wunner --- Awaiting a Tested-by: from Nicolai, but it's clear this is a bug and needs to be fixed, so sending out with a proper commit message now. The bug was only introduced to radeon, not amdgpu. @Alex Deucher: I could push this to drm-misc-fixes but then it wouldn't land before -rc3 because Sean Paul has already sent out the -rc2 pull. I notice you haven't sent out a pull for -rc2 yet, so maybe you want to take it yourself? Whichever you prefer. Thanks & sorry for the breakage! drivers/gpu/drm/radeon/radeon_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 6a68d440bc44..d0ad03674250 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -116,7 +116,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) if ((radeon_runtime_pm != 0) && radeon_has_atpx() && ((flags & RADEON_IS_IGP) == 0) && - !pci_is_thunderbolt_attached(rdev->pdev)) + !pci_is_thunderbolt_attached(dev->pdev)) flags |= RADEON_IS_PX; /* radeon_device_init should report only fatal error -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm/atomic: Consitfy mode parameter to drm_atomic_set_mode_for_crtc()
From: Ville Syrjälä drm_atomic_set_mode_for_crtc() doesn't modify the passed mode, so let's make it const. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_atomic.c | 2 +- include/drm/drm_atomic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index cdec19a86af3..21cb78202c90 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -328,7 +328,7 @@ static s32 __user *get_out_fence_for_crtc(struct drm_atomic_state *state, * Zero on success, error code on failure. Cannot return -EDEADLK. */ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, -struct drm_display_mode *mode) +const struct drm_display_mode *mode) { struct drm_mode_modeinfo umode; diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 8645dcdef031..0196f264a418 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -520,7 +520,7 @@ __drm_atomic_get_current_plane_state(struct drm_atomic_state *state, int __must_check drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, -struct drm_display_mode *mode); +const struct drm_display_mode *mode); int __must_check drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, struct drm_property_blob *blob); -- 2.10.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/2] drm/i915: Constify load detect mode
From: Ville Syrjälä Make the mode used for load detection const, and adjust all relevant functions to accept a const mode. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_display.c | 12 ++-- drivers/gpu/drm/i915/intel_drv.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8217ed0e7132..6c08a7d6a0de 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9538,7 +9538,7 @@ static void i9xx_disable_cursor(struct intel_plane *plane, /* VESA 640x480x72Hz mode to set on the pipe */ -static struct drm_display_mode load_detect_mode = { +static const struct drm_display_mode load_detect_mode = { DRM_MODE("640x480", DRM_MODE_TYPE_DEFAULT, 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC), }; @@ -9573,7 +9573,7 @@ intel_framebuffer_pitch_for_width(int width, int bpp) } static u32 -intel_framebuffer_size_for_mode(struct drm_display_mode *mode, int bpp) +intel_framebuffer_size_for_mode(const struct drm_display_mode *mode, int bpp) { u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp); return PAGE_ALIGN(pitch * mode->vdisplay); @@ -9581,7 +9581,7 @@ intel_framebuffer_size_for_mode(struct drm_display_mode *mode, int bpp) static struct drm_framebuffer * intel_framebuffer_create_for_mode(struct drm_device *dev, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, int depth, int bpp) { struct drm_framebuffer *fb; @@ -9608,7 +9608,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, static struct drm_framebuffer * mode_fits_in_fbdev(struct drm_device *dev, - struct drm_display_mode *mode) + const struct drm_display_mode *mode) { #ifdef CONFIG_DRM_FBDEV_EMULATION struct drm_i915_private *dev_priv = to_i915(dev); @@ -9641,7 +9641,7 @@ mode_fits_in_fbdev(struct drm_device *dev, static int intel_modeset_setup_plane_state(struct drm_atomic_state *state, struct drm_crtc *crtc, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_framebuffer *fb, int x, int y) { @@ -9675,7 +9675,7 @@ static int intel_modeset_setup_plane_state(struct drm_atomic_state *state, } int intel_get_load_detect_pipe(struct drm_connector *connector, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct intel_load_detect_pipe *old, struct drm_modeset_acquire_ctx *ctx) { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bd500977b3fc..d2aa92fa7ec4 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1398,7 +1398,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, struct intel_digital_port *dport, unsigned int expected_mask); int intel_get_load_detect_pipe(struct drm_connector *connector, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct intel_load_detect_pipe *old, struct drm_modeset_acquire_ctx *ctx); void intel_release_load_detect_pipe(struct drm_connector *connector, -- 2.10.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 0/2] drm: Add properties to control YCbCr to RGB conversion
Changes since v3 RFC version: - Add: "drm: Add const to name field declaration in struct drm_prop_enum_list" - Fix typos found by Eric Engestrom - Restructure kernel doc - Add consts to name sting tables - Loop variables from unsigned to signed int - Use len variable to index temporary enum_list - Initialize state variables if present - Reorder bitmask test - Remove drm_property_destroy() call from drm_plane_cleanup() - Do not initialize the first enum to zero - Remove struct drm_prop_enum_list declaration from drm_color_mgmt.h The previous version can be found here: https://lists.freedesktop.org/archives/dri-devel/2017-May/141766.html Jyri Sarha (2): drm: Add const to name field declaration in struct drm_prop_enum_list drm: Add optinal COLOR_ENCODING and COLOR_RANGE properties to drm_plane drivers/gpu/drm/drm_atomic.c | 8 drivers/gpu/drm/drm_color_mgmt.c | 92 include/drm/drm_color_mgmt.h | 19 + include/drm/drm_plane.h | 8 include/drm/drm_property.h | 2 +- 5 files changed, 128 insertions(+), 1 deletion(-) -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 2/2] drm: Add optinal COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Add a standard optional properties to support different non RGB color encodings in DRM planes. COLOR_ENCODING select the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr. COLOR_RANGE selects the value ranges within the selected color encoding. The properties are stored to drm_plane object to allow different set of supported encoding for different planes on the device. Signed-off-by: Jyri Sarha --- drivers/gpu/drm/drm_atomic.c | 8 drivers/gpu/drm/drm_color_mgmt.c | 92 include/drm/drm_color_mgmt.h | 19 + include/drm/drm_plane.h | 8 4 files changed, 127 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 4033384..f341dda 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -774,6 +774,10 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == plane->color_encoding_property) { + state->color_encoding = val; + } else if (property == plane->color_range_property) { + state->color_range = val; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -834,6 +838,10 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + } else if (property == plane->color_range_property) { + *val = state->color_range; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 533f3a3..1a89d1a 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -85,6 +85,19 @@ * drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. + * + * Support for different non RGB color encodings is controlled through + * &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties: + * + * "COLOR_ENCODING" + * Optional plane enum property to support different non RGB + * color encodings. The driver can provide a subset of standard + * enum values supported by the DRM plane. + * + * "COLOR_RANGE" + * Optional plane enum property to support different non RGB + * color parameter ranges. The driver can provide a subset of + * standard enum values supported by the DRM plane. */ /** @@ -333,3 +346,82 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev, drm_modeset_unlock(&crtc->mutex); return ret; } + +static const char * const color_encoding_name[] = { + [DRM_COLOR_YCBCR_BT601] = "ITU-R BT.601 YCbCr", + [DRM_COLOR_YCBCR_BT709] = "ITU-R BT.709 YCbCr", + [DRM_COLOR_YCBCR_BT2020] = "ITU-R BT.2020 YCbCr", +}; + +static const char * const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE] = "YCbCr full range", + [DRM_COLOR_YCBCR_LIMITED_RANGE] = "YCbCr limited range", +}; + +/** + * drm_plane_create_color_properties - color encoding related plane properties + * @supported_encodings: bitfield indicating supported color encodings + * @supported_ranges: bitfileld indicating supported color ranges + * @default_encoding: default color encoding + * @default_range: default color range + * + * Create and attach plane specific COLOR_ENCODING and COLOR_RANGE + * properties to to the drm_plane object. The supported encodings and + * ranges should be provided in supported_encodings and + * supported_ranges bitmasks. Each bit set in the bitmask indicates + * the its number as enum value being supported. + */ +int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges, + enum drm_color_encoding default_encoding, + enum drm_color_range default_range) +{ + struct drm_device *dev = plane->dev; + struct drm_property *prop; + struct drm_prop_enum_list enum_list[max(DRM_COLOR_ENCODING_MAX, + DRM_COLOR_RANGE_MAX)]; + int i, len; + + len = 0; + for (i = 0; i < DRM_COLOR_ENCODING_MAX; i++) { + if ((supported_encodings & BIT(i)) == 0) + continue; + + enum_list[len].type = i; + e
[PATCH v4 1/2] drm: Add const to name field declaration in struct drm_prop_enum_list
There is no reason why the name field should not be const, but several why it should. The struct should only be used by drm_property_create_enum() and there the name-field from the struct is passed to drm_property_add_enum(), which takes a const char * as a parameter. Signed-off-by: Jyri Sarha --- include/drm/drm_property.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 13e8c17..619868dc 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h @@ -214,7 +214,7 @@ struct drm_property_blob { struct drm_prop_enum_list { int type; - char *name; + const char *name; }; #define obj_to_property(x) container_of(x, struct drm_property, base) -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/cirrus: implement create_handle for framebuffers
This fixes the DRM_IOCTL_MODE_GETFB ioctl for cirrus so that it returns an actual handle instead of failing with ENODEV. Tested in a QEMU VM with "-vga cirrus" by running this script: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/bin/screenshot.py Implementation cargo-culted from radeon_user_framebuffer_create_handle(). Signed-off-by: Nicholas Bishop --- drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c index e7fc95f..2b0b27b 100644 --- a/drivers/gpu/drm/cirrus/cirrus_main.c +++ b/drivers/gpu/drm/cirrus/cirrus_main.c @@ -23,8 +23,18 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb) kfree(fb); } +static int cirrus_user_framebuffer_create_handle(struct drm_framebuffer *fb, +struct drm_file *file_priv, +unsigned int *handle) +{ + struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb); + + return drm_gem_handle_create(file_priv, cirrus_fb->obj, handle); +} + static const struct drm_framebuffer_funcs cirrus_fb_funcs = { .destroy = cirrus_user_framebuffer_destroy, + .create_handle = cirrus_user_framebuffer_create_handle, }; int cirrus_framebuffer_init(struct drm_device *dev, -- 2.9.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [drm:qxl] BUG: sleeping function called from invalid context - qxl_bo_kmap_atomic_page()...splat
Mike Galbraith writes: > On Mon, 2017-05-08 at 16:48 -0300, Gabriel Krisman Bertazi wrote: > >> Thanks for reporting this. Can you confirm the following patch prevents >> the issue? > > Nope, it still gripes. Oops... Thanks for checking. The following patch fixes the issue for me. Can you please test that one? >8 Subject: [PATCH] drm: qxl: Delay entering atomic context during cursor update qxl_release_map will enter an atomic context, but since we still need to alloc memory for BOs, we better delay that until we have everything we need, in case we need to sleep inside the allocation. This avoids the Sleep in atomic state below, which was reported by Mike. [ 43.910362] BUG: sleeping function called from invalid context at mm/slab.h:432 [ 43.910955] in_atomic(): 1, irqs_disabled(): 0, pid: 2077, name: Xorg [ 43.911472] Preemption disabled at: [ 43.911478] [] qxl_bo_kmap_atomic_page+0xa5/0x100 [qxl] [ 43.912103] CPU: 0 PID: 2077 Comm: Xorg Tainted: GE 4.12.0-master #38 [ 43.912550] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20161202_174313-build11a 04/01/2014 [ 43.913202] Call Trace: [ 43.913371] dump_stack+0x65/0x89 [ 43.913581] ? qxl_bo_kmap_atomic_page+0xa5/0x100 [qxl] [ 43.913876] ___might_sleep+0x11a/0x190 [ 43.914095] __might_sleep+0x4a/0x80 [ 43.914319] ? qxl_bo_create+0x50/0x190 [qxl] [ 43.914565] kmem_cache_alloc_trace+0x46/0x180 [ 43.914836] qxl_bo_create+0x50/0x190 [qxl] [ 43.915082] ? refcount_dec_and_test+0x11/0x20 [ 43.915332] ? ttm_mem_io_reserve+0x41/0xe0 [ttm] [ 43.915595] qxl_alloc_bo_reserved+0x37/0xb0 [qxl] [ 43.915884] qxl_cursor_atomic_update+0x8f/0x260 [qxl] [ 43.916172] ? drm_atomic_helper_update_legacy_modeset_state+0x1d6/0x210 [drm_kms_helper] [ 43.916623] drm_atomic_helper_commit_planes+0xec/0x230 [drm_kms_helper] [ 43.916995] drm_atomic_helper_commit_tail+0x2b/0x60 [drm_kms_helper] [ 43.917398] commit_tail+0x65/0x70 [drm_kms_helper] [ 43.917693] drm_atomic_helper_commit+0xa9/0x100 [drm_kms_helper] [ 43.918039] drm_atomic_commit+0x4b/0x50 [drm] [ 43.918334] drm_atomic_helper_update_plane+0xf1/0x110 [drm_kms_helper] [ 43.918902] __setplane_internal+0x19f/0x280 [drm] [ 43.919240] drm_mode_cursor_universal+0x101/0x1c0 [drm] [ 43.919541] drm_mode_cursor_common+0x15b/0x1d0 [drm] [ 43.919858] drm_mode_cursor2_ioctl+0xe/0x10 [drm] [ 43.920157] drm_ioctl+0x211/0x460 [drm] [ 43.920383] ? drm_mode_cursor_ioctl+0x50/0x50 [drm] [ 43.920664] ? handle_mm_fault+0x93/0x160 [ 43.920893] do_vfs_ioctl+0x96/0x6e0 [ 43.921117] ? __fget+0x73/0xa0 [ 43.921322] SyS_ioctl+0x41/0x70 [ 43.921545] entry_SYSCALL_64_fastpath+0x1a/0xa5 [ 43.922188] RIP: 0033:0x7f1145804bc7 [ 43.922526] RSP: 002b:7ffcd3e50508 EFLAGS: 3246 ORIG_RAX: 0010 [ 43.923367] RAX: ffda RBX: 0040 RCX: 7f1145804bc7 [ 43.923852] RDX: 7ffcd3e50540 RSI: c02464bb RDI: 000b [ 43.924299] RBP: 0040 R08: 0040 R09: 000c [ 43.924694] R10: 7ffcd3e50340 R11: 3246 R12: 0018 [ 43.925128] R13: 022bc390 R14: 0040 R15: 7ffcd3e5062c Reported-by: Mike Galbraith Signed-off-by: Gabriel Krisman Bertazi --- drivers/gpu/drm/qxl/qxl_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 058340a002c2..4a340efd8ba6 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -575,8 +575,6 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, if (ret) return; - cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release); - if (fb != old_state->fb) { obj = to_qxl_framebuffer(fb)->obj; user_bo = gem_to_qxl_bo(obj); @@ -614,6 +612,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, qxl_bo_kunmap(cursor_bo); qxl_bo_kunmap(user_bo); + cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release); cmd->u.set.visible = 1; cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0); @@ -624,6 +623,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, if (ret) goto out_free_release; + cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_MOVE; } -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: trivial documentation fix to drm_for_each_connector_iter
Daniel Vetter writes: > On Wed, May 17, 2017 at 03:43:18PM -0300, Gabriel Krisman Bertazi wrote: >> Daniel Vetter writes: >> >> > On Thu, Apr 20, 2017 at 09:38:19PM -0300, Gabriel Krisman Bertazi wrote: >> >> While reading drm_for_each_connector_iter, I noticed a mention to >> >> drm_connector_begin which doesn't exist. It should be >> >> drm_connector_get. >> >> >> >> Signed-off-by: Gabriel Krisman Bertazi >> > >> > Fixes: b982dab1e66d ("drm: Rename connector list iterator API") >> > Reviewed-by: Daniel Vetter >> >> Hi Daniel, >> >> Can you apply this one? I couldn't find it in drm-misc yet. > > Oh I thought you have commit rights, otherwise I'd have pushed it. Yep, I don't have commit rights yet. Thanks for pushing, Daniel. -- Gabriel Krisman Bertazi ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2] drm/omap: Implement CTM property for CRTC using OVL managers CPR matrix
Implement CTM color management property for OMAP CRTC using DSS overlay manager's Color Phase Rotation matrix. The CPR matrix does not exactly match the CTM property documentation. On DSS the CPR matrix is applied after gamma table look up. However, it seems stupid to add a custom property just for that. Signed-off-by: Jyri Sarha --- There was an earlier version of this patch as a part of one series here: https://lists.freedesktop.org/archives/dri-devel/2017-March/136811.html Changes since that version: - Fix commit message: CPR is applied after gamma table, not before (this makes me wonder if we should call our gamma tablem degamma) - Correctly convert form signed magnitude format of CTM blob - Remove redundant size check for CTM blob drivers/gpu/drm/omapdrm/omap_crtc.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index dccd037..24a2d14 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -312,6 +312,32 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc) DBG("%s: apply done", omap_crtc->name); } +static s16 omap_crtc_S31_32_to_s2_8(s64 coef) +{ + uint64_t sign_bit = 1ULL << 63; + uint64_t cbits = (uint64_t) coef; + s16 ret = clamp_val(((cbits & ~sign_bit) >> 24), 0, 0x1FF); + + if (cbits & sign_bit) + ret = -ret; + + return ret; +} + +static void omap_crtc_cpr_coefs_from_ctm(const struct drm_color_ctm *ctm, +struct omap_dss_cpr_coefs *cpr) +{ + cpr->rr = omap_crtc_S31_32_to_s2_8(ctm->matrix[0]); + cpr->rg = omap_crtc_S31_32_to_s2_8(ctm->matrix[1]); + cpr->rb = omap_crtc_S31_32_to_s2_8(ctm->matrix[2]); + cpr->gr = omap_crtc_S31_32_to_s2_8(ctm->matrix[3]); + cpr->gg = omap_crtc_S31_32_to_s2_8(ctm->matrix[4]); + cpr->gb = omap_crtc_S31_32_to_s2_8(ctm->matrix[5]); + cpr->br = omap_crtc_S31_32_to_s2_8(ctm->matrix[6]); + cpr->bg = omap_crtc_S31_32_to_s2_8(ctm->matrix[7]); + cpr->bb = omap_crtc_S31_32_to_s2_8(ctm->matrix[8]); +} + static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) { struct omap_drm_private *priv = crtc->dev->dev_private; @@ -325,6 +351,14 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) info.partial_alpha_enabled = false; info.cpr_enable = false; + if (crtc->state->ctm) { + struct drm_color_ctm *ctm = + (struct drm_color_ctm *) crtc->state->ctm->data; + + info.cpr_enable = true; + omap_crtc_cpr_coefs_from_ctm(ctm, &info.cpr_coefs); + } + priv->dispc_ops->mgr_setup(omap_crtc->channel, &info); } @@ -636,7 +670,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, if (priv->dispc_ops->mgr_gamma_size(channel)) { uint gamma_lut_size = 256; - drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); + drm_crtc_enable_color_mgmt(crtc, 0, true, gamma_lut_size); drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size); } -- 1.9.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99851] [drm:.r600_ring_test [radeon]] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD)
https://bugs.freedesktop.org/show_bug.cgi?id=99851 --- Comment #31 from erhar...@mailbox.org --- Unfortunately my bisect efforts came to a halt as the current kernel won't boot. Early OpenFirmware boot console shows "Kernel panic - not syncing: Couldn't allocate pmd pagetable caches". The G5 freezes, I am not able to log in via sshd. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99851] [drm:.r600_ring_test [radeon]] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD)
https://bugs.freedesktop.org/show_bug.cgi?id=99851 --- Comment #32 from erhar...@mailbox.org --- Created attachment 131410 --> https://bugs.freedesktop.org/attachment.cgi?id=131410&action=edit incomplete bisect.log -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99851] [drm:.r600_ring_test [radeon]] *ERROR* radeon: ring 0 test failed (scratch(0x8504)=0xCAFEDEAD)
https://bugs.freedesktop.org/show_bug.cgi?id=99851 --- Comment #33 from erhar...@mailbox.org --- Created attachment 131411 --> https://bugs.freedesktop.org/attachment.cgi?id=131411&action=edit bisect kernel .config -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 0/5] replace hwmon_device_register for hwmon_device_register_with_info
This v8 fixes removes dummy functions which only had a return and moves the code into the switch statements. Versions: v1 -> v2: * Keep temp attrs as read only v2 -> v3: * Code fix-ups: struct and string as const and add return within switch due to fallthrough * Add Signed-off-by to all commits v3 -> v4: * Rever const to struct attribute. Kbuild complains. v4 -> v5: * Drops a check for attr_set in "nouveau_temp_is_visible". v5 -> v6: * Change to nouveau/hwmon all commit titles * Drop author change * Coding-Style * Move the check before the switch in nouveau_power_is_visible function * Expose temperature attrs as RW again * Get rid of nouveau_hwmon_set_pwm1/_enable and implement the code inside nouveau_pwm_write * Get rid of nouveau_hwmon_set_temp_* and implement the code inside nouveau_temp_write v6 -> v7: * Got rid of all dummy functions that only had a return, and moved code into the switch statements. v7 -> v8: * Fix warnings This patchseries replaces the deprecated hwmon_device_register function with the new one hwmon_device_register_with_info. It also does some cleanup. Oscar Salvador (5): nouveau/hwmon: Add config for all sensors and their settings nouveau/hwmon: Add nouveau_hwmon_ops structure with .is_visible/.read_string nouveau/hwmon: Remove old code, add .write/.read operations nouveau/hwmon: expose the auto_point and pwm_min/max attrs nouveau/hwmon: Change permissions to numeric drivers/gpu/drm/nouveau/nouveau_hwmon.c | 983 +++- 1 file changed, 464 insertions(+), 519 deletions(-) -- 2.1.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 1/5] nouveau/hwmon: Add config for all sensors and their settings
This is a preparation for the next patches. It just adds the sensors with their possible configurable settings and then fills the struct hwmon_channel_info with all this information. Signed-off-by: Oscar Salvador Reviewed-by: Martin Peres --- drivers/gpu/drm/nouveau/nouveau_hwmon.c | 72 + 1 file changed, 72 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c index 23b1670..24b40c5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c @@ -692,6 +692,78 @@ static const struct attribute_group hwmon_power_attrgroup = { static const struct attribute_group hwmon_power_caps_attrgroup = { .attrs = hwmon_power_caps_attributes, }; + +static const u32 nouveau_config_chip[] = { + HWMON_C_UPDATE_INTERVAL, + 0 +}; + +static const u32 nouveau_config_in[] = { + HWMON_I_INPUT | HWMON_I_MIN | HWMON_I_MAX | HWMON_I_LABEL, + 0 +}; + +static const u32 nouveau_config_temp[] = { + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST | + HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_EMERGENCY | + HWMON_T_EMERGENCY_HYST, + 0 +}; + +static const u32 nouveau_config_fan[] = { + HWMON_F_INPUT, + 0 +}; + +static const u32 nouveau_config_pwm[] = { + HWMON_PWM_INPUT | HWMON_PWM_ENABLE, + 0 +}; + +static const u32 nouveau_config_power[] = { + HWMON_P_INPUT | HWMON_P_CAP_MAX | HWMON_P_CRIT, + 0 +}; + +static const struct hwmon_channel_info nouveau_chip = { + .type = hwmon_chip, + .config = nouveau_config_chip, +}; + +static const struct hwmon_channel_info nouveau_temp = { + .type = hwmon_temp, + .config = nouveau_config_temp, +}; + +static const struct hwmon_channel_info nouveau_fan = { + .type = hwmon_fan, + .config = nouveau_config_fan, +}; + +static const struct hwmon_channel_info nouveau_in = { + .type = hwmon_in, + .config = nouveau_config_in, +}; + +static const struct hwmon_channel_info nouveau_pwm = { + .type = hwmon_pwm, + .config = nouveau_config_pwm, +}; + +static const struct hwmon_channel_info nouveau_power = { + .type = hwmon_power, + .config = nouveau_config_power, +}; + +static const struct hwmon_channel_info *nouveau_info[] = { + &nouveau_chip, + &nouveau_temp, + &nouveau_fan, + &nouveau_in, + &nouveau_pwm, + &nouveau_power, + NULL +}; #endif int -- 2.1.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 2/5] nouveau/hwmon: Add nouveau_hwmon_ops structure with .is_visible/.read_string
This patch introduces the nouveau_hwmon_ops structure, sets up .is_visible and .read_string operations and adds all the functions for these operations. This is also a preparation for the next patches, where most of the work is being done. This code doesn't interacture with the old one. It's just to make easier the review of all patches. Signed-off-by: Oscar Salvador Reviewed-by: Martin Peres --- drivers/gpu/drm/nouveau/nouveau_hwmon.c | 163 1 file changed, 163 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c index 24b40c5..734fc18 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c @@ -764,6 +764,169 @@ static const struct hwmon_channel_info *nouveau_info[] = { &nouveau_power, NULL }; + +static umode_t +nouveau_chip_is_visible(const void *data, u32 attr, int channel) +{ + switch (attr) { + case hwmon_chip_update_interval: + return 0444; + default: + return 0; + } +} + +static umode_t +nouveau_power_is_visible(const void *data, u32 attr, int channel) +{ + struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data); + struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->client.device); + + if (!iccsense || !iccsense->data_valid || list_empty(&iccsense->rails)) + return 0; + + switch (attr) { + case hwmon_power_input: + return 0444; + case hwmon_power_max: + if (iccsense->power_w_max) + return 0444; + return 0; + case hwmon_power_crit: + if (iccsense->power_w_crit) + return 0444; + return 0; + default: + return 0; + } +} + +static umode_t +nouveau_temp_is_visible(const void *data, u32 attr, int channel) +{ + struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data); + struct nvkm_therm *therm = nvxx_therm(&drm->client.device); + + if (therm && therm->attr_get && nvkm_therm_temp_get(therm) < 0) + return 0; + + switch (attr) { + case hwmon_temp_input: + case hwmon_temp_max: + case hwmon_temp_max_hyst: + case hwmon_temp_crit: + case hwmon_temp_crit_hyst: + case hwmon_temp_emergency: + case hwmon_temp_emergency_hyst: + return 0444; + default: + return 0; + } +} + +static umode_t +nouveau_pwm_is_visible(const void *data, u32 attr, int channel) +{ + struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data); + struct nvkm_therm *therm = nvxx_therm(&drm->client.device); + + if (therm && therm->attr_get && therm->fan_get && + therm->fan_get(therm) < 0) + return 0; + + switch (attr) { + case hwmon_pwm_enable: + case hwmon_pwm_input: + return 0644; + default: + return 0; + } +} + +static umode_t +nouveau_input_is_visible(const void *data, u32 attr, int channel) +{ + struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data); + struct nvkm_volt *volt = nvxx_volt(&drm->client.device); + + if (!volt || nvkm_volt_get(volt) < 0) + return 0; + + switch (attr) { + case hwmon_in_input: + case hwmon_in_label: + case hwmon_in_min: + case hwmon_in_max: + return 0444; + default: + return 0; + } +} + +static umode_t +nouveau_fan_is_visible(const void *data, u32 attr, int channel) +{ + struct nouveau_drm *drm = nouveau_drm((struct drm_device *)data); + struct nvkm_therm *therm = nvxx_therm(&drm->client.device); + + if (!therm || !therm->attr_get || nvkm_therm_fan_sense(therm) < 0) + return 0; + + switch (attr) { + case hwmon_fan_input: + return 0444; + default: + return 0; + } +} + +static umode_t +nouveau_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr, + int channel) +{ + switch (type) { + case hwmon_chip: + return nouveau_chip_is_visible(data, attr, channel); + case hwmon_temp: + return nouveau_temp_is_visible(data, attr, channel); + case hwmon_fan: + return nouveau_fan_is_visible(data, attr, channel); + case hwmon_in: + return nouveau_input_is_visible(data, attr, channel); + case hwmon_pwm: + return nouveau_pwm_is_visible(data, attr, channel); + case hwmon_power: + return nouveau_power_is_visible(data, attr, channel); + default: + return 0; + } +} + +static const char input_label[] = "GPU core"; + +static int +nouveau_read_string(struct device *dev, enum hwmon_sensor_types type, u32 attr, +