Re: [Dual-LVDS Acer Iconia laptop] i915/DRM issue: one screen stays off [3.2-rc4+]
On Mon, Dec 05, 2011 at 11:00:41AM +0800, joeyli wrote: > Add Cc. to platform-driver-x86 and linux-acpi > > Hi Baptiste > > 於 日,2011-12-04 於 17:07 +0100,Baptiste Jonglez 提到: > > Hi, > > > > I've got a lot of troubles with a dual-LVDS Acer laptop (it doesn't > > have a keyboard, but two displays with touchscreens) > > > > The Intel GPU is integrated into the Core i5-480M CPU: it's a bit > > older than Sandybridge, as it seems to be based on the Arrandale > > micro-architecture. > > > > In the BIOS, both displays work fine; but as soon as the kernel boots > > up, the second display (i.e. the one where you usually find a > > keyboard) is turned off. The main display works as expected. > > > > xrandr reports two LVDS displays: LVDS1, which is connected, and > > LVDS2, which is marked as "disconnected". No matter what I tried, I > > can't bring that second display up. > > > > During the boot, just after the drm is set up, the following message > > shows up: > > > > [drm:intel_dsm_pci_probe] *ERROR* failed to get supported _DSM functions > > > > (attached is the relevant part of dmesg [1]) The second screen works fine with the attached patch. It actually is 6 months old but seems to have been lost in the wild... Thanks Benjamin! There is still the issue of unhandled acer-wmi events, but it's far less incapacitating. I wonder what's the best way to report events to userspace, though (e.g. for the "keyboard" button, userspace might want to know when it is pressed in order to display a virtual keyboard or any other fancy stuff) Joey, if you need more logs for acer-wmi, I'll be happy to provide. Baptiste Original patch by Chris Wilson [1], here slightly adapted for the latest tree. [1] https://bugs.freedesktop.org/attachment.cgi?id=49069 We were checking whether the supplied edid matched the connector it was read from. We do this in case a DDC read returns an EDID for another device on a multifunction or otherwise interesting card. However, we failed to include LVDS as a digital device and so rejecting an otherwise valid EDID. Fixes the detection of the secondary SDVO LVDS panel on the Libretto W105. diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 3003fb2..ac322fb 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -50,6 +50,7 @@ #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) +#define IS_DIGITAL(c) (c->output_flag & (SDVO_TMDS_MASK | SDVO_LVDS_MASK)) static const char *tv_format_names[] = { @@ -1314,6 +1315,18 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) return status; } +static bool +intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo, + struct edid *edid) +{ + bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); + bool connector_is_digital = !!IS_DIGITAL(sdvo); + + DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n", + connector_is_digital, monitor_is_digital); + return connector_is_digital == monitor_is_digital; +} + static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector, bool force) { @@ -1358,10 +1371,11 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) if (edid == NULL) edid = intel_sdvo_get_analog_edid(connector); if (edid != NULL) { - if (edid->input & DRM_EDID_INPUT_DIGITAL) - ret = connector_status_disconnected; - else + if (intel_sdvo_connector_matches_edid(intel_sdvo_connector, + edid)) ret = connector_status_connected; + else + ret = connector_status_disconnected; connector->display_info.raw_edid = NULL; kfree(edid); } else @@ -1402,11 +1416,8 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) edid = intel_sdvo_get_analog_edid(connector); if (edid != NULL) { - struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); - bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); - bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector); - - if (connector_is_digital == monitor_is_digital) { + if (intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector), + edid)) { drm_mode_connector_update_edid_property(connector, edid); drm_add_e
Noise in games on Intel HD Graphics 2000
Hi, I'm running on Intel i3 2100 integrated graphics, I'm getting some strange noise particles in games like Minecraft and Speed Dreams (mostly noticeable in Minecraft) after playing a while, like half an hour. After that restarting game doesn't help, only computer restart have the effect of returning graphics to normal. Some screenshots bellow: Normal graphics: http://i1129.photobucket.com/albums/m506/semiRocket/2011-12-06_215907.png After a while: http://i1129.photobucket.com/albums/m506/semiRocket/2011-12-06_223010.png http://i1129.photobucket.com/albums/m506/semiRocket/2011-12-06_224500.png I'm running Fedora 16. On Fedora 15 I have experienced the same issue. Best regards ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Dual-LVDS Acer Iconia laptop] i915/DRM issue: one screen stays off [3.2-rc4+]
Hi Baptiste, On Tue, Dec 6, 2011 at 22:51, Baptiste Jonglez wrote: > On Mon, Dec 05, 2011 at 11:00:41AM +0800, joeyli wrote: >> Add Cc. to platform-driver-x86 and linux-acpi >> >> Hi Baptiste >> >> 於 日,2011-12-04 於 17:07 +0100,Baptiste Jonglez 提到: >> > Hi, >> > >> > I've got a lot of troubles with a dual-LVDS Acer laptop (it doesn't >> > have a keyboard, but two displays with touchscreens) >> > >> > The Intel GPU is integrated into the Core i5-480M CPU: it's a bit >> > older than Sandybridge, as it seems to be based on the Arrandale >> > micro-architecture. >> > >> > In the BIOS, both displays work fine; but as soon as the kernel boots >> > up, the second display (i.e. the one where you usually find a >> > keyboard) is turned off. The main display works as expected. >> > >> > xrandr reports two LVDS displays: LVDS1, which is connected, and >> > LVDS2, which is marked as "disconnected". No matter what I tried, I >> > can't bring that second display up. >> > >> > During the boot, just after the drm is set up, the following message >> > shows up: >> > >> > [drm:intel_dsm_pci_probe] *ERROR* failed to get supported _DSM functions >> > >> > (attached is the relevant part of dmesg [1]) > > The second screen works fine with the attached patch. It actually is > 6 months old but seems to have been lost in the wild... You don't have the problem of the second backlight still off? On our Iconia, we need to trigger a special DMI command to set it up (SDSS, IIRC). > > Thanks Benjamin! All the credits are from Ajax and somebody else on IRC I don't recall, really sorry. Thanks to them. Cheers, Benjamin. > > There is still the issue of unhandled acer-wmi events, but it's far > less incapacitating. I wonder what's the best way to report events to > userspace, though (e.g. for the "keyboard" button, userspace might > want to know when it is pressed in order to display a virtual keyboard > or any other fancy stuff) > > Joey, if you need more logs for acer-wmi, I'll be happy to provide. > > > Baptiste ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Dual-LVDS Acer Iconia laptop] i915/DRM issue: one screen stays off [3.2-rc4+]
On Tue, Dec 06, 2011 at 11:12:26PM +0100, Benjamin Tissoires wrote: > Hi Baptiste, Hi, > On Tue, Dec 6, 2011 at 22:51, Baptiste Jonglez wrote: > > The second screen works fine with the attached patch. It actually is > > 6 months old but seems to have been lost in the wild... > > You don't have the problem of the second backlight still off? > On our Iconia, we need to trigger a special DMI command to set it up > (SDSS, IIRC). No, with the patch, it worked out-of-the-box. I can even control the brightness in `/sys/class/backlight/acpi_video0/brightness' (it affects both displays at the same time though). But even at 0, it's still perfectly readable. Maybe this a bug that got fixed recently? I've actually tried the 3.1 kernel (and then the 3.2-rc4) because I noticed a lot of commits and improvements in the i915 driver recently. > > Thanks Benjamin! > > All the credits are from Ajax and somebody else on IRC I don't recall, > really sorry. Thanks to them. > > Cheers, > Benjamin. Regards, Baptiste ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [git pull] drm fixes
> So having looked at the patch itself, I don't dislike the notion of > making sure certain fields are nicely initialized. So I don't hate the > patch itself, but quite frankly, to me it doesn't smell even > *remotely* like "regression fix". I don't think this is something that > has ever worked. Well just for completeness I tracked it down to 724c80e1d630296d1324859e964d80d35007d83c which git describe shows as v2.6.36-rc5-456-g724c80e, so while it is a technical regression, it took a long time for anyone to notice. I think we probably need a more invasive patch in any case, as there is still a race between when the drm midlayer calls pci_set_master and the sanity enforcement, which we should close by moving pci_set_master into the drivers (midlayer design yet again for the win). so I'll leave it for -next. Dave. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 0/2] omap/drm: dmm/tiler support for GEM buffers
Hi, On Mon, 2011-12-05 at 19:19 -0600, Rob Clark wrote: > From: Rob Clark > > Support for DMM and tiled buffers. The DMM/TILER block in omap4+ SoC > provides support for remapping physically discontiguous buffers for > various DMA initiators (DSS, IVAHD, etc) which do not otherwise support > non-physically contiguous buffers, as well as providing support for > tiled buffers. > > See the descriptions in the following two patches for more details. Why is the tiler/dmm driver integrated into the drm driver? Tomi signature.asc Description: This is a digitally signed message part ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > > > > Do you have a use case for making the interface compile-time disabled? > > I had assumed that any code using it would make no sense if it's not > > available so you don't actually need this. > > Ok. Though if we keep the interface compile-time disabled, the users > can actually check and fail or fall-back gracefully when the API is > not available; If I remove it, anyways the users would need to do the > same compile time check whether API is available or not, right? If you have to do a compile-time check for the config symbol, it's better to do it the way you did here than in the caller. My guess was that no caller would actually require this, because when you write a part of a subsystem to interact with the dma-buf infrastructure, you would always disable compilation of an extire file that deals with everything related to struct dma_buf, not just stub out the calls. Arnd ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[git pull] drm fixes the reduced version
Hi Linus, Okay the 2 non-kexec fixes + one of the calloc changes as by looking at it, there was nothing stopping userspace for abusing the integer overflow on these ioctls. The other calloc changes either were kernel internal or had other things stopping userspace from exploiting them. Dave. The following changes since commit 45e713efe2fa574b6662e7fb63fae9497c5e03d4: Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2011-12-05 16:54:15 -0800) are available in the git repository at: git://people.freedesktop.org/~airlied/linux drm-fixes Alex Deucher (1): drm/radeon/kms: fix return type for radeon_encoder_get_dp_bridge_encoder_id Daniel Vetter (1): drm/i915: fix infinite recursion on unbind due to ilk vt-d w/a Thomas Meyer (1): vmwgfx: Use kcalloc instead of kzalloc to allocate array drivers/gpu/drm/i915/i915_gem.c |7 ++- drivers/gpu/drm/radeon/radeon_encoders.c |7 +++ drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c|4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wed, Dec 7, 2011 at 3:41 PM, Arnd Bergmann wrote: > On Wednesday 07 December 2011, Semwal, Sumit wrote: >> > >> > Do you have a use case for making the interface compile-time disabled? >> > I had assumed that any code using it would make no sense if it's not >> > available so you don't actually need this. >> >> Ok. Though if we keep the interface compile-time disabled, the users >> can actually check and fail or fall-back gracefully when the API is >> not available; If I remove it, anyways the users would need to do the >> same compile time check whether API is available or not, right? > > If you have to do a compile-time check for the config symbol, it's better > to do it the way you did here than in the caller. > > My guess was that no caller would actually require this, because when you > write a part of a subsystem to interact with the dma-buf infrastructure, > you would always disable compilation of an extire file that deals with > everything related to struct dma_buf, not just stub out the calls. Right; that would be ideal, but we may not be able to ask each user to do so - especially when the sharing part might be interspersed in existing buffer handling code. So for now, I would like to keep it as it-is. > > Arnd > BR, ~Sumit. > -- ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 43395] Game running in wine stops rendering
https://bugs.freedesktop.org/show_bug.cgi?id=43395 --- Comment #12 from Michel Dänzer 2011-12-07 03:17:11 UTC --- Does setting the environment variable vblank_mode=0 for the Wine process using OpenGL work around the problem? There should be a message ATTENTION: default value of option vblank_mode overridden by environment. on stderr to confirm it takes effect. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > Right; that would be ideal, but we may not be able to ask each user to > do so - especially when the sharing part might be interspersed in > existing buffer handling code. So for now, I would like to keep it as > it-is. Ok, fair enough. It certainly doesn't hurt. Arnd ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Request for fixing atombios_get_encoder_mode
In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. -- Rafał -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ -- ___ Dri-devel mailing list dri-de...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Request for fixing atombios_get_encoder_mode
In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. -- Rafał ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
Hi Daniel, Rob, On Tue, Dec 6, 2011 at 3:41 AM, Rob Clark wrote: > On Mon, Dec 5, 2011 at 3:23 PM, Daniel Vetter wrote: >> On Mon, Dec 05, 2011 at 02:46:47PM -0600, Rob Clark wrote: >>> On Mon, Dec 5, 2011 at 11:18 AM, Arnd Bergmann wrote: >>> > In the patch 2, you have a section about migration that mentions that >>> > it is possible to export a buffer that can be migrated after it >>> > is already mapped into one user driver. How does that work when >>> > the physical addresses are mapped into a consumer device already? >>> >>> I think you can do physical migration if you are attached, but >>> probably not if you are mapped. >> >> Yeah, that's very much how I see this, and also why map/unmap (at least >> for simple users like v4l) should only bracket actual usage. GPU memory >> managers need to be able to move around buffers while no one is using >> them. >> >> [snip] >> >>> >> + /* allow allocator to take care of cache ops */ >>> >> + void (*sync_sg_for_cpu) (struct dma_buf *, struct device *); >>> >> + void (*sync_sg_for_device)(struct dma_buf *, struct device *); >>> > >>> > I don't see how this works with multiple consumers: For the streaming >>> > DMA mapping, there must be exactly one owner, either the device or >>> > the CPU. Obviously, this rule needs to be extended when you get to >>> > multiple devices and multiple device drivers, plus possibly user >>> > mappings. Simply assigning the buffer to "the device" from one >>> > driver does not block other drivers from touching the buffer, and >>> > assigning it to "the cpu" does not stop other hardware that the >>> > code calling sync_sg_for_cpu is not aware of. >>> > >>> > The only way to solve this that I can think of right now is to >>> > mandate that the mappings are all coherent (i.e. noncachable >>> > on noncoherent architectures like ARM). If you do that, you no >>> > longer need the sync_sg_for_* calls. >>> >>> My original thinking was that you either need DMABUF_CPU_{PREP,FINI} >>> ioctls and corresponding dmabuf ops, which userspace is required to >>> call before / after CPU access. Or just remove mmap() and do the >>> mmap() via allocating device and use that device's equivalent >>> DRM_XYZ_GEM_CPU_{PREP,FINI} or DRM_XYZ_GEM_SET_DOMAIN ioctls. That >>> would give you a way to (a) synchronize with gpu/asynchronous >>> pipeline, (b) synchronize w/ multiple hw devices vs cpu accessing >>> buffer (ie. wait all devices have dma_buf_unmap_attachment'd). And >>> that gives you a convenient place to do cache operations on >>> noncoherent architecture. >>> >>> I sort of preferred having the DMABUF shim because that lets you pass >>> a buffer around userspace without the receiving code knowing about a >>> device specific API. But the problem I eventually came around to: if >>> your GL stack (or some other userspace component) is batching up >>> commands before submission to kernel, the buffers you need to wait for >>> completion might not even be submitted yet. So from kernel >>> perspective they are "ready" for cpu access. Even though in fact they >>> are not in a consistent state from rendering perspective. I don't >>> really know a sane way to deal with that. Maybe the approach instead >>> should be a userspace level API (in libkms/libdrm?) to provide >>> abstraction for userspace access to buffers rather than dealing with >>> this at the kernel level. >> >> Well, there's a reason GL has an explicit flush and extensions for sync >> objects. It's to support such scenarios where the driver batches up gpu >> commands before actually submitting them. > > Hmm.. what about other non-GL APIs.. maybe vaapi/vdpau or similar? > (Or something that I haven't thought of.) > >> Also, recent gpus have all (or >> shortly will grow) multiple execution pipelines, so it's also important >> that you sync up with the right command stream. Syncing up with all of >> them is generally frowned upon for obvious reasons ;-) > > Well, I guess I am happy enough with something that is at least > functional. Usespace access would (I think) mainly be weird edge case > type stuff. But... > > >> On the topic of a coherency model for dmabuf, I think we need to look at >> dma_buf_attachment_map/unmap (and also the mmap variants cpu_start and >> cpu_finish or whatever they might get called) as barriers: >> >> So after a dma_buf_map, all previsously completed dma operations (i.e. >> unmap already called) and any cpu writes (i.e. cpu_finish called) will be >> coherent. Similar rule holds for cpu access through the userspace mmap, >> only writes completed before the cpu_start will show up. >> >> Similar, writes done by the device are only guaranteed to show up after >> the _unmap. Dito for cpu writes and cpu_finish. >> >> In short we always need two function calls to denote the start/end of the >> "critical section". > > Yup, this was exactly my assumption. But I guess it is better to spell it > out. Thanks for the excellent discussion - it indeed is ve
Re: [PATCH 0/2] omap/drm: dmm/tiler support for GEM buffers
On Wed, Dec 7, 2011 at 3:31 AM, Tomi Valkeinen wrote: > Hi, > > On Mon, 2011-12-05 at 19:19 -0600, Rob Clark wrote: >> From: Rob Clark >> >> Support for DMM and tiled buffers. The DMM/TILER block in omap4+ SoC >> provides support for remapping physically discontiguous buffers for >> various DMA initiators (DSS, IVAHD, etc) which do not otherwise support >> non-physically contiguous buffers, as well as providing support for >> tiled buffers. >> >> See the descriptions in the following two patches for more details. > > Why is the tiler/dmm driver integrated into the drm driver? Basically because of a big list of reasons to keep it integrated, and no good reason that I could think of to make it a standalone driver. 1) Because the function/usage is most like a GTT in other systems.. the usage is really graphics/multimedia related so GEM is a natural way to expose it to userspace. Other places we want to use tiler buffers, like camera, are neatly handled by using dmabuf to export the GEM buffer to a different device. 2) We went down the separate driver path in the past, and it really exposes a lot of problems. See the hacks that were done in the past to get wakeup/resume sequencing correct when tiler was a separate driver. (hint: the table of page addresses needs to be reprogrammed before any access to buffer mapped in DMM is done.. this can be accomplished quite simply by restoring the LUT before enabling any video pipes when it is in a single driver... although that is still in the TODO) 3) Doing some of the more advanced stuff, like page flipping using DMM's synchronized refill to update page addresses synchronized with scannout will, I think, end up being some kinda weird API.. I don't think I'd want to make that a public API exported by one driver consumed by another, but not such a problem if it is just something used internally by one driver. 4) The LUT isn't really big enough to be managed statically like we did in the past.. it needs to be managed dynamically, mapping and evicting buffers. This is something that is typical with other gfx drivers in their management of their GTT.. 5) I wouldn't really want to duplicate the userspace mmap'ing games for 2d buffers in a lot of different drivers. The code is structured such that it could be separated in the future, if there is any good reason too. But so far I've been unable to think of one. BR, -R > Tomi > > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
re: drm/ttm: callback move_notify any time bo placement
change v4 Hello Jerome Glisse, This is a semi-automatic email about new static checker warnings. The patch dc97b3409a79: "drm/ttm: callback move_notify any time bo placement change v4" from Nov 18, 2011, leads to the following Smatch complaint: drivers/gpu/drm/nouveau/nouveau_bo.c +818 nouveau_bo_move_ntfy() warn: variable dereferenced before check 'new_mem' (see line 813) drivers/gpu/drm/nouveau/nouveau_bo.c 812 { 813 struct nouveau_mem *node = new_mem->mm_node; Old dereference. new_mem can be NULL here these days. 814 struct nouveau_bo *nvbo = nouveau_bo(bo); 815 struct nouveau_vma *vma; 816 817 list_for_each_entry(vma, &nvbo->vma_list, head) { 818 if (new_mem && new_mem->mem_type == TTM_PL_VRAM) { ^^^ new check. 819 nouveau_vm_map(vma, new_mem->mm_node); 820 } else regards, dan carpenter ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [mipsel+rs780e]Occasionally "GPU lockup" after resuming from suspend.
When "MC timeout" happens at GPU reset, we found the 12th and 13th bits of R_000E50_SRBM_STATUS is 1. From kernel code we found these two bits are like this: #define G_000E50_MCDX_BUSY(x) (((x) >> 12) & 1) #define G_000E50_MCDW_BUSY(x) (((x) >> 13) & 1) Could you please tell me what does they mean? And if possible, I want to know the functionalities of these 5 registers in detail: #define R_000E60_SRBM_SOFT_RESET 0x0E60 #define R_000E50_SRBM_STATUS 0x0E50 #define R_008020_GRBM_SOFT_RESET0x8020 #define R_008010_GRBM_STATUS0x8010 #define R_008014_GRBM_STATUS2 0x8014 A bit more info: If I reset the MC after resetting CP (this is what Linux-2.6.34 does, but removed since 2.6.35), then "MC timeout" will disappear, but there is still "ring test failed". Huacai Chen > 2011/11/8 : >> And, I want to know something: >> 1, Does GPU use MC to access GTT? > > Yes. All GPU clients (display, 3D, etc.) go through the MC to access > memory (vram or gart). > >> 2, What can cause MC timeout? > > Lots of things. Some GPU client still active, some GPU client hung or > not properly initialized. > > Alex > >> >>> Hi, >>> >>> Some status update. >>> 在 2011年9月29日 下午5:17,Chen Jie 写道: Hi, Add more information. We got occasionally "GPU lockup" after resuming from suspend(on mipsel platform with a mips64 compatible CPU and rs780e, the kernel is 3.1.0-rc8 64bit). Related kernel message: /* return from STR */ [ 156.152343] radeon :01:05.0: WB enabled [ 156.187500] [drm] ring test succeeded in 0 usecs [ 156.187500] [drm] ib test succeeded in 0 usecs [ 156.398437] ata2: SATA link down (SStatus 0 SControl 300) [ 156.398437] ata3: SATA link down (SStatus 0 SControl 300) [ 156.398437] ata4: SATA link down (SStatus 0 SControl 300) [ 156.578125] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 156.597656] ata1.00: configured for UDMA/133 [ 156.613281] usb 1-5: reset high speed USB device number 4 using ehci_hcd [ 157.027343] usb 3-2: reset low speed USB device number 2 using ohci_hcd [ 157.609375] usb 3-3: reset low speed USB device number 3 using ohci_hcd [ 157.683593] r8169 :02:00.0: eth0: link up [ 165.621093] PM: resume of devices complete after 9679.556 msecs [ 165.628906] Restarting tasks ... done. [ 177.085937] radeon :01:05.0: GPU lockup CP stall for more than 10019msec [ 177.089843] [ cut here ] [ 177.097656] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:267 radeon_fence_wait+0x25c/0x33c() [ 177.105468] GPU lockup (waiting for 0x13C3 last fence id 0x13AD) [ 177.113281] Modules linked in: psmouse serio_raw [ 177.117187] Call Trace: [ 177.121093] [] dump_stack+0x8/0x34 [ 177.125000] [] warn_slowpath_common+0x78/0xa0 [ 177.132812] [] warn_slowpath_fmt+0x38/0x44 [ 177.136718] [] radeon_fence_wait+0x25c/0x33c [ 177.144531] [] ttm_bo_wait+0x108/0x220 [ 177.148437] [] radeon_gem_wait_idle_ioctl+0x80/0x114 [ 177.156250] [] drm_ioctl+0x2e4/0x3fc [ 177.160156] [] radeon_kms_compat_ioctl+0x28/0x38 [ 177.167968] [] compat_sys_ioctl+0x120/0x35c [ 177.171875] [] handle_sys+0x118/0x138 [ 177.179687] ---[ end trace 92f63d998efe4c6d ]--- [ 177.187500] radeon :01:05.0: GPU softreset [ 177.191406] radeon :01:05.0: R_008010_GRBM_STATUS=0xF57C2030 [ 177.195312] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 [ 177.203125] radeon :01:05.0: R_000E50_SRBM_STATUS=0x20023040 [ 177.363281] radeon :01:05.0: Wait for MC idle timedout ! [ 177.367187] radeon :01:05.0: R_008020_GRBM_SOFT_RESET=0x7FEE [ 177.390625] radeon :01:05.0: R_008020_GRBM_SOFT_RESET=0x0001 [ 177.414062] radeon :01:05.0: R_008010_GRBM_STATUS=0xA0003030 [ 177.417968] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 [ 177.425781] radeon :01:05.0: R_000E50_SRBM_STATUS=0x2002B040 [ 177.433593] radeon :01:05.0: GPU reset succeed [ 177.605468] radeon :01:05.0: Wait for MC idle timedout ! [ 177.761718] radeon :01:05.0: Wait for MC idle timedout ! [ 177.804687] radeon :01:05.0: WB enabled [ 178.00] [drm:r600_ring_test] *ERROR* radeon: ring test failed (scratch(0x8504)=0xCAFEDEAD) >>> After pinned ring in VRAM, it warned an ib test failure. It seems >>> something wrong with accessing through GTT. >>> >>> We dump gart table just after stopped cp, and compare gart table with >>> the dumped one just after r600_pcie_gart_enable, and don't find any >>> difference. >>> >>> Any idea? >>> [ 178.007812] [drm:r600_resume] *ERROR* r600 startup failed on resume [
Re: [RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > Thanks for the excellent discussion - it indeed is very good learning > for the relatively-inexperienced me :) > > So, for the purpose of dma-buf framework, could I summarize the > following and rework accordingly?: > 1. remove mmap() dma_buf_op [and mmap fop], and introduce cpu_start(), > cpu_finish() ops to bracket cpu accesses to the buffer. Also add > DMABUF_CPU_START / DMABUF_CPU_FINI IOCTLs? I think we'd be better off for now without the extra ioctls and just document that a shared buffer must not be exported to user space using mmap at all, to avoid those problems. Serialization between GPU and CPU is on a higher level than the dma_buf framework IMHO. > 2. remove sg_sync* ops for now (and we'll see if we need to add them > later if needed) Just removing the sg_sync_* operations is not enough. We have to make the decision whether we want to allow a) only coherent mappings of the buffer into kernel memory (requiring an extension to the dma_map_ops on ARM to not flush caches at map/unmap time) b) not allowing any in-kernel mappings (same requirement on ARM, also limits the usefulness of the dma_buf if we cannot access it from the kernel or from user space) c) only allowing streaming mappings, even if those are non-coherent (requiring strict serialization between CPU (in-kernel) and dma users of the buffer) This issue has to be solved or we get random data corruption. Arnd ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon/benchmark: common modes sweep ignores 640x480@32
Right. The goof is a consequence of me doing copy-and-paste style edits. I first added powers-of-two benchmark which intentionally start from index 1 but and then copied and edited that into comon-modes benchmark, and missed to correct the starting index of the loop. Reviewed-by: Ilija Hadzic On Wed, 7 Dec 2011 ch...@lemote.com wrote: From: Chen Jie Sweep common_modes array should start with index 0. Signed-off-by: Chen Jie --- drivers/gpu/drm/radeon/radeon_benchmark.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 17e1a9b..d1cea8d 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c @@ -229,21 +229,21 @@ void radeon_benchmark(struct radeon_device *rdev, int test_number) break; case 6: /* GTT to VRAM, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_GTT, RADEON_GEM_DOMAIN_VRAM); break; case 7: /* VRAM to GTT, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_VRAM, RADEON_GEM_DOMAIN_GTT); break; case 8: /* VRAM to VRAM, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_VRAM, RADEON_GEM_DOMAIN_VRAM); -- 1.7.7.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Request for fixing atombios_get_encoder_mode
2011/12/7 Rafał Miłecki : > In theory function atombios_get_encoder_mode should report > ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report > ATOM_ENCODER_MODE_DVI if card is DCE4. > > Is there any reason for it? Can we just drop that DCE4 condition? This > fixme seems to be here since ever. > It causes display corruption unless the hdmi packet engine is set up properly. Alex > -- > Rafał > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 00/23] kill drm cruft with fire
> > >> Testing this on via would be awesome! Iirc I haven't changed anything in > > >> the via specific patches, but if it's more convenient you can also > > >> directly test my branch: > > >> > > >> http://cgit.freedesktop.org/~danvet/drm/log/?h=kill-with-fire > > > > > > Okay I tried the patches and it locked up the openchrome X server. I'm > > > going to try your branch tonight to see if it makes any difference. If it > > > still fails I will have to track down what the problem is. > > > > If you can bisect the issue, that would be awesome. Meanwhile my sis > > card arrived, so I'm hopefully get around to test that part of the > > series rsn. I'm traveling atm though, so response time will suffer a > > bit. > > Any updates on testing results? Yes I do. I'm using the patches you posted. Patches 1 to 10 work with no problems. Ist patch 11 that breaks the openchrome xorg driver. Have to do some digging to find the exact problem. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [mipsel+rs780e]Occasionally "GPU lockup" after resuming from suspend.
2011/12/7 : > When "MC timeout" happens at GPU reset, we found the 12th and 13th > bits of R_000E50_SRBM_STATUS is 1. From kernel code we found these > two bits are like this: > #define G_000E50_MCDX_BUSY(x) (((x) >> 12) & 1) > #define G_000E50_MCDW_BUSY(x) (((x) >> 13) & 1) > > Could you please tell me what does they mean? And if possible, They refer to sub-blocks in the memory controller. I don't really know off hand what the name mean. > I want to know the functionalities of these 5 registers in detail: > #define R_000E60_SRBM_SOFT_RESET 0x0E60 > #define R_000E50_SRBM_STATUS 0x0E50 > #define R_008020_GRBM_SOFT_RESET0x8020 > #define R_008010_GRBM_STATUS0x8010 > #define R_008014_GRBM_STATUS2 0x8014 > > A bit more info: If I reset the MC after resetting CP (this is what > Linux-2.6.34 does, but removed since 2.6.35), then "MC timeout" will > disappear, but there is still "ring test failed". The bits are defined in r600d.h. As to the acronyms: BIF - Bus InterFace CG - clocks DC - Display Controller GRBM - Graphics block (3D engine) HDP - Host Data Path (CPU access to vram via the PCI BAR) IH, RLC - Interrupt controller MC - Memory controller ROM - ROM SEM - semaphore controller When you reset the MC, you will probably have to reset just about everything else since most blocks depend on the MC for access to memory. If you do reset the MC, you should do it at prior to calling asic_init so you make sure all the hw gets re-initialized properly. Additionally, you should probably reset the GRBM either via SRBM_SOFT_RESET or the individual sub-blocks via GRBM_SOFT_RESET. Alex > > Huacai Chen > >> 2011/11/8 : >>> And, I want to know something: >>> 1, Does GPU use MC to access GTT? >> >> Yes. All GPU clients (display, 3D, etc.) go through the MC to access >> memory (vram or gart). >> >>> 2, What can cause MC timeout? >> >> Lots of things. Some GPU client still active, some GPU client hung or >> not properly initialized. >> >> Alex >> >>> Hi, Some status update. 在 2011年9月29日 下午5:17,Chen Jie 写道: > Hi, > Add more information. > We got occasionally "GPU lockup" after resuming from suspend(on mipsel > platform with a mips64 compatible CPU and rs780e, the kernel is > 3.1.0-rc8 > 64bit). Related kernel message: > /* return from STR */ > [ 156.152343] radeon :01:05.0: WB enabled > [ 156.187500] [drm] ring test succeeded in 0 usecs > [ 156.187500] [drm] ib test succeeded in 0 usecs > [ 156.398437] ata2: SATA link down (SStatus 0 SControl 300) > [ 156.398437] ata3: SATA link down (SStatus 0 SControl 300) > [ 156.398437] ata4: SATA link down (SStatus 0 SControl 300) > [ 156.578125] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > [ 156.597656] ata1.00: configured for UDMA/133 > [ 156.613281] usb 1-5: reset high speed USB device number 4 using > ehci_hcd > [ 157.027343] usb 3-2: reset low speed USB device number 2 using > ohci_hcd > [ 157.609375] usb 3-3: reset low speed USB device number 3 using > ohci_hcd > [ 157.683593] r8169 :02:00.0: eth0: link up > [ 165.621093] PM: resume of devices complete after 9679.556 msecs > [ 165.628906] Restarting tasks ... done. > [ 177.085937] radeon :01:05.0: GPU lockup CP stall for more than > 10019msec > [ 177.089843] [ cut here ] > [ 177.097656] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:267 > radeon_fence_wait+0x25c/0x33c() > [ 177.105468] GPU lockup (waiting for 0x13C3 last fence id > 0x13AD) > [ 177.113281] Modules linked in: psmouse serio_raw > [ 177.117187] Call Trace: > [ 177.121093] [] dump_stack+0x8/0x34 > [ 177.125000] [] warn_slowpath_common+0x78/0xa0 > [ 177.132812] [] warn_slowpath_fmt+0x38/0x44 > [ 177.136718] [] radeon_fence_wait+0x25c/0x33c > [ 177.144531] [] ttm_bo_wait+0x108/0x220 > [ 177.148437] [] > radeon_gem_wait_idle_ioctl+0x80/0x114 > [ 177.156250] [] drm_ioctl+0x2e4/0x3fc > [ 177.160156] [] radeon_kms_compat_ioctl+0x28/0x38 > [ 177.167968] [] compat_sys_ioctl+0x120/0x35c > [ 177.171875] [] handle_sys+0x118/0x138 > [ 177.179687] ---[ end trace 92f63d998efe4c6d ]--- > [ 177.187500] radeon :01:05.0: GPU softreset > [ 177.191406] radeon :01:05.0: R_008010_GRBM_STATUS=0xF57C2030 > [ 177.195312] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 > [ 177.203125] radeon :01:05.0: R_000E50_SRBM_STATUS=0x20023040 > [ 177.363281] radeon :01:05.0: Wait for MC idle timedout ! > [ 177.367187] radeon :01:05.0: > R_008020_GRBM_SOFT_RESET=0x7FEE > [ 177.390625] radeon :01:05.0: > R_008020_GRBM_SOFT_RESET=0x0001 > [ 177.414062] radeon :01:05.0: R_0080
Re: Request for fixing atombios_get_encoder_mode
W dniu 7 grudnia 2011 14:53 użytkownik Alex Deucher napisał: > 2011/12/7 Rafał Miłecki : >> In theory function atombios_get_encoder_mode should report >> ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report >> ATOM_ENCODER_MODE_DVI if card is DCE4. >> >> Is there any reason for it? Can we just drop that DCE4 condition? This >> fixme seems to be here since ever. >> > > It causes display corruption unless the hdmi packet engine is set up properly. Even with radeon.audio=0? -- Rafał ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: WARNING: at mm/slub.c:3357, kernel BUG at mm/slub.c:3413
On 2011.12.07 at 15:32 +0100, Robert Richter wrote: > On 02.12.11 21:48:20, Markus Trippelsdorf wrote: > > BTW I always see (mostly only on screen, sometimes in the logs): > > > > [Firmware Bug]: cpu 2, try to use APIC500 (LVT offset 0) for vector > > 0x10400, but the register is already in use for vector 0xf9 on another cpu > > [Firmware Bug]: cpu 2, IBS interrupt offset 0 not available > > (MSRC001103A=0x0100) > > [Firmware Bug]: using offset 1 for IBS interrupts > > [Firmware Bug]: workaround enabled for IBS LVT offset > > perf: AMD IBS detected (0x001f) > > > > But I hope that it is only a harmless warning. > > (perf Instruction-Based Sampling) > > Yes, the message always apears on AMD family 10h. Nothing to worry > about. > > A patch is on the way to soften the message to not scare the people: > > > http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=16e5294e5f8303756a179cf218e37dfb9ed34417 Thanks. It's already in mainline and the message is gone now. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=16e5294e5f8303756a179cf218e37dfb9ed34417 -- Markus ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Request for fixing atombios_get_encoder_mode
2011/12/7 Rafał Miłecki : > W dniu 7 grudnia 2011 14:53 użytkownik Alex Deucher > napisał: >> 2011/12/7 Rafał Miłecki : >>> In theory function atombios_get_encoder_mode should report >>> ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report >>> ATOM_ENCODER_MODE_DVI if card is DCE4. >>> >>> Is there any reason for it? Can we just drop that DCE4 condition? This >>> fixme seems to be here since ever. >>> >> >> It causes display corruption unless the hdmi packet engine is set up >> properly. > > Even with radeon.audio=0? No, as in that case, DVI is returned. On DCE3.0 and newer chips there is no explicit hdmi engine enable bit. You just select HDMI mode rather than DVI mode in the digital encoder setup. So if you select HDMI in the encoder setup and you have not configured the hdmi engine correctly you will git display corruption or a blank screen. Which is why I had to disable audio by default. Since audio is off by default, the DCE4 conditional in the hdmi case could be removed. Alex > > -- > Rafał > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Request for fixing atombios_get_encoder_mode
W dniu 7 grudnia 2011 15:53 użytkownik Alex Deucher napisał: > 2011/12/7 Rafał Miłecki : >> W dniu 7 grudnia 2011 14:53 użytkownik Alex Deucher >> napisał: >>> 2011/12/7 Rafał Miłecki : In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. >>> >>> It causes display corruption unless the hdmi packet engine is set up >>> properly. >> >> Even with radeon.audio=0? > > No, as in that case, DVI is returned. On DCE3.0 and newer chips there > is no explicit hdmi engine enable bit. You just select HDMI mode > rather than DVI mode in the digital encoder setup. So if you select > HDMI in the encoder setup and you have not configured the hdmi engine > correctly you will git display corruption or a blank screen. Which is > why I had to disable audio by default. Since audio is off by default, > the DCE4 conditional in the hdmi case could be removed. OK, it makes sense, thanks. Btw I believe there *is* HDMI enabling bit on DCE3+, we probably just don't need to poke it manually :) It is bit 0x1000 in registers 0x7000, 0x7c00, 0x10800, 0x11400, 0x12000, 0x12c00 All my HDMI frames are ignored without that bit set. -- Rafał ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/23] drm/via: track obj->drm_fd relations in the driver
> Exactly like the previous patch for sis. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons Same goes for PATCH 01 which I'm missing in my inbox. > --- > drivers/gpu/drm/via/via_drv.c | 25 + > drivers/gpu/drm/via/via_mm.c | 22 ++ > include/drm/via_drm.h |4 > 3 files changed, 43 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c > index 920a552..472adcf 100644 > --- a/drivers/gpu/drm/via/via_drv.c > +++ b/drivers/gpu/drm/via/via_drv.c > @@ -28,6 +28,29 @@ > > #include "drm_pciids.h" > > +static int via_driver_open(struct drm_device *dev, struct drm_file *file) > +{ > + struct via_file_private *file_priv; > + > + DRM_DEBUG_DRIVER("\n"); > + file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL); > + if (!file_priv) > + return -ENOMEM; > + > + file->driver_priv = file_priv; > + > + INIT_LIST_HEAD(&file_priv->obj_list); > + > + return 0; > +} > + > +void via_driver_postclose(struct drm_device *dev, struct drm_file *file) > +{ > + struct via_file_private *file_priv = file->driver_priv; > + > + kfree(file_priv); > +} > + > static struct pci_device_id pciidlist[] = { > viadrv_PCI_IDS > }; > @@ -38,6 +61,8 @@ static struct drm_driver driver = { > DRIVER_IRQ_SHARED, > .load = via_driver_load, > .unload = via_driver_unload, > + .open = via_driver_open, > + .postclose = via_driver_postclose, > .context_dtor = via_final_context, > .get_vblank_counter = via_get_vblank_counter, > .enable_vblank = via_enable_vblank, > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index 6cc2dad..19bb77c 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -115,12 +115,13 @@ void via_lastclose(struct drm_device *dev) > } > > int via_mem_alloc(struct drm_device *dev, void *data, > - struct drm_file *file_priv) > + struct drm_file *file) > { > drm_via_mem_t *mem = data; > int retval = 0; > struct drm_memblock_item *item; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > + struct via_file_private *file_priv = file->driver_priv; > unsigned long tmpSize; > > if (mem->type > VIA_MEM_AGP) { > @@ -137,10 +138,10 @@ int via_mem_alloc(struct drm_device *dev, void *data, > } > > tmpSize = (mem->size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; > - item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, > - (unsigned long)file_priv); > - mutex_unlock(&dev->struct_mutex); > + item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, 0); > + > if (item) { > + list_move(&item->owner_list, &file_priv->obj_list); > mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > dev_priv->vram_offset : dev_priv->agp_offset) + > (item->mm-> > @@ -153,6 +154,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > DRM_DEBUG("Video memory allocation failed\n"); > retval = -ENOMEM; > } > + mutex_unlock(&dev->struct_mutex); > > return retval; > } > @@ -173,12 +175,13 @@ int via_mem_free(struct drm_device *dev, void *data, > struct drm_file *file_priv) > > > void via_reclaim_buffers_locked(struct drm_device *dev, > - struct drm_file *file_priv) > + struct drm_file *file) > { > - drm_via_private_t *dev_priv = dev->dev_private; > + struct via_file_private *file_priv = file->driver_priv; > + struct drm_memblock_item *entry, *next; > > mutex_lock(&dev->struct_mutex); > - if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)file_priv)) { > + if (list_empty(&file_priv->obj_list)) { > mutex_unlock(&dev->struct_mutex); > return; > } > @@ -186,7 +189,10 @@ void via_reclaim_buffers_locked(struct drm_device *dev, > if (dev->driver->dma_quiescent) > dev->driver->dma_quiescent(dev); > > - drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv); > + list_for_each_entry_safe(entry, next, &file_priv->obj_list, > + owner_list) { > + drm_sman_free(entry); > + } > mutex_unlock(&dev->struct_mutex); > return; > } > diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h > index fd11a5b..79b3b6e 100644 > --- a/include/drm/via_drm.h > +++ b/include/drm/via_drm.h > @@ -274,4 +274,8 @@ typedef struct drm_via_dmablit { > drm_via_blitsync_t sync; > } drm_via_dmablit_t; > > +struct via_file_private { > + struct list_head obj_list; > +}; > + > #endif /* _VIA_DRM_H_ */ > -- > 1.7.7.1 > > ___ > dri-devel
Re: [PATCH 03/23] drm/sman: kill owner tracking interface functions
> These are now unused. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 38 -- > include/drm/drm_sman.h | 19 --- > 2 files changed, 0 insertions(+), 57 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index 37548b7..a672fea 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -278,27 +278,6 @@ static void drm_sman_remove_owner(struct drm_sman *sman, > kfree(owner_item); > } > > -int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) > -{ > - > - struct drm_hash_item *hash_item; > - struct drm_owner_item *owner_item; > - > - if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { > - return -1; > - } > - > - owner_item = drm_hash_entry(hash_item, struct drm_owner_item, > owner_hash); > - if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { > - drm_sman_remove_owner(sman, owner_item); > - return -1; > - } > - > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_owner_clean); > - > static void drm_sman_do_owner_cleanup(struct drm_sman *sman, > struct drm_owner_item *owner_item) > { > @@ -311,23 +290,6 @@ static void drm_sman_do_owner_cleanup(struct drm_sman > *sman, > drm_sman_remove_owner(sman, owner_item); > } > > -void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner) > -{ > - > - struct drm_hash_item *hash_item; > - struct drm_owner_item *owner_item; > - > - if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { > - > - return; > - } > - > - owner_item = drm_hash_entry(hash_item, struct drm_owner_item, > owner_hash); > - drm_sman_do_owner_cleanup(sman, owner_item); > -} > - > -EXPORT_SYMBOL(drm_sman_owner_cleanup); > - > void drm_sman_cleanup(struct drm_sman *sman) > { > struct drm_owner_item *entry, *next; > diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h > index 3b65ccf..d5ed903 100644 > --- a/include/drm/drm_sman.h > +++ b/include/drm/drm_sman.h > @@ -149,25 +149,6 @@ extern int drm_sman_free_key(struct drm_sman * sman, > unsigned int key); > extern void drm_sman_free(struct drm_memblock_item *item); > > /* > - * returns 1 iff there are no stale memory blocks associated with this owner. > - * Typically called to determine if we need to idle the hardware and call > - * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes > all > - * resources associated with owner. > - */ > - > -extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner); > - > -/* > - * Frees all stale memory blocks associated with this owner. Note that this > - * requires that the hardware is finished with all blocks, so the graphics > engine > - * should be idled before this call is made. This function also frees > - * any resources associated with "owner" and should be called when owner > - * is not going to be referenced anymore. > - */ > - > -extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long > owner); > - > -/* > * Frees all stale memory blocks associated with the memory manager. > * See idling above. > */ > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/23] drm/sman: rip out owner tracking
> In contrast to kms drivers, sis/via _always_ associated a buffer with > a drm fd. So by the time we reach lastclose, all open drm fds are gone > and with them their associated objects. > > So when sis/via call drm_sman_cleanup in their lastclose funcs, that > will free 0 objects. > > The owner tracking now serves no purpose at all, hence rip it ou. We > can't kill the corresponding fields in struct drm_memblock_item yet > because we hijack these in the new driver private owner tracking. But > now that drm_sman.c doesn't touch ->owner_list anymore, we need to > kill the list_move hack and properly add the item to the file_priv > list. > > Also leave the list_del(&obj->owner_list) in drm_sman_free for the > moment, it will move to the drivers when sman disappears completely. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 71 > -- > drivers/gpu/drm/sis/sis_mm.c |3 +- > drivers/gpu/drm/via/via_mm.c |3 +- > include/drm/drm_sman.h |2 - > 4 files changed, 4 insertions(+), 75 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index a672fea..37a8844 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -47,7 +47,6 @@ struct drm_owner_item { > void drm_sman_takedown(struct drm_sman * sman) > { > drm_ht_remove(&sman->user_hash_tab); > - drm_ht_remove(&sman->owner_hash_tab); > kfree(sman->mm); > } > > @@ -65,16 +64,10 @@ drm_sman_init(struct drm_sman * sman, unsigned int > num_managers, > goto out; > } > sman->num_managers = num_managers; > - INIT_LIST_HEAD(&sman->owner_items); > - ret = drm_ht_create(&sman->owner_hash_tab, owner_order); > - if (ret) > - goto out1; > ret = drm_ht_create(&sman->user_hash_tab, user_order); > if (!ret) > goto out; > > - drm_ht_remove(&sman->owner_hash_tab); > -out1: > kfree(sman->mm); > out: > return ret; > @@ -160,44 +153,12 @@ drm_sman_set_manager(struct drm_sman * sman, unsigned > int manager, > } > EXPORT_SYMBOL(drm_sman_set_manager); > > -static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman, > - unsigned long owner) > -{ > - int ret; > - struct drm_hash_item *owner_hash_item; > - struct drm_owner_item *owner_item; > - > - ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); > - if (!ret) { > - return drm_hash_entry(owner_hash_item, struct drm_owner_item, > - owner_hash); > - } > - > - owner_item = kzalloc(sizeof(*owner_item), GFP_KERNEL); > - if (!owner_item) > - goto out; > - > - INIT_LIST_HEAD(&owner_item->mem_blocks); > - owner_item->owner_hash.key = owner; > - if (drm_ht_insert_item(&sman->owner_hash_tab, &owner_item->owner_hash)) > - goto out1; > - > - list_add_tail(&owner_item->sman_list, &sman->owner_items); > - return owner_item; > - > -out1: > - kfree(owner_item); > -out: > - return NULL; > -} > - > struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int > manager, > unsigned long size, unsigned alignment, > unsigned long owner) > { > void *tmp; > struct drm_sman_mm *sman_mm; > - struct drm_owner_item *owner_item; > struct drm_memblock_item *memblock; > > BUG_ON(manager >= sman->num_managers); > @@ -223,16 +184,8 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman > *sman, unsigned int man >(unsigned long)memblock, 32, 0, 0)) > goto out1; > > - owner_item = drm_sman_get_owner_item(sman, owner); > - if (!owner_item) > - goto out2; > - > - list_add_tail(&memblock->owner_list, &owner_item->mem_blocks); > - > return memblock; > > -out2: > - drm_ht_remove_item(&sman->user_hash_tab, &memblock->user_hash); > out1: > kfree(memblock); > out: > @@ -270,35 +223,11 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned > int key) > > EXPORT_SYMBOL(drm_sman_free_key); > > -static void drm_sman_remove_owner(struct drm_sman *sman, > - struct drm_owner_item *owner_item) > -{ > - list_del(&owner_item->sman_list); > - drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); > - kfree(owner_item); > -} > - > -static void drm_sman_do_owner_cleanup(struct drm_sman *sman, > - struct drm_owner_item *owner_item) > -{ > - struct drm_memblock_item *entry, *next; > - > - list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, > - owner_list) { > - drm_sman_free(entry); > - } > - drm_sman_remove_owner(sman, owner_item); > -}
Re: [PATCH 05/23] drm/via: track user->memblock mapping with idr
> Massive indirection through a hashtable for a simple key->pointer > look-up actually just adds bloat. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/via/via_drv.h |2 + > drivers/gpu/drm/via/via_map.c |1 + > drivers/gpu/drm/via/via_mm.c | 61 > +++-- > 3 files changed, 49 insertions(+), 15 deletions(-) Acked-by: James Simmons > diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h > index 9cf87d9..108ea71 100644 > --- a/drivers/gpu/drm/via/via_drv.h > +++ b/drivers/gpu/drm/via/via_drv.h > @@ -91,6 +91,8 @@ typedef struct drm_via_private { > struct drm_sman sman; > int vram_initialized; > int agp_initialized; > + /** Mapping of userspace keys to mm objects */ > + struct idr object_idr; > unsigned long vram_offset; > unsigned long agp_offset; > drm_via_blitq_t blit_queues[VIA_NUM_BLIT_ENGINES]; > diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c > index 6cca9a7..b09f659 100644 > --- a/drivers/gpu/drm/via/via_map.c > +++ b/drivers/gpu/drm/via/via_map.c > @@ -104,6 +104,7 @@ int via_driver_load(struct drm_device *dev, unsigned long > chipset) > > dev_priv->chipset = chipset; > > + idr_init(&dev->object_name_idr); > ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > if (ret) { > kfree(dev_priv); > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index ea3d621..af9e771 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -118,7 +118,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > struct drm_file *file) > { > drm_via_mem_t *mem = data; > - int retval = 0; > + int retval = 0, user_key; > struct drm_memblock_item *item; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > struct via_file_private *file_priv = file->driver_priv; > @@ -139,24 +139,46 @@ int via_mem_alloc(struct drm_device *dev, void *data, > > tmpSize = (mem->size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; > item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, 0); > + if (!item) { > + retval = -ENOMEM; > + goto fail_alloc; > + } > > - if (item) { > - INIT_LIST_HEAD(&item->owner_list); > - list_add(&item->owner_list, &file_priv->obj_list); > - mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > - dev_priv->vram_offset : dev_priv->agp_offset) + > - (item->mm-> > - offset(item->mm, item->mm_info) << VIA_MM_ALIGN_SHIFT); > - mem->index = item->user_hash.key; > - } else { > - mem->offset = 0; > - mem->size = 0; > - mem->index = 0; > - DRM_DEBUG("Video memory allocation failed\n"); > +again: > + if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { > retval = -ENOMEM; > + goto fail_idr; > } > + > + /* do the allocation under our spinlock */ > + retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); > + if (retval == -EAGAIN) > + goto again; > + if (retval) > + goto fail_idr; > + > + INIT_LIST_HEAD(&item->owner_list); > + list_add(&item->owner_list, &file_priv->obj_list); > mutex_unlock(&dev->struct_mutex); > > + mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > + dev_priv->vram_offset : dev_priv->agp_offset) + > + (item->mm-> > + offset(item->mm, item->mm_info) << VIA_MM_ALIGN_SHIFT); > + mem->index = user_key; > + > + return 0; > + > +fail_idr: > + drm_sman_free(item); > +fail_alloc: > + mutex_unlock(&dev->struct_mutex); > + > + mem->offset = 0; > + mem->size = 0; > + mem->index = 0; > + DRM_DEBUG("Video memory allocation failed\n"); > + > return retval; > } > > @@ -164,11 +186,20 @@ int via_mem_free(struct drm_device *dev, void *data, > struct drm_file *file_priv) > { > drm_via_private_t *dev_priv = dev->dev_private; > drm_via_mem_t *mem = data; > + struct drm_memblock_item *obj; > int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_free_key(&dev_priv->sman, mem->index); > + obj = idr_find(&dev_priv->object_idr, mem->index); > + if (obj == NULL) { > + mutex_unlock(&dev->struct_mutex); > + return -EINVAL; > + } > + > + idr_remove(&dev_priv->object_idr, mem->index); > + drm_sman_free(obj); > mutex_unlock(&dev->struct_mutex); > + > DRM_DEBUG("free = 0x%lx\n", mem->index); > > return ret; > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > _
Re: [PATCH 06/23] drm/sis: track user->memblock mapping with idr
> Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/sis/sis_drv.c |4 +++ > drivers/gpu/drm/sis/sis_drv.h |2 + > drivers/gpu/drm/sis/sis_mm.c | 60 ++-- > drivers/gpu/drm/via/via_map.c |2 + > 4 files changed, 53 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c > index a5dcd0a..9f5fbcf 100644 > --- a/drivers/gpu/drm/sis/sis_drv.c > +++ b/drivers/gpu/drm/sis/sis_drv.c > @@ -46,6 +46,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned > long chipset) > > dev->dev_private = (void *)dev_priv; > dev_priv->chipset = chipset; > + idr_init(&dev->object_name_idr); > ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > if (ret) > kfree(dev_priv); > @@ -58,6 +59,9 @@ static int sis_driver_unload(struct drm_device *dev) > drm_sis_private_t *dev_priv = dev->dev_private; > > drm_sman_takedown(&dev_priv->sman); > + idr_remove_all(&dev_priv->object_idr); > + idr_destroy(&dev_priv->object_idr); > + > kfree(dev_priv); > > return 0; > diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h > index 194303c..fcdd06a 100644 > --- a/drivers/gpu/drm/sis/sis_drv.h > +++ b/drivers/gpu/drm/sis/sis_drv.h > @@ -60,6 +60,8 @@ typedef struct drm_sis_private { > int agp_initialized; > unsigned long vram_offset; > unsigned long agp_offset; > + /** Mapping of userspace keys to mm objects */ > + struct idr object_idr; > } drm_sis_private_t; > > extern int sis_idle(struct drm_device *dev); > diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c > index dff70da..ef6045a 100644 > --- a/drivers/gpu/drm/sis/sis_mm.c > +++ b/drivers/gpu/drm/sis/sis_mm.c > @@ -125,7 +125,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > - int retval = 0; > + int retval = 0, user_key; > struct drm_memblock_item *item; > struct sis_file_private *file_priv = file->driver_priv; > > @@ -141,24 +141,46 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > > mem->size = (mem->size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT; > item = drm_sman_alloc(&dev_priv->sman, pool, mem->size, 0, 0); > + if (!item) { > + retval = -ENOMEM; > + goto fail_alloc; > + } > > - if (item) { > - INIT_LIST_HEAD(&item->owner_list); > - list_add(&item->owner_list, &file_priv->obj_list); > - mem->offset = ((pool == 0) ? > - dev_priv->vram_offset : dev_priv->agp_offset) + > - (item->mm-> > - offset(item->mm, item->mm_info) << SIS_MM_ALIGN_SHIFT); > - mem->free = item->user_hash.key; > - mem->size = mem->size << SIS_MM_ALIGN_SHIFT; > - } else { > - mem->offset = 0; > - mem->size = 0; > - mem->free = 0; > +again: > + if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { > retval = -ENOMEM; > + goto fail_idr; > } > + > + /* do the allocation under our spinlock */ > + retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); > + if (retval == -EAGAIN) > + goto again; > + if (retval) > + goto fail_idr; > + > + INIT_LIST_HEAD(&item->owner_list); > + list_add(&item->owner_list, &file_priv->obj_list); > + mutex_unlock(&dev->struct_mutex); > + > + mem->offset = ((pool == 0) ? > + dev_priv->vram_offset : dev_priv->agp_offset) + > + (item->mm-> > + offset(item->mm, item->mm_info) << SIS_MM_ALIGN_SHIFT); > + mem->free = user_key; > + mem->size = mem->size << SIS_MM_ALIGN_SHIFT; > + > + return 0; > + > +fail_idr: > + drm_sman_free(item); > +fail_alloc: > mutex_unlock(&dev->struct_mutex); > > + mem->offset = 0; > + mem->size = 0; > + mem->free = 0; > + > DRM_DEBUG("alloc %d, size = %d, offset = %d\n", pool, mem->size, > mem->offset); > > @@ -169,10 +191,18 @@ static int sis_drm_free(struct drm_device *dev, void > *data, struct drm_file *fil > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > + struct drm_memblock_item *obj; > int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_free_key(&dev_priv->sman, mem->free); > + obj = idr_find(&dev_priv->object_idr, mem->free); > + if (obj == NULL) { > + mutex_unlock(&dev->struct_mutex); > + return -EINVAL; > + } > + > + idr_remove(&dev_priv->object_idr, mem->free); > + drm_sman_free(obj); > mutex_unlock(&dev->struct_mutex); > DRM_DEBUG("free = 0x%lx\n", me
Re: [PATCH 07/23] drm/sman: kill user_hash_tab
> No longer used. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 36 ++-- > include/drm/drm_sman.h |5 - > 2 files changed, 2 insertions(+), 39 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index 37a8844..1a4fb9f 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -46,7 +46,6 @@ struct drm_owner_item { > > void drm_sman_takedown(struct drm_sman * sman) > { > - drm_ht_remove(&sman->user_hash_tab); > kfree(sman->mm); > } > > @@ -61,16 +60,11 @@ drm_sman_init(struct drm_sman * sman, unsigned int > num_managers, > sman->mm = kcalloc(num_managers, sizeof(*sman->mm), GFP_KERNEL); > if (!sman->mm) { > ret = -ENOMEM; > - goto out; > + return ret; > } > sman->num_managers = num_managers; > - ret = drm_ht_create(&sman->user_hash_tab, user_order); > - if (!ret) > - goto out; > > - kfree(sman->mm); > -out: > - return ret; > + return 0; > } > > EXPORT_SYMBOL(drm_sman_init); > @@ -179,15 +173,8 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman > *sman, unsigned int man > memblock->mm = sman_mm; > memblock->sman = sman; > > - if (drm_ht_just_insert_please > - (&sman->user_hash_tab, &memblock->user_hash, > - (unsigned long)memblock, 32, 0, 0)) > - goto out1; > - > return memblock; > > -out1: > - kfree(memblock); > out: > sman_mm->free(sman_mm->private, tmp); > > @@ -198,31 +185,12 @@ EXPORT_SYMBOL(drm_sman_alloc); > > void drm_sman_free(struct drm_memblock_item *item) > { > - struct drm_sman *sman = item->sman; > - > list_del(&item->owner_list); > - drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); > item->mm->free(item->mm->private, item->mm_info); > kfree(item); > } > EXPORT_SYMBOL(drm_sman_free); > > -int drm_sman_free_key(struct drm_sman *sman, unsigned int key) > -{ > - struct drm_hash_item *hash_item; > - struct drm_memblock_item *memblock_item; > - > - if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) > - return -EINVAL; > - > - memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, > -user_hash); > - drm_sman_free(memblock_item); > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_free_key); > - > void drm_sman_cleanup(struct drm_sman *sman) > { > unsigned int i; > diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h > index 34ae5ca..031e521 100644 > --- a/include/drm/drm_sman.h > +++ b/include/drm/drm_sman.h > @@ -87,7 +87,6 @@ struct drm_memblock_item { > struct drm_sman { > struct drm_sman_mm *mm; > int num_managers; > - struct drm_open_hash user_hash_tab; > }; > > /* > @@ -139,11 +138,7 @@ extern struct drm_memblock_item *drm_sman_alloc(struct > drm_sman * sman, > unsigned long size, > unsigned alignment, > unsigned long owner); > -/* > - * Free a memory block identified by its user hash key. > - */ > > -extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key); > extern void drm_sman_free(struct drm_memblock_item *item); > > /* > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/23] drm/via: use drm_mm instead of drm_sman
> Now that we are again in proper control of owner_list, we need to > properly list_del it on free. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/via/via_drv.h |5 ++- > drivers/gpu/drm/via/via_map.c |7 > drivers/gpu/drm/via/via_mm.c | 72 ++-- > 3 files changed, 43 insertions(+), 41 deletions(-) > > diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h > index 108ea71..88edacc 100644 > --- a/drivers/gpu/drm/via/via_drv.h > +++ b/drivers/gpu/drm/via/via_drv.h > @@ -24,7 +24,7 @@ > #ifndef _VIA_DRV_H_ > #define _VIA_DRV_H_ > > -#include "drm_sman.h" > +#include "drm_mm.h" > #define DRIVER_AUTHOR"Various" > > #define DRIVER_NAME "via" > @@ -88,9 +88,10 @@ typedef struct drm_via_private { > uint32_t irq_pending_mask; > int *irq_map; > unsigned int idle_fault; > - struct drm_sman sman; > int vram_initialized; > + struct drm_mm vram_mm; > int agp_initialized; > + struct drm_mm agp_mm; > /** Mapping of userspace keys to mm objects */ > struct idr object_idr; > unsigned long vram_offset; > diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c > index fa5afbc..a2ab343 100644 > --- a/drivers/gpu/drm/via/via_map.c > +++ b/drivers/gpu/drm/via/via_map.c > @@ -105,15 +105,9 @@ int via_driver_load(struct drm_device *dev, unsigned > long chipset) > dev_priv->chipset = chipset; > > idr_init(&dev->object_name_idr); > - ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > - if (ret) { > - kfree(dev_priv); > - return ret; > - } > > ret = drm_vblank_init(dev, 1); > if (ret) { > - drm_sman_takedown(&dev_priv->sman); > kfree(dev_priv); > return ret; > } > @@ -125,7 +119,6 @@ int via_driver_unload(struct drm_device *dev) > { > drm_via_private_t *dev_priv = dev->dev_private; > > - drm_sman_takedown(&dev_priv->sman); > idr_remove_all(&dev_priv->object_idr); > idr_destroy(&dev_priv->object_idr); > > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index af9e771..80eab7d 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -28,26 +28,22 @@ > #include "drmP.h" > #include "via_drm.h" > #include "via_drv.h" > -#include "drm_sman.h" > > #define VIA_MM_ALIGN_SHIFT 4 > #define VIA_MM_ALIGN_MASK ((1 << VIA_MM_ALIGN_SHIFT) - 1) > > +struct via_memblock { > + struct drm_mm_node mm_node; > + struct list_head owner_list; > +}; > + > int via_agp_init(struct drm_device *dev, void *data, struct drm_file > *file_priv) > { > drm_via_agp_t *agp = data; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > - int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_set_range(&dev_priv->sman, VIA_MEM_AGP, 0, > - agp->size >> VIA_MM_ALIGN_SHIFT); > - > - if (ret) { > - DRM_ERROR("AGP memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + drm_mm_init(&dev_priv->agp_mm, 0, agp->size >> VIA_MM_ALIGN_SHIFT); > > dev_priv->agp_initialized = 1; > dev_priv->agp_offset = agp->offset; > @@ -61,17 +57,9 @@ int via_fb_init(struct drm_device *dev, void *data, struct > drm_file *file_priv) > { > drm_via_fb_t *fb = data; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > - int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_set_range(&dev_priv->sman, VIA_MEM_VIDEO, 0, > - fb->size >> VIA_MM_ALIGN_SHIFT); > - > - if (ret) { > - DRM_ERROR("VRAM memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> VIA_MM_ALIGN_SHIFT); > > dev_priv->vram_initialized = 1; > dev_priv->vram_offset = fb->offset; > @@ -108,9 +96,14 @@ void via_lastclose(struct drm_device *dev) > return; > > mutex_lock(&dev->struct_mutex); > - drm_sman_cleanup(&dev_priv->sman); > - dev_priv->vram_initialized = 0; > - dev_priv->agp_initialized = 0; > + if (dev_priv->vram_initialized) { > + drm_mm_takedown(&dev_priv->vram_mm); > + dev_priv->vram_initialized = 0; > + } > + if (dev_priv->agp_initialized) { > + drm_mm_takedown(&dev_priv->agp_mm); > + dev_priv->agp_initialized = 0; > + } > mutex_unlock(&dev->struct_mutex); > } > > @@ -119,7 +112,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > { > drm_via_mem_t *mem = data; > int retval = 0, user_key; > - struct drm_memblock_item *item; > + struct via_memblo
Re: [PATCH 09/23] drm/sis: use drm_mm instead of drm_sman
> Signed-off-by: Daniel Vetter Can't test on SiS but does nothing to my VIA hardware. Acked-by: James Simmons > --- > drivers/gpu/drm/sis/sis_drv.c |4 - > drivers/gpu/drm/sis/sis_drv.h |5 +- > drivers/gpu/drm/sis/sis_mm.c | 137 +++- > 3 files changed, 68 insertions(+), 78 deletions(-) > > diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c > index 9f5fbcf..278d1b0 100644 > --- a/drivers/gpu/drm/sis/sis_drv.c > +++ b/drivers/gpu/drm/sis/sis_drv.c > @@ -47,9 +47,6 @@ static int sis_driver_load(struct drm_device *dev, unsigned > long chipset) > dev->dev_private = (void *)dev_priv; > dev_priv->chipset = chipset; > idr_init(&dev->object_name_idr); > - ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > - if (ret) > - kfree(dev_priv); > > return ret; > } > @@ -58,7 +55,6 @@ static int sis_driver_unload(struct drm_device *dev) > { > drm_sis_private_t *dev_priv = dev->dev_private; > > - drm_sman_takedown(&dev_priv->sman); > idr_remove_all(&dev_priv->object_idr); > idr_destroy(&dev_priv->object_idr); > > diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h > index fcdd06a..573758b 100644 > --- a/drivers/gpu/drm/sis/sis_drv.h > +++ b/drivers/gpu/drm/sis/sis_drv.h > @@ -44,7 +44,7 @@ enum sis_family { > SIS_CHIP_315 = 1, > }; > > -#include "drm_sman.h" > +#include "drm_mm.h" > > > #define SIS_BASE (dev_priv->mmio) > @@ -54,12 +54,13 @@ enum sis_family { > typedef struct drm_sis_private { > drm_local_map_t *mmio; > unsigned int idle_fault; > - struct drm_sman sman; > unsigned int chipset; > int vram_initialized; > int agp_initialized; > unsigned long vram_offset; > unsigned long agp_offset; > + struct drm_mm vram_mm; > + struct drm_mm agp_mm; > /** Mapping of userspace keys to mm objects */ > struct idr object_idr; > } drm_sis_private_t; > diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c > index ef6045a..ff34680 100644 > --- a/drivers/gpu/drm/sis/sis_mm.c > +++ b/drivers/gpu/drm/sis/sis_mm.c > @@ -41,40 +41,18 @@ > #define AGP_TYPE 1 > > > +struct sis_memblock { > + struct drm_mm_node mm_node; > + struct sis_memreq req; > + struct list_head owner_list; > +}; > + > #if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) > /* fb management via fb device */ > > #define SIS_MM_ALIGN_SHIFT 0 > #define SIS_MM_ALIGN_MASK 0 > > -static void *sis_sman_mm_allocate(void *private, unsigned long size, > - unsigned alignment) > -{ > - struct sis_memreq req; > - > - req.size = size; > - sis_malloc(&req); > - if (req.size == 0) > - return NULL; > - else > - return (void *)(unsigned long)~req.offset; > -} > - > -static void sis_sman_mm_free(void *private, void *ref) > -{ > - sis_free(~((unsigned long)ref)); > -} > - > -static void sis_sman_mm_destroy(void *private) > -{ > - ; > -} > - > -static unsigned long sis_sman_mm_offset(void *private, void *ref) > -{ > - return ~((unsigned long)ref); > -} > - > #else /* CONFIG_FB_SIS[_MODULE] */ > > #define SIS_MM_ALIGN_SHIFT 4 > @@ -86,30 +64,11 @@ static int sis_fb_init(struct drm_device *dev, void > *data, struct drm_file *file > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_fb_t *fb = data; > - int ret; > > mutex_lock(&dev->struct_mutex); > -#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) > - { > - struct drm_sman_mm sman_mm; > - sman_mm.private = (void *)0x; > - sman_mm.allocate = sis_sman_mm_allocate; > - sman_mm.free = sis_sman_mm_free; > - sman_mm.destroy = sis_sman_mm_destroy; > - sman_mm.offset = sis_sman_mm_offset; > - ret = > - drm_sman_set_manager(&dev_priv->sman, VIDEO_TYPE, &sman_mm); > - } > -#else > - ret = drm_sman_set_range(&dev_priv->sman, VIDEO_TYPE, 0, > - fb->size >> SIS_MM_ALIGN_SHIFT); > -#endif > - > - if (ret) { > - DRM_ERROR("VRAM memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + /* Unconditionally init the drm_mm, even though we don't use it when the > + * fb sis driver is available - make cleanup easier. */ > + drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> SIS_MM_ALIGN_SHIFT); > > dev_priv->vram_initialized = 1; > dev_priv->vram_offset = fb->offset; > @@ -126,8 +85,9 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > int retval = 0, user_key; > - struct drm_memblock_item *item; > + struct sis_memblock *item; > s
Re: [PATCH 10/23] drm: kill drm_sman
> No longer used. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/Makefile |2 +- > drivers/gpu/drm/drm_sman.c | 210 > > include/drm/drm_sman.h | 151 --- > 3 files changed, 1 insertions(+), 362 deletions(-) > delete mode 100644 drivers/gpu/drm/drm_sman.c > delete mode 100644 include/drm/drm_sman.h > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 89cf05a..ea083cf 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -9,7 +9,7 @@ drm-y :=drm_auth.o drm_buffer.o drm_bufs.o > drm_cache.o \ > drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ > drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ > drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \ > - drm_platform.o drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \ > + drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ > drm_crtc.o drm_modes.o drm_edid.o \ > drm_info.o drm_debugfs.o drm_encoder_slave.o \ > drm_trace_points.o drm_global.o drm_usb.o > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > deleted file mode 100644 > index 1a4fb9f..000 > --- a/drivers/gpu/drm/drm_sman.c > +++ /dev/null > @@ -1,210 +0,0 @@ > -/** > - * > - * Copyright 2006 Tungsten Graphics, Inc., Bismarck., ND., USA. > - * All Rights Reserved. > - * > - * Permission is hereby granted, free of charge, to any person obtaining a > - * copy of this software and associated documentation files (the > - * "Software"), to deal in the Software without restriction, including > - * without limitation the rights to use, copy, modify, merge, publish, > - * distribute, sub license, and/or sell copies of the Software, and to > - * permit persons to whom the Software is furnished to do so, subject to > - * the following conditions: > - * > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY > CLAIM, > - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > - * USE OR OTHER DEALINGS IN THE SOFTWARE. > - * > - * The above copyright notice and this permission notice (including the > - * next paragraph) shall be included in all copies or substantial portions > - * of the Software. > - * > - * > - **/ > -/* > - * Simple memory manager interface that keeps track on allocate regions on a > - * per "owner" basis. All regions associated with an "owner" can be released > - * with a simple call. Typically if the "owner" exists. The owner is any > - * "unsigned long" identifier. Can typically be a pointer to a file private > - * struct or a context identifier. > - * > - * Authors: > - * Thomas Hellström > - */ > - > -#include "drm_sman.h" > - > -struct drm_owner_item { > - struct drm_hash_item owner_hash; > - struct list_head sman_list; > - struct list_head mem_blocks; > -}; > - > -void drm_sman_takedown(struct drm_sman * sman) > -{ > - kfree(sman->mm); > -} > - > -EXPORT_SYMBOL(drm_sman_takedown); > - > -int > -drm_sman_init(struct drm_sman * sman, unsigned int num_managers, > - unsigned int user_order, unsigned int owner_order) > -{ > - int ret = 0; > - > - sman->mm = kcalloc(num_managers, sizeof(*sman->mm), GFP_KERNEL); > - if (!sman->mm) { > - ret = -ENOMEM; > - return ret; > - } > - sman->num_managers = num_managers; > - > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_init); > - > -static void *drm_sman_mm_allocate(void *private, unsigned long size, > - unsigned alignment) > -{ > - struct drm_mm *mm = (struct drm_mm *) private; > - struct drm_mm_node *tmp; > - > - tmp = drm_mm_search_free(mm, size, alignment, 1); > - if (!tmp) { > - return NULL; > - } > - tmp = drm_mm_get_block(tmp, size, alignment); > - return tmp; > -} > - > -static void drm_sman_mm_free(void *private, void *ref) > -{ > - struct drm_mm_node *node = (struct drm_mm_node *) ref; > - > - drm_mm_put_block(node); > -} > - > -static void drm_sman_mm_destroy(void *private) > -{ > - struct drm_mm *mm = (struct drm_mm *) private; > - drm_mm_takedown(mm); > - kfree(mm); > -} > - > -static unsigned long drm_sman_mm_offset(void *private, void *ref) > -{ > - struct drm_mm_node *node = (struct drm_mm_node *) ref; > - return node->start; > -} > - > -i
Re: [PATCH 08/23] drm/via: use drm_mm instead of drm_sman
> Chris Wilson rightly complained that this doesn't explain the list_del > magic going on. New commit msg reads: > > To make the transition in a piece-wise and bisectable way possible, > I've hijacked the ->owner_list from drm_sman. While transitioning, the > list_add was done by the driver, while the list_del was still done by > the dying sman code. > > Now that we are in full control of ->owner_list, do the list_del > ourselves. > > He also noted the superflous additions of INIT_LIST_HEAD and the stale > comment about spinlock locking in the idr allocation (protected by > dev->struct_mutex) that I've copied over. All fixed up and pushed out for > the moment to my fdo repo: > > http://cgit.freedesktop.org/~danvet/drm/log/?h=kill-with-fire Speaking of I attempted to clone that repo but it gives me warning: remote HEAD refers to nonexistent ref, unable to checkout. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Request for fixing atombios_get_encoder_mode
2011/12/7 Rafał Miłecki : > W dniu 7 grudnia 2011 15:53 użytkownik Alex Deucher > napisał: >> 2011/12/7 Rafał Miłecki : >>> W dniu 7 grudnia 2011 14:53 użytkownik Alex Deucher >>> napisał: 2011/12/7 Rafał Miłecki : > In theory function atombios_get_encoder_mode should report > ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report > ATOM_ENCODER_MODE_DVI if card is DCE4. > > Is there any reason for it? Can we just drop that DCE4 condition? This > fixme seems to be here since ever. > It causes display corruption unless the hdmi packet engine is set up properly. >>> >>> Even with radeon.audio=0? >> >> No, as in that case, DVI is returned. On DCE3.0 and newer chips there >> is no explicit hdmi engine enable bit. You just select HDMI mode >> rather than DVI mode in the digital encoder setup. So if you select >> HDMI in the encoder setup and you have not configured the hdmi engine >> correctly you will git display corruption or a blank screen. Which is >> why I had to disable audio by default. Since audio is off by default, >> the DCE4 conditional in the hdmi case could be removed. > > OK, it makes sense, thanks. > > Btw I believe there *is* HDMI enabling bit on DCE3+, we probably just > don't need to poke it manually :) > It is bit 0x1000 in registers > 0x7000, 0x7c00, 0x10800, 0x11400, 0x12000, 0x12c00 > > All my HDMI frames are ignored without that bit set. > As I mentioned above, that register (DIG_CNTL) is programmed by DIGxEncoderControl table based on the encoder mode selected (DP, LVDS, DVI, HDMI). Bits 14:12 select the DIG_MODE of the encoder. 0 = DP, 1 = LVDS, 2 = DVI, 3 = HDMI. Alex > -- > Rafał > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/9] gma500: Fix SDVO DDC probing on Poulsbo
This set of patches removes psb_intel_output and replaces it with psb_intel_encoder and psb_intel_connector. It also replaces the SDVO code with a slightly modified version from i915. i915 SDVO needs Intel gmbus so this is added along with a SDVO DDC bus guessing fix for Poulsbo. Patrik Jakobsson (9): gma500: Initial support for our encoder and connector structs gma500: Remove psb_intel_output from ddc_probe and ddc_get_modes gma500: Fix encoder type checking for connectors gma500: Convert PSB LVDS to new output handling gma500: Add support for Intel GMBUS gma500: Replace SDVO code with slightly modified version from i915 gma500: Convert Cedarview to work with new output handling gma500: Convert Moorestown to work with new output handling gma500: SDVO DDC bus guessing isn't working so hardcode it instead drivers/gpu/drm/gma500/Makefile |1 + drivers/gpu/drm/gma500/cdv_intel_crt.c | 47 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 14 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 112 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 117 +- drivers/gpu/drm/gma500/framebuffer.c |8 +- drivers/gpu/drm/gma500/intel_gmbus.c | 493 + drivers/gpu/drm/gma500/oaktrail_crtc.c | 18 +- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 29 +- drivers/gpu/drm/gma500/oaktrail_lvds.c | 79 +- drivers/gpu/drm/gma500/psb_device.c |7 + drivers/gpu/drm/gma500/psb_drv.c |6 +- drivers/gpu/drm/gma500/psb_drv.h | 30 +- drivers/gpu/drm/gma500/psb_intel_display.c | 39 +- drivers/gpu/drm/gma500/psb_intel_drv.h | 97 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 152 +- drivers/gpu/drm/gma500/psb_intel_modes.c | 16 +- drivers/gpu/drm/gma500/psb_intel_reg.h | 74 + drivers/gpu/drm/gma500/psb_intel_sdvo.c | 3068 ++ drivers/gpu/drm/gma500/psb_intel_sdvo_regs.h | 591 - 20 files changed, 3733 insertions(+), 1265 deletions(-) create mode 100644 drivers/gpu/drm/gma500/intel_gmbus.c -- 1.7.4.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/9] gma500: Initial support for our encoder and connector structs
First step towards adding i915 alike encoder and connector abstractions. This will make life easier when adding i915 output code into our driver. It also removes the old psb_intel_output struct. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/psb_intel_display.c |7 + drivers/gpu/drm/gma500/psb_intel_drv.h | 40 +-- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index ab65076..43cc132 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c @@ -1429,3 +1429,10 @@ struct drm_encoder *psb_intel_best_encoder(struct drm_connector *connector) return &psb_intel_output->enc; } +void psb_intel_connector_attach_encoder(struct psb_intel_connector *connector, + struct psb_intel_encoder *encoder) +{ + connector->encoder = encoder; + drm_mode_connector_attach_encoder(&connector->base, + &encoder->base); +} diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h index ac953ca..a4435d8 100644 --- a/drivers/gpu/drm/gma500/psb_intel_drv.h +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h @@ -93,19 +93,19 @@ struct psb_intel_i2c_chan { u8 slave_addr; }; -struct psb_intel_output { - struct drm_connector base; - - struct drm_encoder enc; +struct psb_intel_encoder { + struct drm_encoder base; int type; + bool needs_tv_clock; + void (*hot_plug)(struct psb_intel_encoder *); + int crtc_mask; + int clone_mask; + void *dev_priv; /* For sdvo_priv, lvds_priv, etc... */ +}; - struct psb_intel_i2c_chan *i2c_bus; /* for control functions */ - struct psb_intel_i2c_chan *ddc_bus; /* for DDC only stuff */ - bool load_detect_temp; - void *dev_priv; - - struct psb_intel_mode_device *mode_dev; - struct i2c_adapter *hdmi_i2c_adapter; /* for control functions */ +struct psb_intel_connector { + struct drm_connector base; + struct psb_intel_encoder *encoder; }; struct psb_intel_crtc_state { @@ -156,10 +156,10 @@ struct psb_intel_crtc { #define to_psb_intel_crtc(x) \ container_of(x, struct psb_intel_crtc, base) -#define to_psb_intel_output(x) \ - container_of(x, struct psb_intel_output, base) -#define enc_to_psb_intel_output(x) \ - container_of(x, struct psb_intel_output, enc) +#define to_psb_intel_connector(x) \ + container_of(x, struct psb_intel_connector, base) +#define to_psb_intel_encoder(x)\ + container_of(x, struct psb_intel_encoder, base) #define to_psb_intel_framebuffer(x)\ container_of(x, struct psb_intel_framebuffer, base) @@ -190,6 +190,16 @@ extern void psb_intel_crtc_load_lut(struct drm_crtc *crtc); extern void psb_intel_encoder_prepare(struct drm_encoder *encoder); extern void psb_intel_encoder_commit(struct drm_encoder *encoder); +static inline struct psb_intel_encoder *psb_intel_attached_encoder( + struct drm_connector *connector) +{ + return to_psb_intel_connector(connector)->encoder; +} + +extern void psb_intel_connector_attach_encoder( + struct psb_intel_connector *connector, + struct psb_intel_encoder *encoder); + extern struct drm_encoder *psb_intel_best_encoder(struct drm_connector *connector); -- 1.7.4.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/9] gma500: Remove psb_intel_output from ddc_probe and ddc_get_modes
Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/psb_intel_drv.h |5 +++-- drivers/gpu/drm/gma500/psb_intel_modes.c | 16 +++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h index a4435d8..af34b24 100644 --- a/drivers/gpu/drm/gma500/psb_intel_drv.h +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h @@ -166,8 +166,9 @@ struct psb_intel_crtc { struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev, const u32 reg, const char *name); void psb_intel_i2c_destroy(struct psb_intel_i2c_chan *chan); -int psb_intel_ddc_get_modes(struct psb_intel_output *psb_intel_output); -extern bool psb_intel_ddc_probe(struct psb_intel_output *psb_intel_output); +int psb_intel_ddc_get_modes(struct drm_connector *connector, + struct i2c_adapter *adapter); +extern bool psb_intel_ddc_probe(struct i2c_adapter *adapter); extern void psb_intel_crtc_init(struct drm_device *dev, int pipe, struct psb_intel_mode_device *mode_dev); diff --git a/drivers/gpu/drm/gma500/psb_intel_modes.c b/drivers/gpu/drm/gma500/psb_intel_modes.c index bde1aff..4fca0d6 100644 --- a/drivers/gpu/drm/gma500/psb_intel_modes.c +++ b/drivers/gpu/drm/gma500/psb_intel_modes.c @@ -26,7 +26,7 @@ * psb_intel_ddc_probe * */ -bool psb_intel_ddc_probe(struct psb_intel_output *psb_intel_output) +bool psb_intel_ddc_probe(struct i2c_adapter *adapter) { u8 out_buf[] = { 0x0, 0x0 }; u8 buf[2]; @@ -46,7 +46,7 @@ bool psb_intel_ddc_probe(struct psb_intel_output *psb_intel_output) } }; - ret = i2c_transfer(&psb_intel_output->ddc_bus->adapter, msgs, 2); + ret = i2c_transfer(adapter, msgs, 2); if (ret == 2) return true; @@ -59,18 +59,16 @@ bool psb_intel_ddc_probe(struct psb_intel_output *psb_intel_output) * * Fetch the EDID information from @connector using the DDC bus. */ -int psb_intel_ddc_get_modes(struct psb_intel_output *psb_intel_output) +int psb_intel_ddc_get_modes(struct drm_connector *connector, + struct i2c_adapter *adapter) { struct edid *edid; int ret = 0; - edid = - drm_get_edid(&psb_intel_output->base, -&psb_intel_output->ddc_bus->adapter); + edid = drm_get_edid(connector, adapter); if (edid) { - drm_mode_connector_update_edid_property(&psb_intel_output-> - base, edid); - ret = drm_add_edid_modes(&psb_intel_output->base, edid); + drm_mode_connector_update_edid_property(connector, edid); + ret = drm_add_edid_modes(connector, edid); kfree(edid); } return ret; -- 1.7.4.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/9] gma500: Fix encoder type checking for connectors
Fix cases where we need to know what encoder type is behind a given connector. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/framebuffer.c |8 drivers/gpu/drm/gma500/psb_drv.c |6 +++--- drivers/gpu/drm/gma500/psb_intel_display.c | 24 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 9ec1676..bdd2e96 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c @@ -747,13 +747,13 @@ static void psb_setup_outputs(struct drm_device *dev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); - struct drm_encoder *encoder = &psb_intel_output->enc; + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); + struct drm_encoder *encoder = &psb_intel_encoder->base; int crtc_mask = 0, clone_mask = 0; /* valid crtcs */ - switch (psb_intel_output->type) { + switch (psb_intel_encoder->type) { case INTEL_OUTPUT_ANALOG: crtc_mask = (1 << 0); clone_mask = (1 << INTEL_OUTPUT_ANALOG); diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index add3156..b4aee0a 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -276,7 +276,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) int ret = -ENOMEM; uint32_t tt_pages; struct drm_connector *connector; - struct psb_intel_output *psb_intel_output; + struct psb_intel_encoder *psb_intel_encoder; dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); if (dev_priv == NULL) @@ -390,9 +390,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) /* Only add backlight support if we have LVDS output */ list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - psb_intel_output = to_psb_intel_output(connector); + psb_intel_encoder = psb_intel_attached_encoder(connector); - switch (psb_intel_output->type) { + switch (psb_intel_encoder->type) { case INTEL_OUTPUT_LVDS: case INTEL_OUTPUT_MIPI: ret = gma_backlight_init(dev); diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index 43cc132..3fd042d 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c @@ -214,9 +214,9 @@ bool psb_intel_pipe_has_type(struct drm_crtc *crtc, int type) list_for_each_entry(l_entry, &mode_config->connector_list, head) { if (l_entry->encoder && l_entry->encoder->crtc == crtc) { - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(l_entry); - if (psb_intel_output->type == type) + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(l_entry); + if (psb_intel_encoder->type == type) return true; } } @@ -615,14 +615,14 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc, } list_for_each_entry(connector, &mode_config->connector_list, head) { - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); if (!connector->encoder || connector->encoder->crtc != crtc) continue; - switch (psb_intel_output->type) { + switch (psb_intel_encoder->type) { case INTEL_OUTPUT_LVDS: is_lvds = true; break; @@ -1402,9 +1402,9 @@ int psb_intel_connector_clones(struct drm_device *dev, int type_mask) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); - if (type_mask & (1 << psb_intel_output->type)) + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); + if (type_mask & (1 << psb_intel_encoder->type))
[PATCH 4/9] gma500: Convert PSB LVDS to new output handling
LVDS for PSB now uses psb_intel_encoder and psb_intel_connectors instead of psb_intel_output. i2c_bus and ddc_bus are moved to lvds_priv. There was also a pointer to mode_dev (for no obvious reason) that we now get directly from dev_priv. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/psb_intel_lvds.c | 152 +-- 1 files changed, 83 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index 21022e1..a25e4ca 100644 --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c @@ -59,6 +59,9 @@ struct psb_intel_lvds_priv { uint32_t savePFIT_CONTROL; uint32_t savePFIT_PGM_RATIOS; uint32_t saveBLC_PWM_CTL; + + struct psb_intel_i2c_chan *i2c_bus; + struct psb_intel_i2c_chan *ddc_bus; }; @@ -214,9 +217,10 @@ static void psb_intel_lvds_set_backlight(struct drm_device *dev, int level) /* * Sets the power state for the panel. */ -static void psb_intel_lvds_set_power(struct drm_device *dev, -struct psb_intel_output *output, bool on) +static void psb_intel_lvds_set_power(struct drm_device *dev, bool on) { + struct drm_psb_private *dev_priv = dev->dev_private; + struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; u32 pp_status; if (!gma_power_begin(dev, true)) { @@ -232,8 +236,7 @@ static void psb_intel_lvds_set_power(struct drm_device *dev, } while ((pp_status & PP_ON) == 0); psb_intel_lvds_set_backlight(dev, -output-> -mode_dev->backlight_duty_cycle); +mode_dev->backlight_duty_cycle); } else { psb_intel_lvds_set_backlight(dev, 0); @@ -250,12 +253,11 @@ static void psb_intel_lvds_set_power(struct drm_device *dev, static void psb_intel_lvds_encoder_dpms(struct drm_encoder *encoder, int mode) { struct drm_device *dev = encoder->dev; - struct psb_intel_output *output = enc_to_psb_intel_output(encoder); if (mode == DRM_MODE_DPMS_ON) - psb_intel_lvds_set_power(dev, output, true); + psb_intel_lvds_set_power(dev, true); else - psb_intel_lvds_set_power(dev, output, false); + psb_intel_lvds_set_power(dev, false); /* XXX: We never power down the LVDS pairs. */ } @@ -265,10 +267,10 @@ static void psb_intel_lvds_save(struct drm_connector *connector) struct drm_device *dev = connector->dev; struct drm_psb_private *dev_priv = (struct drm_psb_private *)dev->dev_private; - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); struct psb_intel_lvds_priv *lvds_priv = - (struct psb_intel_lvds_priv *)psb_intel_output->dev_priv; + (struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv; lvds_priv->savePP_ON = REG_READ(LVDSPP_ON); lvds_priv->savePP_OFF = REG_READ(LVDSPP_OFF); @@ -305,10 +307,10 @@ static void psb_intel_lvds_restore(struct drm_connector *connector) { struct drm_device *dev = connector->dev; u32 pp_status; - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); struct psb_intel_lvds_priv *lvds_priv = - (struct psb_intel_lvds_priv *)psb_intel_output->dev_priv; + (struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv; dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", lvds_priv->savePP_ON, @@ -346,13 +348,14 @@ static void psb_intel_lvds_restore(struct drm_connector *connector) int psb_intel_lvds_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { - struct psb_intel_output *psb_intel_output = - to_psb_intel_output(connector); + struct drm_psb_private *dev_priv = connector->dev->dev_private; + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); struct drm_display_mode *fixed_mode = - psb_intel_output->mode_dev->panel_fixed_mode; + dev_priv->mode_dev.panel_fixed_mode; - if (psb_intel_output->type == INTEL_OUTPUT_MIPI2) - fixed_mode = psb_intel_output->mode_dev->panel_fixed_mode2; + if (psb_intel_encoder->type == INTEL_OUTPUT_MIPI2) + fixed_mode = dev_pri
[PATCH 5/9] gma500: Add support for Intel GMBUS
Before we integrate the new SDVO code we need GMBUS support Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/Makefile|1 + drivers/gpu/drm/gma500/intel_gmbus.c | 493 drivers/gpu/drm/gma500/psb_device.c|7 + drivers/gpu/drm/gma500/psb_drv.h |9 + drivers/gpu/drm/gma500/psb_intel_drv.h |6 + drivers/gpu/drm/gma500/psb_intel_reg.h | 72 + 6 files changed, 588 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/gma500/intel_gmbus.c diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile index 613c74f..96658ec 100644 --- a/drivers/gpu/drm/gma500/Makefile +++ b/drivers/gpu/drm/gma500/Makefile @@ -11,6 +11,7 @@ gma500_gfx-y += gem_glue.o \ gtt.o \ intel_bios.o \ intel_i2c.o \ + intel_gmbus.o \ intel_opregion.o \ mmu.o \ power.o \ diff --git a/drivers/gpu/drm/gma500/intel_gmbus.c b/drivers/gpu/drm/gma500/intel_gmbus.c new file mode 100644 index 000..147584a --- /dev/null +++ b/drivers/gpu/drm/gma500/intel_gmbus.c @@ -0,0 +1,493 @@ +/* + * Copyright (c) 2006 Dave Airlie + * Copyright © 2006-2008,2010 Intel Corporation + * Jesse Barnes + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Eric Anholt + * Chris Wilson + */ +#include +#include +#include +#include "drmP.h" +#include "drm.h" +#include "psb_intel_drv.h" +#include "gma_drm.h" +#include "psb_drv.h" +#include "psb_intel_reg.h" + +#define _wait_for(COND, MS, W) ({ \ + unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \ + int ret__ = 0; \ + while (! (COND)) { \ + if (time_after(jiffies, timeout__)) { \ + ret__ = -ETIMEDOUT; \ + break; \ + } \ + if (W && !(in_atomic() || in_dbg_master())) msleep(W); \ + } \ + ret__; \ +}) + +#define wait_for(COND, MS) _wait_for(COND, MS, 1) +#define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) + +/* Intel GPIO access functions */ + +#define I2C_RISEFALL_TIME 20 + +static inline struct intel_gmbus * +to_intel_gmbus(struct i2c_adapter *i2c) +{ + return container_of(i2c, struct intel_gmbus, adapter); +} + +struct intel_gpio { + struct i2c_adapter adapter; + struct i2c_algo_bit_data algo; + struct drm_psb_private *dev_priv; + u32 reg; +}; + +void +gma_intel_i2c_reset(struct drm_device *dev) +{ + REG_WRITE(GMBUS0, 0); +} + +static void intel_i2c_quirk_set(struct drm_psb_private *dev_priv, bool enable) +{ + /* When using bit bashing for I2C, this bit needs to be set to 1 */ + /* FIXME: We are never Pineview, right? + + u32 val; + + if (!IS_PINEVIEW(dev_priv->dev)) + return; + + val = REG_READ(DSPCLK_GATE_D); + if (enable) + val |= DPCUNIT_CLOCK_GATE_DISABLE; + else + val &= ~DPCUNIT_CLOCK_GATE_DISABLE; + REG_WRITE(DSPCLK_GATE_D, val); + + return; + */ +} + +static u32 get_reserved(struct intel_gpio *gpio) +{ + struct drm_psb_private *dev_priv = gpio->dev_priv; + struct drm_device *dev = dev_priv->dev; + u32 reserved = 0; + + /* On most chips, these bits must be preserved in software. */ + reserved = REG_READ(gpio->reg) & +(GPIO_DATA_PULLUP_DISABLE | + GPIO_CLOCK_PULLUP_DISABLE); + + return reserved; +} + +static int get_clo
[PATCH 7/9] gma500: Convert Cedarview to work with new output handling
Replace psb_intel_output with psb_intel_encoder and psb_intel_connector. Things will need to be cleaned up and tested so consider this an initial patch for Cedarview. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/cdv_intel_crt.c | 47 +++- drivers/gpu/drm/gma500/cdv_intel_display.c | 14 ++-- drivers/gpu/drm/gma500/cdv_intel_hdmi.c| 112 +++--- drivers/gpu/drm/gma500/cdv_intel_lvds.c| 117 +++- drivers/gpu/drm/gma500/psb_drv.h |2 +- drivers/gpu/drm/gma500/psb_intel_drv.h |5 + 6 files changed, 169 insertions(+), 128 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c index efda63b..6d0f10b 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_crt.c +++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c @@ -204,9 +204,10 @@ static enum drm_connector_status cdv_intel_crt_detect( static void cdv_intel_crt_destroy(struct drm_connector *connector) { - struct psb_intel_output *intel_output = to_psb_intel_output(connector); + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); - psb_intel_i2c_destroy(intel_output->ddc_bus); + psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus); drm_sysfs_connector_remove(connector); drm_connector_cleanup(connector); kfree(connector); @@ -214,9 +215,9 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector) static int cdv_intel_crt_get_modes(struct drm_connector *connector) { - struct psb_intel_output *intel_output = - to_psb_intel_output(connector); - return psb_intel_ddc_get_modes(intel_output); + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); + return psb_intel_ddc_get_modes(connector, &psb_intel_encoder->ddc_bus->adapter); } static int cdv_intel_crt_set_property(struct drm_connector *connector, @@ -266,27 +267,31 @@ void cdv_intel_crt_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev) { - struct psb_intel_output *psb_intel_output; + struct psb_intel_connector *psb_intel_connector; + struct psb_intel_encoder *psb_intel_encoder; struct drm_connector *connector; struct drm_encoder *encoder; u32 i2c_reg; - psb_intel_output = kzalloc(sizeof(struct psb_intel_output), GFP_KERNEL); - if (!psb_intel_output) + psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); + if (!psb_intel_encoder) return; - psb_intel_output->mode_dev = mode_dev; - connector = &psb_intel_output->base; + psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); + if (!psb_intel_connector) + goto failed_connector; + + connector = &psb_intel_connector->base; drm_connector_init(dev, connector, &cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); - encoder = &psb_intel_output->enc; + encoder = &psb_intel_encoder->base; drm_encoder_init(dev, encoder, &cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC); - drm_mode_connector_attach_encoder(&psb_intel_output->base, - &psb_intel_output->enc); + psb_intel_connector_attach_encoder(psb_intel_connector, + psb_intel_encoder); /* Set up the DDC bus. */ i2c_reg = GPIOA; @@ -295,15 +300,15 @@ void cdv_intel_crt_init(struct drm_device *dev, if (dev_priv->crt_ddc_bus != 0) i2c_reg = dev_priv->crt_ddc_bus; }*/ - psb_intel_output->ddc_bus = psb_intel_i2c_create(dev, - i2c_reg, "CRTDDC_A"); - if (!psb_intel_output->ddc_bus) { + psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev, + i2c_reg, "CRTDDC_A"); + if (!psb_intel_encoder->ddc_bus) { dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " "failed.\n"); goto failed_ddc; } - psb_intel_output->type = INTEL_OUTPUT_ANALOG; + psb_intel_encoder->type = INTEL_OUTPUT_ANALOG; /* psb_intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT); psb_intel_output->crtc_mask = (1 << 0) | (1 << 1); @@ -319,8 +324,10 @@ void cdv_intel_crt_init(struct drm_device *dev, return; failed_ddc: - drm_encoder_cleanup(&psb_intel_output->enc); - drm_connector_cleanup(&psb_intel_output->base); - kfree(psb_intel_output); + drm_encoder_cleanup(&psb_intel_encoder->base); + drm_connector_cleanup(&psb_intel_connector->base); + kfree(psb_intel_connector);
[PATCH 8/9] gma500: Convert Moorestown to work with new output handling
Replace psb_intel_output with psb_intel_encoder and psb_intel_connector Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/oaktrail_crtc.c | 18 drivers/gpu/drm/gma500/oaktrail_hdmi.c | 29 +++ drivers/gpu/drm/gma500/oaktrail_lvds.c | 79 +--- 3 files changed, 79 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c index 8e15b5a..2ef1f1b 100644 --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c @@ -313,9 +313,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, bool is_crt = false, is_lvds = false, is_tv = false; bool is_mipi = false; struct drm_mode_config *mode_config = &dev->mode_config; - struct psb_intel_output *psb_intel_output = NULL; + struct psb_intel_encoder *psb_intel_encoder = NULL; uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN; - struct drm_encoder *encoder; + struct drm_connector *connector; if (!gma_power_begin(dev, true)) return 0; @@ -327,13 +327,13 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, adjusted_mode, sizeof(struct drm_display_mode)); - list_for_each_entry(encoder, &mode_config->encoder_list, head) { - - if (encoder->crtc != crtc) + list_for_each_entry(connector, &mode_config->connector_list, head) { + if (!connector->encoder || connector->encoder->crtc != crtc) continue; - psb_intel_output = enc_to_psb_intel_output(encoder); - switch (psb_intel_output->type) { + psb_intel_encoder = psb_intel_attached_encoder(connector); + + switch (psb_intel_encoder->type) { case INTEL_OUTPUT_LVDS: is_lvds = true; break; @@ -363,8 +363,8 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ((mode->crtc_hdisplay - 1) << 16) | (mode->crtc_vdisplay - 1)); - if (psb_intel_output) - drm_connector_property_get_value(&psb_intel_output->base, + if (psb_intel_encoder) + drm_connector_property_get_value(connector, dev->mode_config.scaling_mode_property, &scalingType); if (scalingType == DRM_MODE_SCALE_NO_SCALE) { diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c index 6f423c0..36878a6 100644 --- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c @@ -643,29 +643,33 @@ static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = { void oaktrail_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev) { - struct psb_intel_output *psb_intel_output; + struct psb_intel_encoder *psb_intel_encoder; + struct psb_intel_connector *psb_intel_connector; struct drm_connector *connector; struct drm_encoder *encoder; - psb_intel_output = kzalloc(sizeof(struct psb_intel_output), GFP_KERNEL); - if (!psb_intel_output) + psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); + if (!psb_intel_encoder) return; - psb_intel_output->mode_dev = mode_dev; - connector = &psb_intel_output->base; - encoder = &psb_intel_output->enc; - drm_connector_init(dev, &psb_intel_output->base, + psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); + if (!psb_intel_connector) + goto failed_connector; + + connector = &psb_intel_connector->base; + encoder = &psb_intel_encoder->base; + drm_connector_init(dev, connector, &oaktrail_hdmi_connector_funcs, DRM_MODE_CONNECTOR_DVID); - drm_encoder_init(dev, &psb_intel_output->enc, + drm_encoder_init(dev, encoder, &oaktrail_hdmi_enc_funcs, DRM_MODE_ENCODER_TMDS); - drm_mode_connector_attach_encoder(&psb_intel_output->base, - &psb_intel_output->enc); + psb_intel_connector_attach_encoder(psb_intel_connector, + psb_intel_encoder); - psb_intel_output->type = INTEL_OUTPUT_HDMI; + psb_intel_encoder->type = INTEL_OUTPUT_HDMI; drm_encoder_helper_add(encoder, &oaktrail_hdmi_helper_funcs); drm_connector_helper_add(connector, &oaktrail_hdmi_connector_helper_funcs); @@ -675,6 +679,9 @@ void oaktrail_hdmi_init(struct drm_device *dev, drm_sysfs_connector_add(connector); return; + +failed_connector: + kfree(psb_intel_encoder); } static DEFINE_PCI_DEVICE_TABLE(hdmi_ids) = { diff --git a/drivers/gpu/drm/gma500/oaktrail_
[PATCH 9/9] gma500: SDVO DDC bus guessing isn't working so hardcode it instead
We currently don't have support for parsing SDVO mappings from BIOS so we're guessing the bus switch parameter. This isn't working so hardcode it to a configuration known to work on most poulsbo hardware. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/psb_intel_sdvo.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c index 20d5366..4882b29 100644 --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c @@ -1876,6 +1876,13 @@ static const struct drm_encoder_funcs psb_intel_sdvo_enc_funcs = { static void psb_intel_sdvo_guess_ddc_bus(struct psb_intel_sdvo *sdvo) { + /* FIXME: At the moment, ddc_bus = 2 is the only thing that works. +* We need to figure out if this is true for all available poulsbo +* hardware, or if we need to fiddle with the guessing code above. +* The problem might go away if we can parse sdvo mappings from bios */ + sdvo->ddc_bus = 2; + +#if 0 uint16_t mask = 0; unsigned int num_bits; @@ -1907,6 +1914,7 @@ psb_intel_sdvo_guess_ddc_bus(struct psb_intel_sdvo *sdvo) /* Corresponds to SDVO_CONTROL_BUS_DDCx */ sdvo->ddc_bus = 1 << num_bits; +#endif } /** -- 1.7.4.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Noise in games on Intel HD Graphics 2000
On Tue, 06 Dec 2011 22:59:58 +0100, semiRocket wrote: > Hi, > > I'm running on Intel i3 2100 integrated graphics, I'm getting some strange > noise particles in games like Minecraft and Speed Dreams (mostly > noticeable in Minecraft) after playing a while, like half an hour. After > that restarting game doesn't help, only computer restart have the effect > of returning graphics to normal. Some screenshots bellow: Fix here: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=406478dc911e16677fbd9c84d1d50cdffbc031ab pgpUJtAfWaTbF.pgp Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] libdrm: plane & addfb2 support
Import the current kernel bits into libdrm for client code. Signed-off-by: Jesse Barnes diff --git a/include/drm/Makefile.am b/include/drm/Makefile.am index 43695bd..2923ab4 100644 --- a/include/drm/Makefile.am +++ b/include/drm/Makefile.am @@ -26,6 +26,7 @@ klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = \ drm.h \ drm_mode.h \ + drm_fourcc.h \ drm_sarea.h \ i915_drm.h \ mga_drm.h \ diff --git a/include/drm/drm.h b/include/drm/drm.h index 5fd24fc..8adb9d5 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -713,6 +713,10 @@ struct drm_get_cap { #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) #define DRM_IOCTL_MODE_MAP_DUMBDRM_IOWR(0xB3, struct drm_mode_map_dumb) #define DRM_IOCTL_MODE_DESTROY_DUMBDRM_IOWR(0xB4, struct drm_mode_destroy_dumb) +#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) +#define DRM_IOCTL_MODE_GETPLANEDRM_IOWR(0xB6, struct drm_mode_get_plane) +#define DRM_IOCTL_MODE_SETPLANEDRM_IOWR(0xB7, struct drm_mode_set_plane) +#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) /** * Device specific ioctls should only be in their respective headers diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h new file mode 100644 index 000..b1107cb --- /dev/null +++ b/include/drm/drm_fourcc.h @@ -0,0 +1,130 @@ +/* + * Copyright 2011 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef DRM_FOURCC_H +#define DRM_FOURCC_H + +#include + +#define fourcc_code(a,b,c,d) ((__u32)(a) | ((__u32)(b) << 8) | \ + ((__u32)(c) << 16) | ((__u32)(d) << 24)) + +#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ + +/* color index */ +#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ + +/* 8 bpp RGB */ +#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ +#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ + +/* 16 bpp RGB */ +#define DRM_FORMAT_XRGBfourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ +#define DRM_FORMAT_XBGRfourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ +#define DRM_FORMAT_RGBXfourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ +#define DRM_FORMAT_BGRXfourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ + +#define DRM_FORMAT_ARGBfourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ +#define DRM_FORMAT_ABGRfourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ +#define DRM_FORMAT_RGBAfourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ +#define DRM_FORMAT_BGRAfourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ + +#define DRM_FORMAT_XRGB1555fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ +#define DRM_FORMAT_XBGR1555fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ +#define DRM_FORMAT_RGBX5551fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ +#define DRM_FORMAT_BGRX5551fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ + +#define DRM_FORMAT_ARGB1555fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ +#define DRM_FORMAT_ABGR1555fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ +#define DRM_FORMAT_RGBA5551fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ +#define DRM_FORMAT_BGRA5551fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ + +#define DRM_FORMAT_RGB
[Bug 43395] Game running in wine stops rendering
https://bugs.freedesktop.org/show_bug.cgi?id=43395 --- Comment #13 from Tomas Schlosser 2011-12-07 13:33:53 PST --- (In reply to comment #12) > Does setting the environment variable vblank_mode=0 for the Wine process using > OpenGL work around the problem? There should be a message > > ATTENTION: default value of option vblank_mode overridden by environment. > > on stderr to confirm it takes effect. No, it doesn't help. The message was printed and the game run slower, but got stuck after 6 minutes. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/3] drm/radeon/kms: one more HDMI cleanup (in disabling code)
Signed-off-by: Rafał Miłecki --- drivers/gpu/drm/radeon/r600_hdmi.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 5021372..06f923e 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -571,9 +571,15 @@ void r600_hdmi_disable(struct drm_encoder *encoder) /* disable polling */ r600_audio_disable_polling(encoder); - if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) { + if (ASIC_IS_DCE5(rdev)) { + /* TODO */ + } else if (ASIC_IS_DCE4(rdev)) { + /* TODO */ + } else if (ASIC_IS_DCE32(rdev)) { WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0, ~0x1); - } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { + } else if (ASIC_IS_DCE3(rdev)) { + /* TODO */ + } else if (rdev->family >= CHIP_R600) { switch (radeon_encoder->encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: WREG32_P(AVIVO_TMDSA_CNTL, 0, ~0x4); -- 1.7.3.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/3] drm/radeon/kms: support for audio on Evergreen
Signed-off-by: Rafał Miłecki --- drivers/gpu/drm/radeon/evergreen.c | 14 ++ drivers/gpu/drm/radeon/evergreen_reg.h |8 drivers/gpu/drm/radeon/r600_audio.c| 22 +++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 1d603a3..651719a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -3120,6 +3120,12 @@ static int evergreen_startup(struct radeon_device *rdev) if (r) return r; + r = r600_audio_init(rdev); + if (r) { + DRM_ERROR("radeon: audio init failed\n"); + return r; + } + return 0; } @@ -3151,12 +3157,19 @@ int evergreen_resume(struct radeon_device *rdev) return r; } + r = r600_audio_init(rdev); + if (r) { + DRM_ERROR("radeon: audio resume failed\n"); + return r; + } + return r; } int evergreen_suspend(struct radeon_device *rdev) { + r600_audio_fini(rdev); /* FIXME: we should wait for ring to be empty */ r700_cp_stop(rdev); rdev->cp.ready = false; @@ -3276,6 +3289,7 @@ int evergreen_init(struct radeon_device *rdev) void evergreen_fini(struct radeon_device *rdev) { + r600_audio_fini(rdev); r600_blit_fini(rdev); r700_cp_fini(rdev); r600_irq_fini(rdev); diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92..01cff84 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h @@ -35,6 +35,14 @@ #define EVERGREEN_P1PLL_SS_CNTL 0x414 #define EVERGREEN_P2PLL_SS_CNTL 0x454 # define EVERGREEN_PxPLL_SS_EN(1 << 12) + +#define EVERGREEN_AUDIO_PLL1_MUL 0x5b0 +#define EVERGREEN_AUDIO_PLL1_DIV 0x5b4 +#define EVERGREEN_AUDIO_PLL1_UNK 0x5bc + +#define EVERGREEN_AUDIO_ENABLE 0x5e78 +#define EVERGREEN_AUDIO_VENDOR_ID 0x5ec0 + /* GRPH blocks at 0x6800, 0x7400, 0x1, 0x10c00, 0x11800, 0x12400 */ #define EVERGREEN_GRPH_ENABLE 0x6800 #define EVERGREEN_GRPH_CONTROL 0x6804 diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index fa3bb53..ba66f30 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c @@ -36,7 +36,7 @@ */ static int r600_audio_chipset_supported(struct radeon_device *rdev) { - return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE4(rdev)) + return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE5(rdev)) || rdev->family == CHIP_RS600 || rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740; @@ -161,8 +161,18 @@ static void r600_audio_update_hdmi(unsigned long param) */ static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable) { + u32 value = 0; DRM_INFO("%s audio support\n", enable ? "Enabling" : "Disabling"); - WREG32_P(R600_AUDIO_ENABLE, enable ? 0x8100 : 0x0, ~0x8100); + if (ASIC_IS_DCE4(rdev)) { + if (enable) { + value |= 0x8100; /* Required to enable audio */ + value |= 0x0e1000f0; /* fglrx sets that too */ + } + WREG32(EVERGREEN_AUDIO_ENABLE, value); + } else { + WREG32_P(R600_AUDIO_ENABLE, +enable ? 0x8100 : 0x0, ~0x8100); + } rdev->audio_enabled = enable; } @@ -249,7 +259,13 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock) } if (ASIC_IS_DCE4(rdev)) { - /* TODO */ + /* TODO: other PLLs? */ + WREG32(EVERGREEN_AUDIO_PLL1_MUL, base_rate * 10); + WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10); + WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x0071); + + /* Some magic trigger or src sel? */ + WREG32_P(0x5ac, 0x01, ~0x77); } else { switch (dig->dig_encoder) { case 0: -- 1.7.3.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/3] drm/radeon/kms: enable HDMI mode on Evergreen encoders
Signed-off-by: Rafał Miłecki --- drivers/gpu/drm/radeon/evergreen_reg.h | 10 +++ drivers/gpu/drm/radeon/r600_hdmi.c | 44 ++-- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index 01cff84..ce4414d 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h @@ -199,4 +199,14 @@ #define EVERGREEN_DC_GPIO_HPD_EN0x64b8 #define EVERGREEN_DC_GPIO_HPD_Y 0x64bc +/* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */ +#define EVERGREEN_HDMI_BLOCK0 0x7030 +#define EVERGREEN_HDMI_BLOCK1 0x7c30 +#define EVERGREEN_HDMI_BLOCK2 0x10830 +#define EVERGREEN_HDMI_BLOCK3 0x11430 +#define EVERGREEN_HDMI_BLOCK4 0x12030 +#define EVERGREEN_HDMI_BLOCK5 0x12c30 + +#define EVERGREEN_HDMI_CONFIG_OFFSET 0xf0 + #endif diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 06f923e..9612080 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -313,7 +313,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod struct radeon_device *rdev = dev->dev_private; uint32_t offset = to_radeon_encoder(encoder)->hdmi_offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; if (!offset) @@ -463,7 +463,31 @@ static void r600_hdmi_assign_block(struct drm_encoder *encoder) if (ASIC_IS_DCE5(rdev)) { /* TODO */ } else if (ASIC_IS_DCE4(rdev)) { - /* TODO */ + switch (dig->dig_encoder) { + case 0: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK0; + break; + case 1: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK1; + break; + case 2: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK2; + break; + case 3: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK3; + break; + case 4: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK4; + break; + case 5: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK5; + break; + default: + dev_err(rdev->dev, "Enabling HDMI on unknown dig\n"); + return; + } + radeon_encoder->hdmi_config_offset = radeon_encoder->hdmi_offset + + EVERGREEN_HDMI_CONFIG_OFFSET; } else if (ASIC_IS_DCE3(rdev)) { radeon_encoder->hdmi_offset = dig->dig_encoder ? R600_HDMI_BLOCK3 : R600_HDMI_BLOCK1; @@ -486,7 +510,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder) struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); uint32_t offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; if (!radeon_encoder->hdmi_offset) { @@ -502,7 +526,10 @@ void r600_hdmi_enable(struct drm_encoder *encoder) if (ASIC_IS_DCE5(rdev)) { /* TODO */ } else if (ASIC_IS_DCE4(rdev)) { - /* TODO */ + /* This -= 0x30 looks a little tricky, but it's just touching +* dig encoder register that lies a little before HDMI block. */ + WREG32_P(radeon_encoder->hdmi_offset - 0x30, 0x1000, ~0x1000); + WREG32_P(radeon_encoder->hdmi_config_offset + 0xc, 0x1, ~0x1); } else if (ASIC_IS_DCE32(rdev)) { WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0x1, ~0x1); } else if (ASIC_IS_DCE3(rdev)) { @@ -526,8 +553,8 @@ void r600_hdmi_enable(struct drm_encoder *encoder) if (rdev->irq.installed && rdev->family != CHIP_RS600 && rdev->family != CHIP_RS690 - && rdev->family != CHIP_RS740) { - + && rdev->family != CHIP_RS740 + && !ASIC_IS_DCE4(rdev)) { /* if irq is available use it */ rdev->irq.hdmi[offset == R600_HDMI_BLOCK1 ? 0 : 1] = true; radeon_irq_set(rdev); @@ -552,7 +579,7 @@ void r600_hdmi_disable(struct drm_encoder *encoder) struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); uint32_t offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; offset = radeon_encoder->hdmi_offset; @@ -574,7 +601,8 @@ void r600_hdmi_disable
[PATCH] drm/radeon/kms: do not force DVI mode on DCE4 if audio is on
Signed-off-by: Rafał Miłecki --- drivers/gpu/drm/radeon/atombios_encoders.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 39c04c1..63e5426 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c @@ -436,7 +436,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { /* fix me */ - if (ASIC_IS_DCE4(rdev)) + if (!radeon_audio && ASIC_IS_DCE4(rdev)) return ATOM_ENCODER_MODE_DVI; else return ATOM_ENCODER_MODE_HDMI; @@ -450,7 +450,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) default: if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { /* fix me */ - if (ASIC_IS_DCE4(rdev)) + if (!radeon_audio && ASIC_IS_DCE4(rdev)) return ATOM_ENCODER_MODE_DVI; else return ATOM_ENCODER_MODE_HDMI; @@ -467,7 +467,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) return ATOM_ENCODER_MODE_DP; else if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { /* fix me */ - if (ASIC_IS_DCE4(rdev)) + if (!radeon_audio && ASIC_IS_DCE4(rdev)) return ATOM_ENCODER_MODE_DVI; else return ATOM_ENCODER_MODE_HDMI; -- 1.7.3.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon/kms: do not force DVI mode on DCE4 if audio is on
2011/12/7 Rafał Miłecki : > > Signed-off-by: Rafał Miłecki > --- > drivers/gpu/drm/radeon/atombios_encoders.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c > b/drivers/gpu/drm/radeon/atombios_encoders.c > index 39c04c1..63e5426 100644 > --- a/drivers/gpu/drm/radeon/atombios_encoders.c > +++ b/drivers/gpu/drm/radeon/atombios_encoders.c > @@ -436,7 +436,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) > case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog > works fine */ > if (drm_detect_monitor_audio(radeon_connector->edid) && > radeon_audio) { > /* fix me */ > - if (ASIC_IS_DCE4(rdev)) > + if (!radeon_audio && ASIC_IS_DCE4(rdev)) These are already protected by if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) above. Just drop the entire DCE4 check. E.g.,: if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) return ATOM_ENCODER_MODE_HDMI; else return ATOM_ENCODER_MODE_DVI; Alex > return ATOM_ENCODER_MODE_DVI; > else > return ATOM_ENCODER_MODE_HDMI; > @@ -450,7 +450,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) > default: > if (drm_detect_monitor_audio(radeon_connector->edid) && > radeon_audio) { > /* fix me */ > - if (ASIC_IS_DCE4(rdev)) > + if (!radeon_audio && ASIC_IS_DCE4(rdev)) > return ATOM_ENCODER_MODE_DVI; > else > return ATOM_ENCODER_MODE_HDMI; > @@ -467,7 +467,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) > return ATOM_ENCODER_MODE_DP; > else if (drm_detect_monitor_audio(radeon_connector->edid) && > radeon_audio) { > /* fix me */ > - if (ASIC_IS_DCE4(rdev)) > + if (!radeon_audio && ASIC_IS_DCE4(rdev)) > return ATOM_ENCODER_MODE_DVI; > else > return ATOM_ENCODER_MODE_HDMI; > -- > 1.7.3.4 > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon/kms: do not force DVI mode on DCE4 if audio is on
2011/12/7 Alex Deucher : > 2011/12/7 Rafał Miłecki : >> >> Signed-off-by: Rafał Miłecki >> --- >> drivers/gpu/drm/radeon/atombios_encoders.c | 6 +++--- >> 1 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c >> b/drivers/gpu/drm/radeon/atombios_encoders.c >> index 39c04c1..63e5426 100644 >> --- a/drivers/gpu/drm/radeon/atombios_encoders.c >> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c >> @@ -436,7 +436,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) >> case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog >> works fine */ >> if (drm_detect_monitor_audio(radeon_connector->edid) && >> radeon_audio) { >> /* fix me */ >> - if (ASIC_IS_DCE4(rdev)) >> + if (!radeon_audio && ASIC_IS_DCE4(rdev)) > > These are already protected by if > (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) > above. Just drop the entire DCE4 check. E.g.,: > > if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) > return ATOM_ENCODER_MODE_HDMI; > else > return ATOM_ENCODER_MODE_DVI; Oh, sure, thanks. -- Rafał ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/radeon/kms: enable HDMI mode on Evergreen encoders
2011/12/7 Rafał Miłecki : > > Signed-off-by: Rafał Miłecki > --- > drivers/gpu/drm/radeon/evergreen_reg.h | 10 +++ > drivers/gpu/drm/radeon/r600_hdmi.c | 44 > ++-- > 2 files changed, 46 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h > b/drivers/gpu/drm/radeon/evergreen_reg.h > index 01cff84..ce4414d 100644 > --- a/drivers/gpu/drm/radeon/evergreen_reg.h > +++ b/drivers/gpu/drm/radeon/evergreen_reg.h > @@ -199,4 +199,14 @@ > #define EVERGREEN_DC_GPIO_HPD_EN 0x64b8 > #define EVERGREEN_DC_GPIO_HPD_Y 0x64bc > > +/* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */ > +#define EVERGREEN_HDMI_BLOCK0 0x7030 > +#define EVERGREEN_HDMI_BLOCK1 0x7c30 > +#define EVERGREEN_HDMI_BLOCK2 0x10830 > +#define EVERGREEN_HDMI_BLOCK3 0x11430 > +#define EVERGREEN_HDMI_BLOCK4 0x12030 > +#define EVERGREEN_HDMI_BLOCK5 0x12c30 > + > +#define EVERGREEN_HDMI_CONFIG_OFFSET 0xf0 > + > #endif > diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c > b/drivers/gpu/drm/radeon/r600_hdmi.c > index 06f923e..9612080 100644 > --- a/drivers/gpu/drm/radeon/r600_hdmi.c > +++ b/drivers/gpu/drm/radeon/r600_hdmi.c > @@ -313,7 +313,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, > struct drm_display_mode *mod > struct radeon_device *rdev = dev->dev_private; > uint32_t offset = to_radeon_encoder(encoder)->hdmi_offset; > > - if (ASIC_IS_DCE4(rdev)) > + if (ASIC_IS_DCE5(rdev)) > return; > > if (!offset) > @@ -463,7 +463,31 @@ static void r600_hdmi_assign_block(struct drm_encoder > *encoder) > if (ASIC_IS_DCE5(rdev)) { > /* TODO */ > } else if (ASIC_IS_DCE4(rdev)) { > - /* TODO */ > + switch (dig->dig_encoder) { > + case 0: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK0; > + break; > + case 1: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK1; > + break; > + case 2: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK2; > + break; > + case 3: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK3; > + break; > + case 4: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK4; > + break; > + case 5: > + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK5; > + break; > + default: > + dev_err(rdev->dev, "Enabling HDMI on unknown dig\n"); > + return; > + } > + radeon_encoder->hdmi_config_offset = > radeon_encoder->hdmi_offset > + + > EVERGREEN_HDMI_CONFIG_OFFSET; > } else if (ASIC_IS_DCE3(rdev)) { > radeon_encoder->hdmi_offset = dig->dig_encoder ? > R600_HDMI_BLOCK3 : R600_HDMI_BLOCK1; > @@ -486,7 +510,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder) > struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); > uint32_t offset; > > - if (ASIC_IS_DCE4(rdev)) > + if (ASIC_IS_DCE5(rdev)) > return; > > if (!radeon_encoder->hdmi_offset) { > @@ -502,7 +526,10 @@ void r600_hdmi_enable(struct drm_encoder *encoder) > if (ASIC_IS_DCE5(rdev)) { > /* TODO */ > } else if (ASIC_IS_DCE4(rdev)) { > - /* TODO */ > + /* This -= 0x30 looks a little tricky, but it's just touching > + * dig encoder register that lies a little before HDMI block. > */ > + WREG32_P(radeon_encoder->hdmi_offset - 0x30, 0x1000, ~0x1000); You shouldn't program 0x7000 (DIG_CNTL) here. It's already programmed via the atom atombios_dig_encoder_setup() when action=ATOM_ENCODER_CMD_SETUP based on how you set the ucEncoderMode parameter (DP, LVDS, DVI, HDMI -- set by atombios_get_encoder_mode()). DIG_CNTL.DIG_MODE is a 3 bit field and changing just 1 bit change the encoder type which may cause problems depending on how the dig encoder is set up. > + WREG32_P(radeon_encoder->hdmi_config_offset + 0xc, 0x1, ~0x1); > } else if (ASIC_IS_DCE32(rdev)) { > WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0x1, ~0x1); > } else if (ASIC_IS_DCE3(rdev)) { > @@ -526,8 +553,8 @@ void r600_hdmi_enable(struct drm_encoder *encoder) > if (rdev->irq.installed > && rdev->family != CHIP_RS600 > && rdev->family != CHIP_RS690 > - && rdev->f
[PATCH V2] drm/radeon/kms: do not force DVI mode on DCE4 if audio is on
Signed-off-by: Rafał Miłecki --- V2: don't duplicate check for radeon_audio --- drivers/gpu/drm/radeon/atombios_encoders.c | 35 +-- 1 files changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 39c04c1..f1f06ca 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c @@ -409,8 +409,6 @@ int atombios_get_encoder_mode(struct drm_encoder *encoder) { struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); - struct drm_device *dev = encoder->dev; - struct radeon_device *rdev = dev->dev_private; struct drm_connector *connector; struct radeon_connector *radeon_connector; struct radeon_connector_atom_dig *dig_connector; @@ -434,13 +432,10 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) switch (connector->connector_type) { case DRM_MODE_CONNECTOR_DVII: case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ - if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { - /* fix me */ - if (ASIC_IS_DCE4(rdev)) - return ATOM_ENCODER_MODE_DVI; - else - return ATOM_ENCODER_MODE_HDMI; - } else if (radeon_connector->use_digital) + if (drm_detect_monitor_audio(radeon_connector->edid) && + radeon_audio) + return ATOM_ENCODER_MODE_HDMI; + else if (radeon_connector->use_digital) return ATOM_ENCODER_MODE_DVI; else return ATOM_ENCODER_MODE_CRT; @@ -448,13 +443,10 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) case DRM_MODE_CONNECTOR_DVID: case DRM_MODE_CONNECTOR_HDMIA: default: - if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { - /* fix me */ - if (ASIC_IS_DCE4(rdev)) - return ATOM_ENCODER_MODE_DVI; - else - return ATOM_ENCODER_MODE_HDMI; - } else + if (drm_detect_monitor_audio(radeon_connector->edid) && + radeon_audio) + return ATOM_ENCODER_MODE_HDMI; + else return ATOM_ENCODER_MODE_DVI; break; case DRM_MODE_CONNECTOR_LVDS: @@ -465,13 +457,10 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) return ATOM_ENCODER_MODE_DP; - else if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { - /* fix me */ - if (ASIC_IS_DCE4(rdev)) - return ATOM_ENCODER_MODE_DVI; - else - return ATOM_ENCODER_MODE_HDMI; - } else + else if (drm_detect_monitor_audio(radeon_connector->edid) && +radeon_audio) + return ATOM_ENCODER_MODE_HDMI; + else return ATOM_ENCODER_MODE_DVI; break; case DRM_MODE_CONNECTOR_eDP: -- 1.7.3.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/3] drm/radeon/kms: one more HDMI cleanup (in disabling code)
Signed-off-by: Rafał Miłecki --- drivers/gpu/drm/radeon/r600_hdmi.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 5021372..06f923e 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -571,9 +571,15 @@ void r600_hdmi_disable(struct drm_encoder *encoder) /* disable polling */ r600_audio_disable_polling(encoder); - if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) { + if (ASIC_IS_DCE5(rdev)) { + /* TODO */ + } else if (ASIC_IS_DCE4(rdev)) { + /* TODO */ + } else if (ASIC_IS_DCE32(rdev)) { WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0, ~0x1); - } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { + } else if (ASIC_IS_DCE3(rdev)) { + /* TODO */ + } else if (rdev->family >= CHIP_R600) { switch (radeon_encoder->encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: WREG32_P(AVIVO_TMDSA_CNTL, 0, ~0x4); -- 1.7.3.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH V2 3/3] drm/radeon/kms: enable HDMI mode on Evergreen encoders
Signed-off-by: Rafał Miłecki --- V2: Don't touch DIG_CNTL manually, AtomBIOS does that for us. My early testing was done with hacked code to enable HDMI on DVI. After fixing atombios_get_encoder_mode the behaviour has changed a little, that hack is not needed anymore. --- drivers/gpu/drm/radeon/evergreen_reg.h | 10 drivers/gpu/drm/radeon/r600_hdmi.c | 40 +-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92..eb02d5e 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h @@ -191,4 +191,14 @@ #define EVERGREEN_DC_GPIO_HPD_EN0x64b8 #define EVERGREEN_DC_GPIO_HPD_Y 0x64bc +/* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */ +#define EVERGREEN_HDMI_BLOCK0 0x7030 +#define EVERGREEN_HDMI_BLOCK1 0x7c30 +#define EVERGREEN_HDMI_BLOCK2 0x10830 +#define EVERGREEN_HDMI_BLOCK3 0x11430 +#define EVERGREEN_HDMI_BLOCK4 0x12030 +#define EVERGREEN_HDMI_BLOCK5 0x12c30 + +#define EVERGREEN_HDMI_CONFIG_OFFSET 0xf0 + #endif diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 06f923e..9f5723e 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -313,7 +313,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod struct radeon_device *rdev = dev->dev_private; uint32_t offset = to_radeon_encoder(encoder)->hdmi_offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; if (!offset) @@ -463,7 +463,31 @@ static void r600_hdmi_assign_block(struct drm_encoder *encoder) if (ASIC_IS_DCE5(rdev)) { /* TODO */ } else if (ASIC_IS_DCE4(rdev)) { - /* TODO */ + switch (dig->dig_encoder) { + case 0: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK0; + break; + case 1: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK1; + break; + case 2: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK2; + break; + case 3: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK3; + break; + case 4: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK4; + break; + case 5: + radeon_encoder->hdmi_offset = EVERGREEN_HDMI_BLOCK5; + break; + default: + dev_err(rdev->dev, "Enabling HDMI on unknown dig\n"); + return; + } + radeon_encoder->hdmi_config_offset = radeon_encoder->hdmi_offset + + EVERGREEN_HDMI_CONFIG_OFFSET; } else if (ASIC_IS_DCE3(rdev)) { radeon_encoder->hdmi_offset = dig->dig_encoder ? R600_HDMI_BLOCK3 : R600_HDMI_BLOCK1; @@ -486,7 +510,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder) struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); uint32_t offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; if (!radeon_encoder->hdmi_offset) { @@ -502,7 +526,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder) if (ASIC_IS_DCE5(rdev)) { /* TODO */ } else if (ASIC_IS_DCE4(rdev)) { - /* TODO */ + WREG32_P(radeon_encoder->hdmi_config_offset + 0xc, 0x1, ~0x1); } else if (ASIC_IS_DCE32(rdev)) { WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0x1, ~0x1); } else if (ASIC_IS_DCE3(rdev)) { @@ -526,8 +550,8 @@ void r600_hdmi_enable(struct drm_encoder *encoder) if (rdev->irq.installed && rdev->family != CHIP_RS600 && rdev->family != CHIP_RS690 - && rdev->family != CHIP_RS740) { - + && rdev->family != CHIP_RS740 + && !ASIC_IS_DCE4(rdev)) { /* if irq is available use it */ rdev->irq.hdmi[offset == R600_HDMI_BLOCK1 ? 0 : 1] = true; radeon_irq_set(rdev); @@ -552,7 +576,7 @@ void r600_hdmi_disable(struct drm_encoder *encoder) struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); uint32_t offset; - if (ASIC_IS_DCE4(rdev)) + if (ASIC_IS_DCE5(rdev)) return; offset = radeon_encoder->hdmi_offset; @@ -574,7 +598,7 @@ void r600_hdmi_disabl
[PATCH] drm/edid: Try harder to fix up broken headers
There's no reason to force the first byte to be correct if we're already scoring how correct the header is. See also: https://bugzilla.redhat.com/show_bug.cgi?id=722909 Signed-off-by: Adam Jackson --- drivers/gpu/drm/drm_edid.c | 18 -- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3e927ce..5fc3597 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -155,16 +155,14 @@ drm_edid_block_valid(u8 *raw_edid) int i; u8 csum = 0; struct edid *edid = (struct edid *)raw_edid; - - if (raw_edid[0] == 0x00) { - int score = drm_edid_header_is_valid(raw_edid); - if (score == 8) ; - else if (score >= 6) { - DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); - memcpy(raw_edid, edid_header, sizeof(edid_header)); - } else { - goto bad; - } + int score = drm_edid_header_is_valid(raw_edid); + + if (score == 8) ; + else if (score >= 6) { + DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); + memcpy(raw_edid, edid_header, sizeof(edid_header)); + } else { + goto bad; } for (i = 0; i < EDID_LENGTH; i++) -- 1.7.6.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 11/23] drm/via: clean up reclaim_buffers
> A few things > - kill reclaim_buffers, it's never ever called because via does not set > DRIVER_HAVE_DMA > - inline the idlelock dance into the buffer reclaim logic and make it > a simple preclose cleanup function > - directly call the the dma_quiescent function and kill the needless > if check. > > Export the idlelock drm functions so that drivers can call them. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_lock.c|2 ++ > drivers/gpu/drm/via/via_drv.c |4 +--- > drivers/gpu/drm/via/via_mm.c | 11 +-- > 3 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c > index 632ae24..b107e1d 100644 > --- a/drivers/gpu/drm/drm_lock.c > +++ b/drivers/gpu/drm/drm_lock.c > @@ -345,6 +345,7 @@ void drm_idlelock_take(struct drm_lock_data *lock_data) > } > spin_unlock_bh(&lock_data->spinlock); > } > +EXPORT_SYMBOL(drm_idlelock_take); > > void drm_idlelock_release(struct drm_lock_data *lock_data) > { > @@ -364,6 +365,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) > } > spin_unlock_bh(&lock_data->spinlock); > } > +EXPORT_SYMBOL(drm_idlelock_release); > > int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv) > { Need the following for modules to work. #include > diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c > index 472adcf..f50431c 100644 > --- a/drivers/gpu/drm/via/via_drv.c > +++ b/drivers/gpu/drm/via/via_drv.c > @@ -62,6 +62,7 @@ static struct drm_driver driver = { > .load = via_driver_load, > .unload = via_driver_unload, > .open = via_driver_open, > + .preclose = via_reclaim_buffers_locked, > .postclose = via_driver_postclose, > .context_dtor = via_final_context, > .get_vblank_counter = via_get_vblank_counter, > @@ -72,9 +73,6 @@ static struct drm_driver driver = { > .irq_uninstall = via_driver_irq_uninstall, > .irq_handler = via_driver_irq_handler, > .dma_quiescent = via_driver_dma_quiescent, > - .reclaim_buffers = drm_core_reclaim_buffers, > - .reclaim_buffers_locked = NULL, > - .reclaim_buffers_idlelocked = via_reclaim_buffers_locked, > .lastclose = via_lastclose, > .ioctls = via_ioctls, > .fops = { > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index 80eab7d..8ce95c5 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -217,6 +217,10 @@ void via_reclaim_buffers_locked(struct drm_device *dev, > { > struct via_file_private *file_priv = file->driver_priv; > struct via_memblock *entry, *next; > + int release_idlelock = 0; > + > + if (file->master && file->master->lock.hw_lock) > + drm_idlelock_take(&file->master->lock); > > mutex_lock(&dev->struct_mutex); > if (list_empty(&file_priv->obj_list)) { > @@ -224,8 +228,7 @@ void via_reclaim_buffers_locked(struct drm_device *dev, > return; > } > > - if (dev->driver->dma_quiescent) > - dev->driver->dma_quiescent(dev); > + via_driver_dma_quiescent(dev); > > list_for_each_entry_safe(entry, next, &file_priv->obj_list, >owner_list) { > @@ -234,5 +237,9 @@ void via_reclaim_buffers_locked(struct drm_device *dev, > kfree(entry); > } > mutex_unlock(&dev->struct_mutex); > + > + if (release_idlelock) > + drm_idlelock_release(&file->master->lock); > + When does release_idlelock get set? > return; > } > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 43617] New: [bisected i965]oglc api-error(negative.glGetPixelMap) segfaults
https://bugs.freedesktop.org/show_bug.cgi?id=43617 Bug #: 43617 Summary: [bisected i965]oglc api-error(negative.glGetPixelMap) segfaults Classification: Unclassified Product: DRI Version: unspecified Platform: All OS/Version: Linux (All) Status: NEW Severity: major Priority: high Component: libdrm AssignedTo: dri-devel@lists.freedesktop.org ReportedBy: xunx.f...@intel.com CC: ch...@chris-wilson.co.uk System Environment: -- Arch: i386 Platform: huronriver Libdrm: (master)2.4.28-4-gdd9a5b4f7fb07c78db4e7481bedca1b981030e3f Mesa: (7.11)7a18f005ed311b4d57ad863a08392160aa0d7c83 Xserver:(server-1.11-branch)xorg-server-1.11.1 Xf86_video_intel: (master)2.17.0-52-g101942d41df7efaa6103e31e738775fafdb63159 Kernel: (drm-intel-fixes)5be93ad2ebb975df8ba01f6c76b541ff4e9929f4 Bug detailed description: - It segfaults on ironlake and sandybridge. Bisect shows c549a777c1b6227a724942c64aa5cd181eb93c6c is the first bad commit. commit c549a777c1b6227a724942c64aa5cd181eb93c6c Author: Chris Wilson AuthorDate: Mon Dec 5 10:14:34 2011 + Commit: Chris Wilson CommitDate: Mon Dec 5 10:25:53 2011 + intel: Unmap buffers during drm_intel_gem_bo_unmap We cannot afford to cache the vma per open bo as this may exhaust the per-process limits. References: https://bugs.freedesktop.org/show_bug.cgi?id=43075 References: https://bugs.freedesktop.org/show_bug.cgi?id=40066 Signed-off-by: Chris Wilson (gdb) bt #0 0x0037f7034085 in raise () from /lib64/libc.so.6 #1 0x0037f7035a36 in abort () from /lib64/libc.so.6 #2 0x0037f702c8c5 in __assert_fail () from /lib64/libc.so.6 #3 0x769cc480 in drm_intel_gem_bo_map_gtt (bo=0x2631c00) at intel_bufmgr_gem.c:1168 #4 0x76c3413d in intel_bufferobj_map (ctx=0x77fda010, target=, access=35001, obj=0x2631b40) at intel_buffer_objects.c:344 #5 0x76cfada1 in _mesa_map_pbo_dest (ctx=, pack=, dest=0x0) at main/pbo.c:240 #6 0x76cfc5c6 in _mesa_GetnPixelMapfvARB (map=3190, bufSize=2147483647, values=0x0) at main/pixel.c:360 #7 0x009a5bac in conform::ApiError::Test_NegativeglGetPixelMap() () #8 0x0098ce5e in conform::ApiError::RunSubcase(conform::ApiError::SubcaseInfo const*) () #9 0x0098cfa6 in ApiErrorTestExec(testParameters*) () #10 0x01090a29 in callFunctionHandleExceptionsInner(long (*)(testParameters*), testParameters*, char*) () #11 0x01090b5f in callFunctionHandleExceptions(long (*)(testParameters*), testParameters*) () #12 0x0108f691 in DriverExec(long (*)(testParameters*), testParameters*) () #13 0x01075367 in Driver(std::vector, std::allocator >, std::basic_string, std::allocator > >, std::allocator, std::allocator >, std::basic_string, std::allocator > > > > const&, std::vector > const&, std::vector, std::allocator > > const&, std::vector, std::allocator > > const&) () #14 0x01075718 in (anonymous namespace)::MyMessagePump::idle() () #15 0x01045220 in MessagePump::process_messages() () #16 0x0107623c in ExecutionManager::execute_schedules() () #17 0x0130 in tkShellExecute(std::vector, std::allocator >, std::basic_string, std::allocator > >, std::allocator, std::allocator >, std::basic_string, std::allocator > > > > const&, std::vector, std::allocator >, std::basic_string, std::allocator > >, std::allocator, std::allocator >, std::basic_string, std::allocator > > > > const&) () #18 0x01008c1b in main () Reproduce steps: 1. start X 2. ./oglconform -z -s -suite all -v 2 -D 122 -test api-error negative.glGetPixelMap -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/edid: Add support for extension blocks beyond the first
When 2 or more EDID extension blocks are present, segment must be selected prior to reading the extended EDID block over the DDC channel. Add support for this. Signed-off-by: Jean Delvare Cc: Adam Jackson --- This needs testing by someone with access to such a display. drivers/gpu/drm/drm_edid.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) --- linux-3.2-rc3.orig/drivers/gpu/drm/drm_edid.c 2011-11-09 15:53:31.0 +0100 +++ linux-3.2-rc3/drivers/gpu/drm/drm_edid.c2011-12-03 10:12:47.0 +0100 @@ -242,7 +242,8 @@ static int drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, int block, int len) { - unsigned char start = block * EDID_LENGTH; + unsigned char segment = block >> 1; + unsigned char start = (block & 0x01) * EDID_LENGTH; int ret, retries = 5; /* The core i2c driver will automatically retry the transfer if the @@ -254,6 +255,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter do { struct i2c_msg msgs[] = { { + .addr = DDC_SEGMENT_ADDR, + .flags = 0, + .len= 1, + .buf= &segment, + }, { .addr = DDC_ADDR, .flags = 0, .len= 1, @@ -265,7 +271,18 @@ drm_do_probe_ddc_edid(struct i2c_adapter .buf= buf, } }; - ret = i2c_transfer(adapter, msgs, 2); + + /* Don't write segment if it is 0, for compatibility */ + if (segment) { + ret = i2c_transfer(adapter, msgs, 3); + /* The E-DDC specification says that the first ack is +* optional, so retry in ignore-nak mode if we get no +* ack at first. +*/ + if (ret == -ENXIO) + msgs[0].flags |= I2C_M_IGNORE_NAK; + } else + ret = i2c_transfer(adapter, msgs + 1, 2); } while (ret != 2 && --retries); return ret == 2 ? 0 : -1; -- Jean Delvare Suse L3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: WARNING: at mm/slub.c:3357, kernel BUG at mm/slub.c:3413
On 02.12.11 21:48:20, Markus Trippelsdorf wrote: > BTW I always see (mostly only on screen, sometimes in the logs): > > [Firmware Bug]: cpu 2, try to use APIC500 (LVT offset 0) for vector 0x10400, > but the register is already in use for vector 0xf9 on another cpu > [Firmware Bug]: cpu 2, IBS interrupt offset 0 not available > (MSRC001103A=0x0100) > [Firmware Bug]: using offset 1 for IBS interrupts > [Firmware Bug]: workaround enabled for IBS LVT offset > perf: AMD IBS detected (0x001f) > > But I hope that it is only a harmless warning. > (perf Instruction-Based Sampling) Yes, the message always apears on AMD family 10h. Nothing to worry about. A patch is on the way to soften the message to not scare the people: http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=16e5294e5f8303756a179cf218e37dfb9ed34417 -Robert -- Advanced Micro Devices, Inc. Operating System Research Center ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Noise in games on Intel HD Graphics 2000
On Wed, 07 Dec 2011 19:42:22 +0100, Eric Anholt wrote: On Tue, 06 Dec 2011 22:59:58 +0100, semiRocket wrote: Hi, I'm running on Intel i3 2100 integrated graphics, I'm getting some strange noise particles in games like Minecraft and Speed Dreams (mostly noticeable in Minecraft) after playing a while, like half an hour. After that restarting game doesn't help, only computer restart have the effect of returning graphics to normal. Some screenshots bellow: Fix here: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=406478dc911e16677fbd9c84d1d50cdffbc031ab It seems to run fine now with kernel from fedora rawhide repo 3.2.0-0.rc4.git4.2.fc17.i686 Thank You! ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[patch] drm/ttm: fix condition (and vs or)
The "if (!p && !p->dev)" condition isn't right because || was intended instead of &&. But actually, "p" is the list cursor and so it's always non-NULL and we can just remove that bit. We can remove the another similar check as well. Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 6678abc..1cf4c2c 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -930,10 +930,8 @@ static int ttm_dma_pool_get_num_unused_pages(void) unsigned total = 0; mutex_lock(&_manager->lock); - list_for_each_entry(p, &_manager->pools, pools) { - if (p) - total += p->pool->npages_free; - } + list_for_each_entry(p, &_manager->pools, pools) + total += p->pool->npages_free; mutex_unlock(&_manager->lock); return total; } @@ -1023,7 +1021,7 @@ static int ttm_dma_pool_mm_shrink(struct shrinker *shrink, list_for_each_entry(p, &_manager->pools, pools) { unsigned nr_free; - if (!p && !p->dev) + if (!p->dev) continue; if (shrink_pages == 0) break; ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon/benchmark: common modes sweep ignores 640x480@32
From: Chen Jie Sweep common_modes array should start with index 0. Signed-off-by: Chen Jie --- drivers/gpu/drm/radeon/radeon_benchmark.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 17e1a9b..d1cea8d 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c @@ -229,21 +229,21 @@ void radeon_benchmark(struct radeon_device *rdev, int test_number) break; case 6: /* GTT to VRAM, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_GTT, RADEON_GEM_DOMAIN_VRAM); break; case 7: /* VRAM to GTT, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_VRAM, RADEON_GEM_DOMAIN_GTT); break; case 8: /* VRAM to VRAM, buffer size sweep, common modes */ - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) radeon_benchmark_move(rdev, common_modes[i], RADEON_GEM_DOMAIN_VRAM, RADEON_GEM_DOMAIN_VRAM); -- 1.7.7.3
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
Hi Arnd, Thanks for your review! On Mon, Dec 5, 2011 at 10:48 PM, Arnd Bergmann wrote: > On Friday 02 December 2011, Sumit Semwal wrote: >> This is the first step in defining a dma buffer sharing mechanism. > > This looks very nice, but there are a few things I don't understand yet > and a bunch of trivial comments I have about things I spotted. > > Do you have prototype exporter and consumer drivers that you can post > for clarification? > > In the patch 2, you have a section about migration that mentions that > it is possible to export a buffer that can be migrated after it > is already mapped into one user driver. How does that work when > the physical addresses are mapped into a consumer device already? I guess I need to clear it up in the documentation - when I said "once all ongoing access is completed" - I meant to say "once all current users have finished accessing and have unmapped this buffer". So I agree with Rob - the migration would only be possible for "attached but unmapped" buffers. I will update the documentation. > >> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig >> index 21cf46f..07d8095 100644 >> --- a/drivers/base/Kconfig >> +++ b/drivers/base/Kconfig >> @@ -174,4 +174,14 @@ config SYS_HYPERVISOR >> >> ?source "drivers/base/regmap/Kconfig" >> >> +config DMA_SHARED_BUFFER >> + ? ? bool "Buffer framework to be shared between drivers" >> + ? ? default n >> + ? ? depends on ANON_INODES > > I would make this 'select ANON_INODES', like the other users of this > feature. Sure. > >> + ? ? return dmabuf; >> +} >> +EXPORT_SYMBOL(dma_buf_export); > > I agree with Konrad, this should definitely be EXPORT_SYMBOL_GPL, > because it's really a low-level function that I would expect > to get used by in-kernel subsystems providing the feature to > users and having back-end drivers, but it's not the kind of thing > we want out-of-tree drivers to mess with. Agreed. > >> +/** >> + * dma_buf_fd - returns a file descriptor for the given dma_buf >> + * @dmabuf: ?[in] ? ?pointer to dma_buf for which fd is required. >> + * >> + * On success, returns an associated 'fd'. Else, returns error. >> + */ >> +int dma_buf_fd(struct dma_buf *dmabuf) >> +{ >> + ? ? int error, fd; >> + >> + ? ? if (!dmabuf->file) >> + ? ? ? ? ? ? return -EINVAL; >> + >> + ? ? error = get_unused_fd_flags(0); > > Why not simply get_unused_fd()? :) oversight. Will correct. > >> +/** >> + * dma_buf_attach - Add the device to dma_buf's attachments list; >> optionally, >> + * calls attach() of dma_buf_ops to allow device-specific attach >> functionality >> + * @dmabuf: ?[in] ? ?buffer to attach device to. >> + * @dev: ? ? [in] ? ?device to be attached. >> + * >> + * Returns struct dma_buf_attachment * for this attachment; may return NULL. >> + * > > Or may return a negative error code. It's better to be consistent here: > either always return NULL on error, or change the allocation error to > ERR_PTR(-ENOMEM). Ok, that makes sense. > >> + */ >> +struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct device *dev) >> +{ >> + ? ? struct dma_buf_attachment *attach; >> + ? ? int ret; >> + >> + ? ? BUG_ON(!dmabuf || !dev); >> + >> + ? ? attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL); >> + ? ? if (attach == NULL) >> + ? ? ? ? ? ? goto err_alloc; >> + >> + ? ? mutex_lock(&dmabuf->lock); >> + >> + ? ? attach->dev = dev; >> + ? ? attach->dmabuf = dmabuf; >> + ? ? if (dmabuf->ops->attach) { >> + ? ? ? ? ? ? ret = dmabuf->ops->attach(dmabuf, dev, attach); >> + ? ? ? ? ? ? if (!ret) >> + ? ? ? ? ? ? ? ? ? ? goto err_attach; > > You probably mean "if (ret)" here instead of "if (!ret)", right? yes - a stupid one! will correct. > >> + ? ? /* allow allocator to take care of cache ops */ >> + ? ? void (*sync_sg_for_cpu) (struct dma_buf *, struct device *); >> + ? ? void (*sync_sg_for_device)(struct dma_buf *, struct device *); > > I don't see how this works with multiple consumers: For the streaming > DMA mapping, there must be exactly one owner, either the device or > the CPU. Obviously, this rule needs to be extended when you get to > multiple devices and multiple device drivers, plus possibly user > mappings. Simply assigning the buffer to "the device" from one > driver does not block other drivers from touching the buffer, and > assigning it to "the cpu" does not stop other hardware that the > code calling sync_sg_for_cpu is not aware of. > > The only way to solve this that I can think of right now is to > mandate that the mappings are all coherent (i.e. noncachable > on noncoherent architectures like ARM). If you do that, you no > longer need the sync_sg_for_* calls. I will take yours and Daniel's suggestion, and remove these; if at all they're needed, we can add them back again later, with /s/device/attachment as suggested by Daniel. > >> +#ifdef CONFIG_DMA_SHARED_BUFFER > > Do you have a use case for making the interface compile-time disabled? > I had as
[git pull] drm fixes
> So having looked at the patch itself, I don't dislike the notion of > making sure certain fields are nicely initialized. So I don't hate the > patch itself, but quite frankly, to me it doesn't smell even > *remotely* like "regression fix". I don't think this is something that > has ever worked. Well just for completeness I tracked it down to 724c80e1d630296d1324859e964d80d35007d83c which git describe shows as v2.6.36-rc5-456-g724c80e, so while it is a technical regression, it took a long time for anyone to notice. I think we probably need a more invasive patch in any case, as there is still a race between when the drm midlayer calls pci_set_master and the sanity enforcement, which we should close by moving pci_set_master into the drivers (midlayer design yet again for the win). so I'll leave it for -next. Dave.
[PATCH 0/2] omap/drm: dmm/tiler support for GEM buffers
Hi, On Mon, 2011-12-05 at 19:19 -0600, Rob Clark wrote: > From: Rob Clark > > Support for DMM and tiled buffers. The DMM/TILER block in omap4+ SoC > provides support for remapping physically discontiguous buffers for > various DMA initiators (DSS, IVAHD, etc) which do not otherwise support > non-physically contiguous buffers, as well as providing support for > tiled buffers. > > See the descriptions in the following two patches for more details. Why is the tiler/dmm driver integrated into the drm driver? Tomi -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20111207/b21a02a6/attachment.pgp>
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > > > > Do you have a use case for making the interface compile-time disabled? > > I had assumed that any code using it would make no sense if it's not > > available so you don't actually need this. > > Ok. Though if we keep the interface compile-time disabled, the users > can actually check and fail or fall-back gracefully when the API is > not available; If I remove it, anyways the users would need to do the > same compile time check whether API is available or not, right? If you have to do a compile-time check for the config symbol, it's better to do it the way you did here than in the caller. My guess was that no caller would actually require this, because when you write a part of a subsystem to interact with the dma-buf infrastructure, you would always disable compilation of an extire file that deals with everything related to struct dma_buf, not just stub out the calls. Arnd
[git pull] drm fixes the reduced version
Hi Linus, Okay the 2 non-kexec fixes + one of the calloc changes as by looking at it, there was nothing stopping userspace for abusing the integer overflow on these ioctls. The other calloc changes either were kernel internal or had other things stopping userspace from exploiting them. Dave. The following changes since commit 45e713efe2fa574b6662e7fb63fae9497c5e03d4: Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2011-12-05 16:54:15 -0800) are available in the git repository at: git://people.freedesktop.org/~airlied/linux drm-fixes Alex Deucher (1): drm/radeon/kms: fix return type for radeon_encoder_get_dp_bridge_encoder_id Daniel Vetter (1): drm/i915: fix infinite recursion on unbind due to ilk vt-d w/a Thomas Meyer (1): vmwgfx: Use kcalloc instead of kzalloc to allocate array drivers/gpu/drm/i915/i915_gem.c |7 ++- drivers/gpu/drm/radeon/radeon_encoders.c |7 +++ drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c|4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-)
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wed, Dec 7, 2011 at 3:41 PM, Arnd Bergmann wrote: > On Wednesday 07 December 2011, Semwal, Sumit wrote: >> > >> > Do you have a use case for making the interface compile-time disabled? >> > I had assumed that any code using it would make no sense if it's not >> > available so you don't actually need this. >> >> Ok. Though if we keep the interface compile-time disabled, the users >> can actually check and fail or fall-back gracefully when the API is >> not available; If I remove it, anyways the users would need to do the >> same compile time check whether API is available or not, right? > > If you have to do a compile-time check for the config symbol, it's better > to do it the way you did here than in the caller. > > My guess was that no caller would actually require this, because when you > write a part of a subsystem to interact with the dma-buf infrastructure, > you would always disable compilation of an extire file that deals with > everything related to struct dma_buf, not just stub out the calls. Right; that would be ideal, but we may not be able to ask each user to do so - especially when the sharing part might be interspersed in existing buffer handling code. So for now, I would like to keep it as it-is. > > ? ? ? ?Arnd > BR, ~Sumit. > --
[Bug 43395] Game running in wine stops rendering
https://bugs.freedesktop.org/show_bug.cgi?id=43395 --- Comment #12 from Michel D?nzer 2011-12-07 03:17:11 UTC --- Does setting the environment variable vblank_mode=0 for the Wine process using OpenGL work around the problem? There should be a message ATTENTION: default value of option vblank_mode overridden by environment. on stderr to confirm it takes effect. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > Right; that would be ideal, but we may not be able to ask each user to > do so - especially when the sharing part might be interspersed in > existing buffer handling code. So for now, I would like to keep it as > it-is. Ok, fair enough. It certainly doesn't hurt. Arnd
Request for fixing atombios_get_encoder_mode
In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. -- Rafa? -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ -- ___ Dri-devel mailing list Dri-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Request for fixing atombios_get_encoder_mode
In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. -- Rafa?
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
Hi Daniel, Rob, On Tue, Dec 6, 2011 at 3:41 AM, Rob Clark wrote: > On Mon, Dec 5, 2011 at 3:23 PM, Daniel Vetter wrote: >> On Mon, Dec 05, 2011 at 02:46:47PM -0600, Rob Clark wrote: >>> On Mon, Dec 5, 2011 at 11:18 AM, Arnd Bergmann wrote: >>> > In the patch 2, you have a section about migration that mentions that >>> > it is possible to export a buffer that can be migrated after it >>> > is already mapped into one user driver. How does that work when >>> > the physical addresses are mapped into a consumer device already? >>> >>> I think you can do physical migration if you are attached, but >>> probably not if you are mapped. >> >> Yeah, that's very much how I see this, and also why map/unmap (at least >> for simple users like v4l) should only bracket actual usage. GPU memory >> managers need to be able to move around buffers while no one is using >> them. >> >> [snip] >> >>> >> + ? ? /* allow allocator to take care of cache ops */ >>> >> + ? ? void (*sync_sg_for_cpu) (struct dma_buf *, struct device *); >>> >> + ? ? void (*sync_sg_for_device)(struct dma_buf *, struct device *); >>> > >>> > I don't see how this works with multiple consumers: For the streaming >>> > DMA mapping, there must be exactly one owner, either the device or >>> > the CPU. Obviously, this rule needs to be extended when you get to >>> > multiple devices and multiple device drivers, plus possibly user >>> > mappings. Simply assigning the buffer to "the device" from one >>> > driver does not block other drivers from touching the buffer, and >>> > assigning it to "the cpu" does not stop other hardware that the >>> > code calling sync_sg_for_cpu is not aware of. >>> > >>> > The only way to solve this that I can think of right now is to >>> > mandate that the mappings are all coherent (i.e. noncachable >>> > on noncoherent architectures like ARM). If you do that, you no >>> > longer need the sync_sg_for_* calls. >>> >>> My original thinking was that you either need DMABUF_CPU_{PREP,FINI} >>> ioctls and corresponding dmabuf ops, which userspace is required to >>> call before / after CPU access. ?Or just remove mmap() and do the >>> mmap() via allocating device and use that device's equivalent >>> DRM_XYZ_GEM_CPU_{PREP,FINI} or DRM_XYZ_GEM_SET_DOMAIN ioctls. ?That >>> would give you a way to (a) synchronize with gpu/asynchronous >>> pipeline, (b) synchronize w/ multiple hw devices vs cpu accessing >>> buffer (ie. wait all devices have dma_buf_unmap_attachment'd). ?And >>> that gives you a convenient place to do cache operations on >>> noncoherent architecture. >>> >>> I sort of preferred having the DMABUF shim because that lets you pass >>> a buffer around userspace without the receiving code knowing about a >>> device specific API. ?But the problem I eventually came around to: if >>> your GL stack (or some other userspace component) is batching up >>> commands before submission to kernel, the buffers you need to wait for >>> completion might not even be submitted yet. ?So from kernel >>> perspective they are "ready" for cpu access. ?Even though in fact they >>> are not in a consistent state from rendering perspective. ?I don't >>> really know a sane way to deal with that. ?Maybe the approach instead >>> should be a userspace level API (in libkms/libdrm?) to provide >>> abstraction for userspace access to buffers rather than dealing with >>> this at the kernel level. >> >> Well, there's a reason GL has an explicit flush and extensions for sync >> objects. It's to support such scenarios where the driver batches up gpu >> commands before actually submitting them. > > Hmm.. what about other non-GL APIs.. ?maybe vaapi/vdpau or similar? > (Or something that I haven't thought of.) > >> Also, recent gpus have all (or >> shortly will grow) multiple execution pipelines, so it's also important >> that you sync up with the right command stream. Syncing up with all of >> them is generally frowned upon for obvious reasons ;-) > > Well, I guess I am happy enough with something that is at least > functional. ?Usespace access would (I think) mainly be weird edge case > type stuff. ?But... > > >> On the topic of a coherency model for dmabuf, I think we need to look at >> dma_buf_attachment_map/unmap (and also the mmap variants cpu_start and >> cpu_finish or whatever they might get called) as barriers: >> >> So after a dma_buf_map, all previsously completed dma operations (i.e. >> unmap already called) and any cpu writes (i.e. cpu_finish called) will be >> coherent. Similar rule holds for cpu access through the userspace mmap, >> only writes completed before the cpu_start will show up. >> >> Similar, writes done by the device are only guaranteed to show up after >> the _unmap. Dito for cpu writes and cpu_finish. >> >> In short we always need two function calls to denote the start/end of the >> "critical section". > > Yup, this was exactly my assumption. ?But I guess it is better to spell it > out. Thanks for the excellent discussion - it indeed is ve
[PATCH 0/2] omap/drm: dmm/tiler support for GEM buffers
On Wed, Dec 7, 2011 at 3:31 AM, Tomi Valkeinen wrote: > Hi, > > On Mon, 2011-12-05 at 19:19 -0600, Rob Clark wrote: >> From: Rob Clark >> >> Support for DMM and tiled buffers. ?The DMM/TILER block in omap4+ SoC >> provides support for remapping physically discontiguous buffers for >> various DMA initiators (DSS, IVAHD, etc) which do not otherwise support >> non-physically contiguous buffers, as well as providing support for >> tiled buffers. >> >> See the descriptions in the following two patches for more details. > > Why is the tiler/dmm driver integrated into the drm driver? Basically because of a big list of reasons to keep it integrated, and no good reason that I could think of to make it a standalone driver. 1) Because the function/usage is most like a GTT in other systems.. the usage is really graphics/multimedia related so GEM is a natural way to expose it to userspace. Other places we want to use tiler buffers, like camera, are neatly handled by using dmabuf to export the GEM buffer to a different device. 2) We went down the separate driver path in the past, and it really exposes a lot of problems. See the hacks that were done in the past to get wakeup/resume sequencing correct when tiler was a separate driver. (hint: the table of page addresses needs to be reprogrammed before any access to buffer mapped in DMM is done.. this can be accomplished quite simply by restoring the LUT before enabling any video pipes when it is in a single driver... although that is still in the TODO) 3) Doing some of the more advanced stuff, like page flipping using DMM's synchronized refill to update page addresses synchronized with scannout will, I think, end up being some kinda weird API.. I don't think I'd want to make that a public API exported by one driver consumed by another, but not such a problem if it is just something used internally by one driver. 4) The LUT isn't really big enough to be managed statically like we did in the past.. it needs to be managed dynamically, mapping and evicting buffers. This is something that is typical with other gfx drivers in their management of their GTT.. 5) I wouldn't really want to duplicate the userspace mmap'ing games for 2d buffers in a lot of different drivers. The code is structured such that it could be separated in the future, if there is any good reason too. But so far I've been unable to think of one. BR, -R > ?Tomi > > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >
drm/ttm: callback move_notify any time bo placement
change v4 Hello Jerome Glisse, This is a semi-automatic email about new static checker warnings. The patch dc97b3409a79: "drm/ttm: callback move_notify any time bo placement change v4" from Nov 18, 2011, leads to the following Smatch complaint: drivers/gpu/drm/nouveau/nouveau_bo.c +818 nouveau_bo_move_ntfy() warn: variable dereferenced before check 'new_mem' (see line 813) drivers/gpu/drm/nouveau/nouveau_bo.c 812 { 813 struct nouveau_mem *node = new_mem->mm_node; Old dereference. new_mem can be NULL here these days. 814 struct nouveau_bo *nvbo = nouveau_bo(bo); 815 struct nouveau_vma *vma; 816 817 list_for_each_entry(vma, &nvbo->vma_list, head) { 818 if (new_mem && new_mem->mem_type == TTM_PL_VRAM) { ^^^ new check. 819 nouveau_vm_map(vma, new_mem->mm_node); 820 } else regards, dan carpenter
[mipsel+rs780e]Occasionally "GPU lockup" after resuming from suspend.
When "MC timeout" happens at GPU reset, we found the 12th and 13th bits of R_000E50_SRBM_STATUS is 1. From kernel code we found these two bits are like this: #define G_000E50_MCDX_BUSY(x) (((x) >> 12) & 1) #define G_000E50_MCDW_BUSY(x) (((x) >> 13) & 1) Could you please tell me what does they mean? And if possible, I want to know the functionalities of these 5 registers in detail: #define R_000E60_SRBM_SOFT_RESET 0x0E60 #define R_000E50_SRBM_STATUS 0x0E50 #define R_008020_GRBM_SOFT_RESET0x8020 #define R_008010_GRBM_STATUS0x8010 #define R_008014_GRBM_STATUS2 0x8014 A bit more info: If I reset the MC after resetting CP (this is what Linux-2.6.34 does, but removed since 2.6.35), then "MC timeout" will disappear, but there is still "ring test failed". Huacai Chen > 2011/11/8 : >> And, I want to know something: >> 1, Does GPU use MC to access GTT? > > Yes. All GPU clients (display, 3D, etc.) go through the MC to access > memory (vram or gart). > >> 2, What can cause MC timeout? > > Lots of things. Some GPU client still active, some GPU client hung or > not properly initialized. > > Alex > >> >>> Hi, >>> >>> Some status update. >>> ? 2011?9?29? ??5:17?Chen Jie ??? Hi, Add more information. We got occasionally "GPU lockup" after resuming from suspend(on mipsel platform with a mips64 compatible CPU and rs780e, the kernel is 3.1.0-rc8 64bit). Related kernel message: /* return from STR */ [ 156.152343] radeon :01:05.0: WB enabled [ 156.187500] [drm] ring test succeeded in 0 usecs [ 156.187500] [drm] ib test succeeded in 0 usecs [ 156.398437] ata2: SATA link down (SStatus 0 SControl 300) [ 156.398437] ata3: SATA link down (SStatus 0 SControl 300) [ 156.398437] ata4: SATA link down (SStatus 0 SControl 300) [ 156.578125] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 156.597656] ata1.00: configured for UDMA/133 [ 156.613281] usb 1-5: reset high speed USB device number 4 using ehci_hcd [ 157.027343] usb 3-2: reset low speed USB device number 2 using ohci_hcd [ 157.609375] usb 3-3: reset low speed USB device number 3 using ohci_hcd [ 157.683593] r8169 :02:00.0: eth0: link up [ 165.621093] PM: resume of devices complete after 9679.556 msecs [ 165.628906] Restarting tasks ... done. [ 177.085937] radeon :01:05.0: GPU lockup CP stall for more than 10019msec [ 177.089843] [ cut here ] [ 177.097656] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:267 radeon_fence_wait+0x25c/0x33c() [ 177.105468] GPU lockup (waiting for 0x13C3 last fence id 0x13AD) [ 177.113281] Modules linked in: psmouse serio_raw [ 177.117187] Call Trace: [ 177.121093] [] dump_stack+0x8/0x34 [ 177.125000] [] warn_slowpath_common+0x78/0xa0 [ 177.132812] [] warn_slowpath_fmt+0x38/0x44 [ 177.136718] [] radeon_fence_wait+0x25c/0x33c [ 177.144531] [] ttm_bo_wait+0x108/0x220 [ 177.148437] [] radeon_gem_wait_idle_ioctl+0x80/0x114 [ 177.156250] [] drm_ioctl+0x2e4/0x3fc [ 177.160156] [] radeon_kms_compat_ioctl+0x28/0x38 [ 177.167968] [] compat_sys_ioctl+0x120/0x35c [ 177.171875] [] handle_sys+0x118/0x138 [ 177.179687] ---[ end trace 92f63d998efe4c6d ]--- [ 177.187500] radeon :01:05.0: GPU softreset [ 177.191406] radeon :01:05.0: R_008010_GRBM_STATUS=0xF57C2030 [ 177.195312] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 [ 177.203125] radeon :01:05.0: R_000E50_SRBM_STATUS=0x20023040 [ 177.363281] radeon :01:05.0: Wait for MC idle timedout ! [ 177.367187] radeon :01:05.0: R_008020_GRBM_SOFT_RESET=0x7FEE [ 177.390625] radeon :01:05.0: R_008020_GRBM_SOFT_RESET=0x0001 [ 177.414062] radeon :01:05.0: R_008010_GRBM_STATUS=0xA0003030 [ 177.417968] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 [ 177.425781] radeon :01:05.0: R_000E50_SRBM_STATUS=0x2002B040 [ 177.433593] radeon :01:05.0: GPU reset succeed [ 177.605468] radeon :01:05.0: Wait for MC idle timedout ! [ 177.761718] radeon :01:05.0: Wait for MC idle timedout ! [ 177.804687] radeon :01:05.0: WB enabled [ 178.00] [drm:r600_ring_test] *ERROR* radeon: ring test failed (scratch(0x8504)=0xCAFEDEAD) >>> After pinned ring in VRAM, it warned an ib test failure. It seems >>> something wrong with accessing through GTT. >>> >>> We dump gart table just after stopped cp, and compare gart table with >>> the dumped one just after r600_pcie_gart_enable, and don't find any >>> difference. >>> >>> Any idea? >>> [ 178.007812] [drm:r600_resume] *ERROR* r600 startup failed on resume [
[RFC v2 1/2] dma-buf: Introduce dma buffer sharing mechanism
On Wednesday 07 December 2011, Semwal, Sumit wrote: > Thanks for the excellent discussion - it indeed is very good learning > for the relatively-inexperienced me :) > > So, for the purpose of dma-buf framework, could I summarize the > following and rework accordingly?: > 1. remove mmap() dma_buf_op [and mmap fop], and introduce cpu_start(), > cpu_finish() ops to bracket cpu accesses to the buffer. Also add > DMABUF_CPU_START / DMABUF_CPU_FINI IOCTLs? I think we'd be better off for now without the extra ioctls and just document that a shared buffer must not be exported to user space using mmap at all, to avoid those problems. Serialization between GPU and CPU is on a higher level than the dma_buf framework IMHO. > 2. remove sg_sync* ops for now (and we'll see if we need to add them > later if needed) Just removing the sg_sync_* operations is not enough. We have to make the decision whether we want to allow a) only coherent mappings of the buffer into kernel memory (requiring an extension to the dma_map_ops on ARM to not flush caches at map/unmap time) b) not allowing any in-kernel mappings (same requirement on ARM, also limits the usefulness of the dma_buf if we cannot access it from the kernel or from user space) c) only allowing streaming mappings, even if those are non-coherent (requiring strict serialization between CPU (in-kernel) and dma users of the buffer) This issue has to be solved or we get random data corruption. Arnd
[PATCH] drm/radeon/benchmark: common modes sweep ignores 640x480@32
Right. The goof is a consequence of me doing copy-and-paste style edits. I first added powers-of-two benchmark which intentionally start from index 1 but and then copied and edited that into comon-modes benchmark, and missed to correct the starting index of the loop. Reviewed-by: Ilija Hadzic On Wed, 7 Dec 2011 chenj at lemote.com wrote: > From: Chen Jie > > Sweep common_modes array should start with index 0. > > Signed-off-by: Chen Jie > --- > drivers/gpu/drm/radeon/radeon_benchmark.c |6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c > b/drivers/gpu/drm/radeon/radeon_benchmark.c > index 17e1a9b..d1cea8d 100644 > --- a/drivers/gpu/drm/radeon/radeon_benchmark.c > +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c > @@ -229,21 +229,21 @@ void radeon_benchmark(struct radeon_device *rdev, int > test_number) > break; > case 6: > /* GTT to VRAM, buffer size sweep, common modes */ > - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > radeon_benchmark_move(rdev, common_modes[i], > RADEON_GEM_DOMAIN_GTT, > RADEON_GEM_DOMAIN_VRAM); > break; > case 7: > /* VRAM to GTT, buffer size sweep, common modes */ > - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > radeon_benchmark_move(rdev, common_modes[i], > RADEON_GEM_DOMAIN_VRAM, > RADEON_GEM_DOMAIN_GTT); > break; > case 8: > /* VRAM to VRAM, buffer size sweep, common modes */ > - for (i = 1; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > + for (i = 0; i < RADEON_BENCHMARK_COMMON_MODES_N; i++) > radeon_benchmark_move(rdev, common_modes[i], > RADEON_GEM_DOMAIN_VRAM, > RADEON_GEM_DOMAIN_VRAM); > -- > 1.7.7.3 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >
Request for fixing atombios_get_encoder_mode
2011/12/7 Rafa? Mi?ecki : > In theory function atombios_get_encoder_mode should report > ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report > ATOM_ENCODER_MODE_DVI if card is DCE4. > > Is there any reason for it? Can we just drop that DCE4 condition? This > fixme seems to be here since ever. > It causes display corruption unless the hdmi packet engine is set up properly. Alex > -- > Rafa? >
[PATCH 00/23] kill drm cruft with fire
> > >> Testing this on via would be awesome! Iirc I haven't changed anything in > > >> the via specific patches, but if it's more convenient you can also > > >> directly test my branch: > > >> > > >> http://cgit.freedesktop.org/~danvet/drm/log/?h=kill-with-fire > > > > > > Okay I tried the patches and it locked up the openchrome X server. I'm > > > going to try your branch tonight to see if it makes any difference. If it > > > still fails I will have to track down what the problem is. > > > > If you can bisect the issue, that would be awesome. Meanwhile my sis > > card arrived, so I'm hopefully get around to test that part of the > > series rsn. I'm traveling atm though, so response time will suffer a > > bit. > > Any updates on testing results? Yes I do. I'm using the patches you posted. Patches 1 to 10 work with no problems. Ist patch 11 that breaks the openchrome xorg driver. Have to do some digging to find the exact problem.
[mipsel+rs780e]Occasionally "GPU lockup" after resuming from suspend.
2011/12/7 : > When "MC timeout" happens at GPU reset, we found the 12th and 13th > bits of R_000E50_SRBM_STATUS is 1. From kernel code we found these > two bits are like this: > #define G_000E50_MCDX_BUSY(x) (((x) >> 12) & 1) > #define G_000E50_MCDW_BUSY(x) (((x) >> 13) & 1) > > Could you please tell me what does they mean? And if possible, They refer to sub-blocks in the memory controller. I don't really know off hand what the name mean. > I want to know the functionalities of these 5 registers in detail: > #define R_000E60_SRBM_SOFT_RESET 0x0E60 > #define R_000E50_SRBM_STATUS 0x0E50 > #define R_008020_GRBM_SOFT_RESET0x8020 > #define R_008010_GRBM_STATUS0x8010 > #define R_008014_GRBM_STATUS2 0x8014 > > A bit more info: If I reset the MC after resetting CP (this is what > Linux-2.6.34 does, but removed since 2.6.35), then "MC timeout" will > disappear, but there is still "ring test failed". The bits are defined in r600d.h. As to the acronyms: BIF - Bus InterFace CG - clocks DC - Display Controller GRBM - Graphics block (3D engine) HDP - Host Data Path (CPU access to vram via the PCI BAR) IH, RLC - Interrupt controller MC - Memory controller ROM - ROM SEM - semaphore controller When you reset the MC, you will probably have to reset just about everything else since most blocks depend on the MC for access to memory. If you do reset the MC, you should do it at prior to calling asic_init so you make sure all the hw gets re-initialized properly. Additionally, you should probably reset the GRBM either via SRBM_SOFT_RESET or the individual sub-blocks via GRBM_SOFT_RESET. Alex > > Huacai Chen > >> 2011/11/8 : >>> And, I want to know something: >>> 1, Does GPU use MC to access GTT? >> >> Yes. All GPU clients (display, 3D, etc.) go through the MC to access >> memory (vram or gart). >> >>> 2, What can cause MC timeout? >> >> Lots of things. Some GPU client still active, some GPU client hung or >> not properly initialized. >> >> Alex >> >>> Hi, Some status update. ? 2011?9?29? ??5:17?Chen Jie ??? > Hi, > Add more information. > We got occasionally "GPU lockup" after resuming from suspend(on mipsel > platform with a mips64 compatible CPU and rs780e, the kernel is > 3.1.0-rc8 > 64bit). Related kernel message: > /* return from STR */ > [ 156.152343] radeon :01:05.0: WB enabled > [ 156.187500] [drm] ring test succeeded in 0 usecs > [ 156.187500] [drm] ib test succeeded in 0 usecs > [ 156.398437] ata2: SATA link down (SStatus 0 SControl 300) > [ 156.398437] ata3: SATA link down (SStatus 0 SControl 300) > [ 156.398437] ata4: SATA link down (SStatus 0 SControl 300) > [ 156.578125] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > [ 156.597656] ata1.00: configured for UDMA/133 > [ 156.613281] usb 1-5: reset high speed USB device number 4 using > ehci_hcd > [ 157.027343] usb 3-2: reset low speed USB device number 2 using > ohci_hcd > [ 157.609375] usb 3-3: reset low speed USB device number 3 using > ohci_hcd > [ 157.683593] r8169 :02:00.0: eth0: link up > [ 165.621093] PM: resume of devices complete after 9679.556 msecs > [ 165.628906] Restarting tasks ... done. > [ 177.085937] radeon :01:05.0: GPU lockup CP stall for more than > 10019msec > [ 177.089843] [ cut here ] > [ 177.097656] WARNING: at drivers/gpu/drm/radeon/radeon_fence.c:267 > radeon_fence_wait+0x25c/0x33c() > [ 177.105468] GPU lockup (waiting for 0x13C3 last fence id > 0x13AD) > [ 177.113281] Modules linked in: psmouse serio_raw > [ 177.117187] Call Trace: > [ 177.121093] [] dump_stack+0x8/0x34 > [ 177.125000] [] warn_slowpath_common+0x78/0xa0 > [ 177.132812] [] warn_slowpath_fmt+0x38/0x44 > [ 177.136718] [] radeon_fence_wait+0x25c/0x33c > [ 177.144531] [] ttm_bo_wait+0x108/0x220 > [ 177.148437] [] > radeon_gem_wait_idle_ioctl+0x80/0x114 > [ 177.156250] [] drm_ioctl+0x2e4/0x3fc > [ 177.160156] [] radeon_kms_compat_ioctl+0x28/0x38 > [ 177.167968] [] compat_sys_ioctl+0x120/0x35c > [ 177.171875] [] handle_sys+0x118/0x138 > [ 177.179687] ---[ end trace 92f63d998efe4c6d ]--- > [ 177.187500] radeon :01:05.0: GPU softreset > [ 177.191406] radeon :01:05.0: R_008010_GRBM_STATUS=0xF57C2030 > [ 177.195312] radeon :01:05.0: R_008014_GRBM_STATUS2=0x0003 > [ 177.203125] radeon :01:05.0: R_000E50_SRBM_STATUS=0x20023040 > [ 177.363281] radeon :01:05.0: Wait for MC idle timedout ! > [ 177.367187] radeon :01:05.0: > R_008020_GRBM_SOFT_RESET=0x7FEE > [ 177.390625] radeon :01:05.0: > R_008020_GRBM_SOFT_RESET=0x0001 > [ 177.414062] radeon :01:05.0: R_0080
Request for fixing atombios_get_encoder_mode
W dniu 7 grudnia 2011 14:53 u?ytkownik Alex Deucher napisa?: > 2011/12/7 Rafa? Mi?ecki : >> In theory function atombios_get_encoder_mode should report >> ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report >> ATOM_ENCODER_MODE_DVI if card is DCE4. >> >> Is there any reason for it? Can we just drop that DCE4 condition? This >> fixme seems to be here since ever. >> > > It causes display corruption unless the hdmi packet engine is set up properly. Even with radeon.audio=0? -- Rafa?
WARNING: at mm/slub.c:3357, kernel BUG at mm/slub.c:3413
On 2011.12.07 at 15:32 +0100, Robert Richter wrote: > On 02.12.11 21:48:20, Markus Trippelsdorf wrote: > > BTW I always see (mostly only on screen, sometimes in the logs): > > > > [Firmware Bug]: cpu 2, try to use APIC500 (LVT offset 0) for vector > > 0x10400, but the register is already in use for vector 0xf9 on another cpu > > [Firmware Bug]: cpu 2, IBS interrupt offset 0 not available > > (MSRC001103A=0x0100) > > [Firmware Bug]: using offset 1 for IBS interrupts > > [Firmware Bug]: workaround enabled for IBS LVT offset > > perf: AMD IBS detected (0x001f) > > > > But I hope that it is only a harmless warning. > > (perf Instruction-Based Sampling) > > Yes, the message always apears on AMD family 10h. Nothing to worry > about. > > A patch is on the way to soften the message to not scare the people: > > > http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=16e5294e5f8303756a179cf218e37dfb9ed34417 Thanks. It's already in mainline and the message is gone now. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=16e5294e5f8303756a179cf218e37dfb9ed34417 -- Markus
Request for fixing atombios_get_encoder_mode
2011/12/7 Rafa? Mi?ecki : > W dniu 7 grudnia 2011 14:53 u?ytkownik Alex Deucher > napisa?: >> 2011/12/7 Rafa? Mi?ecki : >>> In theory function atombios_get_encoder_mode should report >>> ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report >>> ATOM_ENCODER_MODE_DVI if card is DCE4. >>> >>> Is there any reason for it? Can we just drop that DCE4 condition? This >>> fixme seems to be here since ever. >>> >> >> It causes display corruption unless the hdmi packet engine is set up >> properly. > > Even with radeon.audio=0? No, as in that case, DVI is returned. On DCE3.0 and newer chips there is no explicit hdmi engine enable bit. You just select HDMI mode rather than DVI mode in the digital encoder setup. So if you select HDMI in the encoder setup and you have not configured the hdmi engine correctly you will git display corruption or a blank screen. Which is why I had to disable audio by default. Since audio is off by default, the DCE4 conditional in the hdmi case could be removed. Alex > > -- > Rafa? >
Request for fixing atombios_get_encoder_mode
W dniu 7 grudnia 2011 15:53 u?ytkownik Alex Deucher napisa?: > 2011/12/7 Rafa? Mi?ecki : >> W dniu 7 grudnia 2011 14:53 u?ytkownik Alex Deucher >> napisa?: >>> 2011/12/7 Rafa? Mi?ecki : In theory function atombios_get_encoder_mode should report ATOM_ENCODER_MODE_HDMI when TV supports audio. Current we report ATOM_ENCODER_MODE_DVI if card is DCE4. Is there any reason for it? Can we just drop that DCE4 condition? This fixme seems to be here since ever. >>> >>> It causes display corruption unless the hdmi packet engine is set up >>> properly. >> >> Even with radeon.audio=0? > > No, as in that case, DVI is returned. ?On DCE3.0 and newer chips there > is no explicit hdmi engine enable bit. ?You just select HDMI mode > rather than DVI mode in the digital encoder setup. ?So if you select > HDMI in the encoder setup and you have not configured the hdmi engine > correctly you will git display corruption or a blank screen. ?Which is > why I had to disable audio by default. ?Since audio is off by default, > the DCE4 conditional in the hdmi case could be removed. OK, it makes sense, thanks. Btw I believe there *is* HDMI enabling bit on DCE3+, we probably just don't need to poke it manually :) It is bit 0x1000 in registers 0x7000, 0x7c00, 0x10800, 0x11400, 0x12000, 0x12c00 All my HDMI frames are ignored without that bit set. -- Rafa?
[PATCH 02/23] drm/via: track obj->drm_fd relations in the driver
> Exactly like the previous patch for sis. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons Same goes for PATCH 01 which I'm missing in my inbox. > --- > drivers/gpu/drm/via/via_drv.c | 25 + > drivers/gpu/drm/via/via_mm.c | 22 ++ > include/drm/via_drm.h |4 > 3 files changed, 43 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c > index 920a552..472adcf 100644 > --- a/drivers/gpu/drm/via/via_drv.c > +++ b/drivers/gpu/drm/via/via_drv.c > @@ -28,6 +28,29 @@ > > #include "drm_pciids.h" > > +static int via_driver_open(struct drm_device *dev, struct drm_file *file) > +{ > + struct via_file_private *file_priv; > + > + DRM_DEBUG_DRIVER("\n"); > + file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL); > + if (!file_priv) > + return -ENOMEM; > + > + file->driver_priv = file_priv; > + > + INIT_LIST_HEAD(&file_priv->obj_list); > + > + return 0; > +} > + > +void via_driver_postclose(struct drm_device *dev, struct drm_file *file) > +{ > + struct via_file_private *file_priv = file->driver_priv; > + > + kfree(file_priv); > +} > + > static struct pci_device_id pciidlist[] = { > viadrv_PCI_IDS > }; > @@ -38,6 +61,8 @@ static struct drm_driver driver = { > DRIVER_IRQ_SHARED, > .load = via_driver_load, > .unload = via_driver_unload, > + .open = via_driver_open, > + .postclose = via_driver_postclose, > .context_dtor = via_final_context, > .get_vblank_counter = via_get_vblank_counter, > .enable_vblank = via_enable_vblank, > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index 6cc2dad..19bb77c 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -115,12 +115,13 @@ void via_lastclose(struct drm_device *dev) > } > > int via_mem_alloc(struct drm_device *dev, void *data, > - struct drm_file *file_priv) > + struct drm_file *file) > { > drm_via_mem_t *mem = data; > int retval = 0; > struct drm_memblock_item *item; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > + struct via_file_private *file_priv = file->driver_priv; > unsigned long tmpSize; > > if (mem->type > VIA_MEM_AGP) { > @@ -137,10 +138,10 @@ int via_mem_alloc(struct drm_device *dev, void *data, > } > > tmpSize = (mem->size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; > - item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, > - (unsigned long)file_priv); > - mutex_unlock(&dev->struct_mutex); > + item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, 0); > + > if (item) { > + list_move(&item->owner_list, &file_priv->obj_list); > mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > dev_priv->vram_offset : dev_priv->agp_offset) + > (item->mm-> > @@ -153,6 +154,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > DRM_DEBUG("Video memory allocation failed\n"); > retval = -ENOMEM; > } > + mutex_unlock(&dev->struct_mutex); > > return retval; > } > @@ -173,12 +175,13 @@ int via_mem_free(struct drm_device *dev, void *data, > struct drm_file *file_priv) > > > void via_reclaim_buffers_locked(struct drm_device *dev, > - struct drm_file *file_priv) > + struct drm_file *file) > { > - drm_via_private_t *dev_priv = dev->dev_private; > + struct via_file_private *file_priv = file->driver_priv; > + struct drm_memblock_item *entry, *next; > > mutex_lock(&dev->struct_mutex); > - if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)file_priv)) { > + if (list_empty(&file_priv->obj_list)) { > mutex_unlock(&dev->struct_mutex); > return; > } > @@ -186,7 +189,10 @@ void via_reclaim_buffers_locked(struct drm_device *dev, > if (dev->driver->dma_quiescent) > dev->driver->dma_quiescent(dev); > > - drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv); > + list_for_each_entry_safe(entry, next, &file_priv->obj_list, > + owner_list) { > + drm_sman_free(entry); > + } > mutex_unlock(&dev->struct_mutex); > return; > } > diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h > index fd11a5b..79b3b6e 100644 > --- a/include/drm/via_drm.h > +++ b/include/drm/via_drm.h > @@ -274,4 +274,8 @@ typedef struct drm_via_dmablit { > drm_via_blitsync_t sync; > } drm_via_dmablit_t; > > +struct via_file_private { > + struct list_head obj_list; > +}; > + > #endif /* _VIA_DRM_H_ */ > -- > 1.7.7.1 > > ___ > dri-devel
[PATCH 03/23] drm/sman: kill owner tracking interface functions
> These are now unused. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 38 -- > include/drm/drm_sman.h | 19 --- > 2 files changed, 0 insertions(+), 57 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index 37548b7..a672fea 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -278,27 +278,6 @@ static void drm_sman_remove_owner(struct drm_sman *sman, > kfree(owner_item); > } > > -int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) > -{ > - > - struct drm_hash_item *hash_item; > - struct drm_owner_item *owner_item; > - > - if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { > - return -1; > - } > - > - owner_item = drm_hash_entry(hash_item, struct drm_owner_item, > owner_hash); > - if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { > - drm_sman_remove_owner(sman, owner_item); > - return -1; > - } > - > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_owner_clean); > - > static void drm_sman_do_owner_cleanup(struct drm_sman *sman, > struct drm_owner_item *owner_item) > { > @@ -311,23 +290,6 @@ static void drm_sman_do_owner_cleanup(struct drm_sman > *sman, > drm_sman_remove_owner(sman, owner_item); > } > > -void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner) > -{ > - > - struct drm_hash_item *hash_item; > - struct drm_owner_item *owner_item; > - > - if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { > - > - return; > - } > - > - owner_item = drm_hash_entry(hash_item, struct drm_owner_item, > owner_hash); > - drm_sman_do_owner_cleanup(sman, owner_item); > -} > - > -EXPORT_SYMBOL(drm_sman_owner_cleanup); > - > void drm_sman_cleanup(struct drm_sman *sman) > { > struct drm_owner_item *entry, *next; > diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h > index 3b65ccf..d5ed903 100644 > --- a/include/drm/drm_sman.h > +++ b/include/drm/drm_sman.h > @@ -149,25 +149,6 @@ extern int drm_sman_free_key(struct drm_sman * sman, > unsigned int key); > extern void drm_sman_free(struct drm_memblock_item *item); > > /* > - * returns 1 iff there are no stale memory blocks associated with this owner. > - * Typically called to determine if we need to idle the hardware and call > - * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes > all > - * resources associated with owner. > - */ > - > -extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner); > - > -/* > - * Frees all stale memory blocks associated with this owner. Note that this > - * requires that the hardware is finished with all blocks, so the graphics > engine > - * should be idled before this call is made. This function also frees > - * any resources associated with "owner" and should be called when owner > - * is not going to be referenced anymore. > - */ > - > -extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long > owner); > - > -/* > * Frees all stale memory blocks associated with the memory manager. > * See idling above. > */ > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >
[PATCH 04/23] drm/sman: rip out owner tracking
> In contrast to kms drivers, sis/via _always_ associated a buffer with > a drm fd. So by the time we reach lastclose, all open drm fds are gone > and with them their associated objects. > > So when sis/via call drm_sman_cleanup in their lastclose funcs, that > will free 0 objects. > > The owner tracking now serves no purpose at all, hence rip it ou. We > can't kill the corresponding fields in struct drm_memblock_item yet > because we hijack these in the new driver private owner tracking. But > now that drm_sman.c doesn't touch ->owner_list anymore, we need to > kill the list_move hack and properly add the item to the file_priv > list. > > Also leave the list_del(&obj->owner_list) in drm_sman_free for the > moment, it will move to the drivers when sman disappears completely. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 71 > -- > drivers/gpu/drm/sis/sis_mm.c |3 +- > drivers/gpu/drm/via/via_mm.c |3 +- > include/drm/drm_sman.h |2 - > 4 files changed, 4 insertions(+), 75 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index a672fea..37a8844 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -47,7 +47,6 @@ struct drm_owner_item { > void drm_sman_takedown(struct drm_sman * sman) > { > drm_ht_remove(&sman->user_hash_tab); > - drm_ht_remove(&sman->owner_hash_tab); > kfree(sman->mm); > } > > @@ -65,16 +64,10 @@ drm_sman_init(struct drm_sman * sman, unsigned int > num_managers, > goto out; > } > sman->num_managers = num_managers; > - INIT_LIST_HEAD(&sman->owner_items); > - ret = drm_ht_create(&sman->owner_hash_tab, owner_order); > - if (ret) > - goto out1; > ret = drm_ht_create(&sman->user_hash_tab, user_order); > if (!ret) > goto out; > > - drm_ht_remove(&sman->owner_hash_tab); > -out1: > kfree(sman->mm); > out: > return ret; > @@ -160,44 +153,12 @@ drm_sman_set_manager(struct drm_sman * sman, unsigned > int manager, > } > EXPORT_SYMBOL(drm_sman_set_manager); > > -static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman, > - unsigned long owner) > -{ > - int ret; > - struct drm_hash_item *owner_hash_item; > - struct drm_owner_item *owner_item; > - > - ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); > - if (!ret) { > - return drm_hash_entry(owner_hash_item, struct drm_owner_item, > - owner_hash); > - } > - > - owner_item = kzalloc(sizeof(*owner_item), GFP_KERNEL); > - if (!owner_item) > - goto out; > - > - INIT_LIST_HEAD(&owner_item->mem_blocks); > - owner_item->owner_hash.key = owner; > - if (drm_ht_insert_item(&sman->owner_hash_tab, &owner_item->owner_hash)) > - goto out1; > - > - list_add_tail(&owner_item->sman_list, &sman->owner_items); > - return owner_item; > - > -out1: > - kfree(owner_item); > -out: > - return NULL; > -} > - > struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int > manager, > unsigned long size, unsigned alignment, > unsigned long owner) > { > void *tmp; > struct drm_sman_mm *sman_mm; > - struct drm_owner_item *owner_item; > struct drm_memblock_item *memblock; > > BUG_ON(manager >= sman->num_managers); > @@ -223,16 +184,8 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman > *sman, unsigned int man >(unsigned long)memblock, 32, 0, 0)) > goto out1; > > - owner_item = drm_sman_get_owner_item(sman, owner); > - if (!owner_item) > - goto out2; > - > - list_add_tail(&memblock->owner_list, &owner_item->mem_blocks); > - > return memblock; > > -out2: > - drm_ht_remove_item(&sman->user_hash_tab, &memblock->user_hash); > out1: > kfree(memblock); > out: > @@ -270,35 +223,11 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned > int key) > > EXPORT_SYMBOL(drm_sman_free_key); > > -static void drm_sman_remove_owner(struct drm_sman *sman, > - struct drm_owner_item *owner_item) > -{ > - list_del(&owner_item->sman_list); > - drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); > - kfree(owner_item); > -} > - > -static void drm_sman_do_owner_cleanup(struct drm_sman *sman, > - struct drm_owner_item *owner_item) > -{ > - struct drm_memblock_item *entry, *next; > - > - list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, > - owner_list) { > - drm_sman_free(entry); > - } > - drm_sman_remove_owner(sman, owner_item); > -}
[PATCH 05/23] drm/via: track user->memblock mapping with idr
> Massive indirection through a hashtable for a simple key->pointer > look-up actually just adds bloat. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/via/via_drv.h |2 + > drivers/gpu/drm/via/via_map.c |1 + > drivers/gpu/drm/via/via_mm.c | 61 > +++-- > 3 files changed, 49 insertions(+), 15 deletions(-) Acked-by: James Simmons > diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h > index 9cf87d9..108ea71 100644 > --- a/drivers/gpu/drm/via/via_drv.h > +++ b/drivers/gpu/drm/via/via_drv.h > @@ -91,6 +91,8 @@ typedef struct drm_via_private { > struct drm_sman sman; > int vram_initialized; > int agp_initialized; > + /** Mapping of userspace keys to mm objects */ > + struct idr object_idr; > unsigned long vram_offset; > unsigned long agp_offset; > drm_via_blitq_t blit_queues[VIA_NUM_BLIT_ENGINES]; > diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c > index 6cca9a7..b09f659 100644 > --- a/drivers/gpu/drm/via/via_map.c > +++ b/drivers/gpu/drm/via/via_map.c > @@ -104,6 +104,7 @@ int via_driver_load(struct drm_device *dev, unsigned long > chipset) > > dev_priv->chipset = chipset; > > + idr_init(&dev->object_name_idr); > ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > if (ret) { > kfree(dev_priv); > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index ea3d621..af9e771 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -118,7 +118,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > struct drm_file *file) > { > drm_via_mem_t *mem = data; > - int retval = 0; > + int retval = 0, user_key; > struct drm_memblock_item *item; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > struct via_file_private *file_priv = file->driver_priv; > @@ -139,24 +139,46 @@ int via_mem_alloc(struct drm_device *dev, void *data, > > tmpSize = (mem->size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; > item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0, 0); > + if (!item) { > + retval = -ENOMEM; > + goto fail_alloc; > + } > > - if (item) { > - INIT_LIST_HEAD(&item->owner_list); > - list_add(&item->owner_list, &file_priv->obj_list); > - mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > - dev_priv->vram_offset : dev_priv->agp_offset) + > - (item->mm-> > - offset(item->mm, item->mm_info) << VIA_MM_ALIGN_SHIFT); > - mem->index = item->user_hash.key; > - } else { > - mem->offset = 0; > - mem->size = 0; > - mem->index = 0; > - DRM_DEBUG("Video memory allocation failed\n"); > +again: > + if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { > retval = -ENOMEM; > + goto fail_idr; > } > + > + /* do the allocation under our spinlock */ > + retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); > + if (retval == -EAGAIN) > + goto again; > + if (retval) > + goto fail_idr; > + > + INIT_LIST_HEAD(&item->owner_list); > + list_add(&item->owner_list, &file_priv->obj_list); > mutex_unlock(&dev->struct_mutex); > > + mem->offset = ((mem->type == VIA_MEM_VIDEO) ? > + dev_priv->vram_offset : dev_priv->agp_offset) + > + (item->mm-> > + offset(item->mm, item->mm_info) << VIA_MM_ALIGN_SHIFT); > + mem->index = user_key; > + > + return 0; > + > +fail_idr: > + drm_sman_free(item); > +fail_alloc: > + mutex_unlock(&dev->struct_mutex); > + > + mem->offset = 0; > + mem->size = 0; > + mem->index = 0; > + DRM_DEBUG("Video memory allocation failed\n"); > + > return retval; > } > > @@ -164,11 +186,20 @@ int via_mem_free(struct drm_device *dev, void *data, > struct drm_file *file_priv) > { > drm_via_private_t *dev_priv = dev->dev_private; > drm_via_mem_t *mem = data; > + struct drm_memblock_item *obj; > int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_free_key(&dev_priv->sman, mem->index); > + obj = idr_find(&dev_priv->object_idr, mem->index); > + if (obj == NULL) { > + mutex_unlock(&dev->struct_mutex); > + return -EINVAL; > + } > + > + idr_remove(&dev_priv->object_idr, mem->index); > + drm_sman_free(obj); > mutex_unlock(&dev->struct_mutex); > + > DRM_DEBUG("free = 0x%lx\n", mem->index); > > return ret; > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >
[PATCH 06/23] drm/sis: track user->memblock mapping with idr
> Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/sis/sis_drv.c |4 +++ > drivers/gpu/drm/sis/sis_drv.h |2 + > drivers/gpu/drm/sis/sis_mm.c | 60 ++-- > drivers/gpu/drm/via/via_map.c |2 + > 4 files changed, 53 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c > index a5dcd0a..9f5fbcf 100644 > --- a/drivers/gpu/drm/sis/sis_drv.c > +++ b/drivers/gpu/drm/sis/sis_drv.c > @@ -46,6 +46,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned > long chipset) > > dev->dev_private = (void *)dev_priv; > dev_priv->chipset = chipset; > + idr_init(&dev->object_name_idr); > ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > if (ret) > kfree(dev_priv); > @@ -58,6 +59,9 @@ static int sis_driver_unload(struct drm_device *dev) > drm_sis_private_t *dev_priv = dev->dev_private; > > drm_sman_takedown(&dev_priv->sman); > + idr_remove_all(&dev_priv->object_idr); > + idr_destroy(&dev_priv->object_idr); > + > kfree(dev_priv); > > return 0; > diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h > index 194303c..fcdd06a 100644 > --- a/drivers/gpu/drm/sis/sis_drv.h > +++ b/drivers/gpu/drm/sis/sis_drv.h > @@ -60,6 +60,8 @@ typedef struct drm_sis_private { > int agp_initialized; > unsigned long vram_offset; > unsigned long agp_offset; > + /** Mapping of userspace keys to mm objects */ > + struct idr object_idr; > } drm_sis_private_t; > > extern int sis_idle(struct drm_device *dev); > diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c > index dff70da..ef6045a 100644 > --- a/drivers/gpu/drm/sis/sis_mm.c > +++ b/drivers/gpu/drm/sis/sis_mm.c > @@ -125,7 +125,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > - int retval = 0; > + int retval = 0, user_key; > struct drm_memblock_item *item; > struct sis_file_private *file_priv = file->driver_priv; > > @@ -141,24 +141,46 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > > mem->size = (mem->size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT; > item = drm_sman_alloc(&dev_priv->sman, pool, mem->size, 0, 0); > + if (!item) { > + retval = -ENOMEM; > + goto fail_alloc; > + } > > - if (item) { > - INIT_LIST_HEAD(&item->owner_list); > - list_add(&item->owner_list, &file_priv->obj_list); > - mem->offset = ((pool == 0) ? > - dev_priv->vram_offset : dev_priv->agp_offset) + > - (item->mm-> > - offset(item->mm, item->mm_info) << SIS_MM_ALIGN_SHIFT); > - mem->free = item->user_hash.key; > - mem->size = mem->size << SIS_MM_ALIGN_SHIFT; > - } else { > - mem->offset = 0; > - mem->size = 0; > - mem->free = 0; > +again: > + if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { > retval = -ENOMEM; > + goto fail_idr; > } > + > + /* do the allocation under our spinlock */ > + retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); > + if (retval == -EAGAIN) > + goto again; > + if (retval) > + goto fail_idr; > + > + INIT_LIST_HEAD(&item->owner_list); > + list_add(&item->owner_list, &file_priv->obj_list); > + mutex_unlock(&dev->struct_mutex); > + > + mem->offset = ((pool == 0) ? > + dev_priv->vram_offset : dev_priv->agp_offset) + > + (item->mm-> > + offset(item->mm, item->mm_info) << SIS_MM_ALIGN_SHIFT); > + mem->free = user_key; > + mem->size = mem->size << SIS_MM_ALIGN_SHIFT; > + > + return 0; > + > +fail_idr: > + drm_sman_free(item); > +fail_alloc: > mutex_unlock(&dev->struct_mutex); > > + mem->offset = 0; > + mem->size = 0; > + mem->free = 0; > + > DRM_DEBUG("alloc %d, size = %d, offset = %d\n", pool, mem->size, > mem->offset); > > @@ -169,10 +191,18 @@ static int sis_drm_free(struct drm_device *dev, void > *data, struct drm_file *fil > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > + struct drm_memblock_item *obj; > int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_free_key(&dev_priv->sman, mem->free); > + obj = idr_find(&dev_priv->object_idr, mem->free); > + if (obj == NULL) { > + mutex_unlock(&dev->struct_mutex); > + return -EINVAL; > + } > + > + idr_remove(&dev_priv->object_idr, mem->free); > + drm_sman_free(obj); > mutex_unlock(&dev->struct_mutex); > DRM_DEBUG("free = 0x%lx\n", me
[PATCH 07/23] drm/sman: kill user_hash_tab
> No longer used. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/drm_sman.c | 36 ++-- > include/drm/drm_sman.h |5 - > 2 files changed, 2 insertions(+), 39 deletions(-) > > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > index 37a8844..1a4fb9f 100644 > --- a/drivers/gpu/drm/drm_sman.c > +++ b/drivers/gpu/drm/drm_sman.c > @@ -46,7 +46,6 @@ struct drm_owner_item { > > void drm_sman_takedown(struct drm_sman * sman) > { > - drm_ht_remove(&sman->user_hash_tab); > kfree(sman->mm); > } > > @@ -61,16 +60,11 @@ drm_sman_init(struct drm_sman * sman, unsigned int > num_managers, > sman->mm = kcalloc(num_managers, sizeof(*sman->mm), GFP_KERNEL); > if (!sman->mm) { > ret = -ENOMEM; > - goto out; > + return ret; > } > sman->num_managers = num_managers; > - ret = drm_ht_create(&sman->user_hash_tab, user_order); > - if (!ret) > - goto out; > > - kfree(sman->mm); > -out: > - return ret; > + return 0; > } > > EXPORT_SYMBOL(drm_sman_init); > @@ -179,15 +173,8 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman > *sman, unsigned int man > memblock->mm = sman_mm; > memblock->sman = sman; > > - if (drm_ht_just_insert_please > - (&sman->user_hash_tab, &memblock->user_hash, > - (unsigned long)memblock, 32, 0, 0)) > - goto out1; > - > return memblock; > > -out1: > - kfree(memblock); > out: > sman_mm->free(sman_mm->private, tmp); > > @@ -198,31 +185,12 @@ EXPORT_SYMBOL(drm_sman_alloc); > > void drm_sman_free(struct drm_memblock_item *item) > { > - struct drm_sman *sman = item->sman; > - > list_del(&item->owner_list); > - drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); > item->mm->free(item->mm->private, item->mm_info); > kfree(item); > } > EXPORT_SYMBOL(drm_sman_free); > > -int drm_sman_free_key(struct drm_sman *sman, unsigned int key) > -{ > - struct drm_hash_item *hash_item; > - struct drm_memblock_item *memblock_item; > - > - if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) > - return -EINVAL; > - > - memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, > -user_hash); > - drm_sman_free(memblock_item); > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_free_key); > - > void drm_sman_cleanup(struct drm_sman *sman) > { > unsigned int i; > diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h > index 34ae5ca..031e521 100644 > --- a/include/drm/drm_sman.h > +++ b/include/drm/drm_sman.h > @@ -87,7 +87,6 @@ struct drm_memblock_item { > struct drm_sman { > struct drm_sman_mm *mm; > int num_managers; > - struct drm_open_hash user_hash_tab; > }; > > /* > @@ -139,11 +138,7 @@ extern struct drm_memblock_item *drm_sman_alloc(struct > drm_sman * sman, > unsigned long size, > unsigned alignment, > unsigned long owner); > -/* > - * Free a memory block identified by its user hash key. > - */ > > -extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key); > extern void drm_sman_free(struct drm_memblock_item *item); > > /* > -- > 1.7.7.1 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >
[PATCH 08/23] drm/via: use drm_mm instead of drm_sman
> Now that we are again in proper control of owner_list, we need to > properly list_del it on free. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/via/via_drv.h |5 ++- > drivers/gpu/drm/via/via_map.c |7 > drivers/gpu/drm/via/via_mm.c | 72 ++-- > 3 files changed, 43 insertions(+), 41 deletions(-) > > diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h > index 108ea71..88edacc 100644 > --- a/drivers/gpu/drm/via/via_drv.h > +++ b/drivers/gpu/drm/via/via_drv.h > @@ -24,7 +24,7 @@ > #ifndef _VIA_DRV_H_ > #define _VIA_DRV_H_ > > -#include "drm_sman.h" > +#include "drm_mm.h" > #define DRIVER_AUTHOR"Various" > > #define DRIVER_NAME "via" > @@ -88,9 +88,10 @@ typedef struct drm_via_private { > uint32_t irq_pending_mask; > int *irq_map; > unsigned int idle_fault; > - struct drm_sman sman; > int vram_initialized; > + struct drm_mm vram_mm; > int agp_initialized; > + struct drm_mm agp_mm; > /** Mapping of userspace keys to mm objects */ > struct idr object_idr; > unsigned long vram_offset; > diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c > index fa5afbc..a2ab343 100644 > --- a/drivers/gpu/drm/via/via_map.c > +++ b/drivers/gpu/drm/via/via_map.c > @@ -105,15 +105,9 @@ int via_driver_load(struct drm_device *dev, unsigned > long chipset) > dev_priv->chipset = chipset; > > idr_init(&dev->object_name_idr); > - ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > - if (ret) { > - kfree(dev_priv); > - return ret; > - } > > ret = drm_vblank_init(dev, 1); > if (ret) { > - drm_sman_takedown(&dev_priv->sman); > kfree(dev_priv); > return ret; > } > @@ -125,7 +119,6 @@ int via_driver_unload(struct drm_device *dev) > { > drm_via_private_t *dev_priv = dev->dev_private; > > - drm_sman_takedown(&dev_priv->sman); > idr_remove_all(&dev_priv->object_idr); > idr_destroy(&dev_priv->object_idr); > > diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c > index af9e771..80eab7d 100644 > --- a/drivers/gpu/drm/via/via_mm.c > +++ b/drivers/gpu/drm/via/via_mm.c > @@ -28,26 +28,22 @@ > #include "drmP.h" > #include "via_drm.h" > #include "via_drv.h" > -#include "drm_sman.h" > > #define VIA_MM_ALIGN_SHIFT 4 > #define VIA_MM_ALIGN_MASK ((1 << VIA_MM_ALIGN_SHIFT) - 1) > > +struct via_memblock { > + struct drm_mm_node mm_node; > + struct list_head owner_list; > +}; > + > int via_agp_init(struct drm_device *dev, void *data, struct drm_file > *file_priv) > { > drm_via_agp_t *agp = data; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > - int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_set_range(&dev_priv->sman, VIA_MEM_AGP, 0, > - agp->size >> VIA_MM_ALIGN_SHIFT); > - > - if (ret) { > - DRM_ERROR("AGP memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + drm_mm_init(&dev_priv->agp_mm, 0, agp->size >> VIA_MM_ALIGN_SHIFT); > > dev_priv->agp_initialized = 1; > dev_priv->agp_offset = agp->offset; > @@ -61,17 +57,9 @@ int via_fb_init(struct drm_device *dev, void *data, struct > drm_file *file_priv) > { > drm_via_fb_t *fb = data; > drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; > - int ret; > > mutex_lock(&dev->struct_mutex); > - ret = drm_sman_set_range(&dev_priv->sman, VIA_MEM_VIDEO, 0, > - fb->size >> VIA_MM_ALIGN_SHIFT); > - > - if (ret) { > - DRM_ERROR("VRAM memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> VIA_MM_ALIGN_SHIFT); > > dev_priv->vram_initialized = 1; > dev_priv->vram_offset = fb->offset; > @@ -108,9 +96,14 @@ void via_lastclose(struct drm_device *dev) > return; > > mutex_lock(&dev->struct_mutex); > - drm_sman_cleanup(&dev_priv->sman); > - dev_priv->vram_initialized = 0; > - dev_priv->agp_initialized = 0; > + if (dev_priv->vram_initialized) { > + drm_mm_takedown(&dev_priv->vram_mm); > + dev_priv->vram_initialized = 0; > + } > + if (dev_priv->agp_initialized) { > + drm_mm_takedown(&dev_priv->agp_mm); > + dev_priv->agp_initialized = 0; > + } > mutex_unlock(&dev->struct_mutex); > } > > @@ -119,7 +112,7 @@ int via_mem_alloc(struct drm_device *dev, void *data, > { > drm_via_mem_t *mem = data; > int retval = 0, user_key; > - struct drm_memblock_item *item; > + struct via_memblo
[PATCH 09/23] drm/sis: use drm_mm instead of drm_sman
> Signed-off-by: Daniel Vetter Can't test on SiS but does nothing to my VIA hardware. Acked-by: James Simmons > --- > drivers/gpu/drm/sis/sis_drv.c |4 - > drivers/gpu/drm/sis/sis_drv.h |5 +- > drivers/gpu/drm/sis/sis_mm.c | 137 +++- > 3 files changed, 68 insertions(+), 78 deletions(-) > > diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c > index 9f5fbcf..278d1b0 100644 > --- a/drivers/gpu/drm/sis/sis_drv.c > +++ b/drivers/gpu/drm/sis/sis_drv.c > @@ -47,9 +47,6 @@ static int sis_driver_load(struct drm_device *dev, unsigned > long chipset) > dev->dev_private = (void *)dev_priv; > dev_priv->chipset = chipset; > idr_init(&dev->object_name_idr); > - ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); > - if (ret) > - kfree(dev_priv); > > return ret; > } > @@ -58,7 +55,6 @@ static int sis_driver_unload(struct drm_device *dev) > { > drm_sis_private_t *dev_priv = dev->dev_private; > > - drm_sman_takedown(&dev_priv->sman); > idr_remove_all(&dev_priv->object_idr); > idr_destroy(&dev_priv->object_idr); > > diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h > index fcdd06a..573758b 100644 > --- a/drivers/gpu/drm/sis/sis_drv.h > +++ b/drivers/gpu/drm/sis/sis_drv.h > @@ -44,7 +44,7 @@ enum sis_family { > SIS_CHIP_315 = 1, > }; > > -#include "drm_sman.h" > +#include "drm_mm.h" > > > #define SIS_BASE (dev_priv->mmio) > @@ -54,12 +54,13 @@ enum sis_family { > typedef struct drm_sis_private { > drm_local_map_t *mmio; > unsigned int idle_fault; > - struct drm_sman sman; > unsigned int chipset; > int vram_initialized; > int agp_initialized; > unsigned long vram_offset; > unsigned long agp_offset; > + struct drm_mm vram_mm; > + struct drm_mm agp_mm; > /** Mapping of userspace keys to mm objects */ > struct idr object_idr; > } drm_sis_private_t; > diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c > index ef6045a..ff34680 100644 > --- a/drivers/gpu/drm/sis/sis_mm.c > +++ b/drivers/gpu/drm/sis/sis_mm.c > @@ -41,40 +41,18 @@ > #define AGP_TYPE 1 > > > +struct sis_memblock { > + struct drm_mm_node mm_node; > + struct sis_memreq req; > + struct list_head owner_list; > +}; > + > #if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) > /* fb management via fb device */ > > #define SIS_MM_ALIGN_SHIFT 0 > #define SIS_MM_ALIGN_MASK 0 > > -static void *sis_sman_mm_allocate(void *private, unsigned long size, > - unsigned alignment) > -{ > - struct sis_memreq req; > - > - req.size = size; > - sis_malloc(&req); > - if (req.size == 0) > - return NULL; > - else > - return (void *)(unsigned long)~req.offset; > -} > - > -static void sis_sman_mm_free(void *private, void *ref) > -{ > - sis_free(~((unsigned long)ref)); > -} > - > -static void sis_sman_mm_destroy(void *private) > -{ > - ; > -} > - > -static unsigned long sis_sman_mm_offset(void *private, void *ref) > -{ > - return ~((unsigned long)ref); > -} > - > #else /* CONFIG_FB_SIS[_MODULE] */ > > #define SIS_MM_ALIGN_SHIFT 4 > @@ -86,30 +64,11 @@ static int sis_fb_init(struct drm_device *dev, void > *data, struct drm_file *file > { > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_fb_t *fb = data; > - int ret; > > mutex_lock(&dev->struct_mutex); > -#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) > - { > - struct drm_sman_mm sman_mm; > - sman_mm.private = (void *)0x; > - sman_mm.allocate = sis_sman_mm_allocate; > - sman_mm.free = sis_sman_mm_free; > - sman_mm.destroy = sis_sman_mm_destroy; > - sman_mm.offset = sis_sman_mm_offset; > - ret = > - drm_sman_set_manager(&dev_priv->sman, VIDEO_TYPE, &sman_mm); > - } > -#else > - ret = drm_sman_set_range(&dev_priv->sman, VIDEO_TYPE, 0, > - fb->size >> SIS_MM_ALIGN_SHIFT); > -#endif > - > - if (ret) { > - DRM_ERROR("VRAM memory manager initialisation error\n"); > - mutex_unlock(&dev->struct_mutex); > - return ret; > - } > + /* Unconditionally init the drm_mm, even though we don't use it when the > + * fb sis driver is available - make cleanup easier. */ > + drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> SIS_MM_ALIGN_SHIFT); > > dev_priv->vram_initialized = 1; > dev_priv->vram_offset = fb->offset; > @@ -126,8 +85,9 @@ static int sis_drm_alloc(struct drm_device *dev, struct > drm_file *file, > drm_sis_private_t *dev_priv = dev->dev_private; > drm_sis_mem_t *mem = data; > int retval = 0, user_key; > - struct drm_memblock_item *item; > + struct sis_memblock *item; > s
[PATCH 10/23] drm: kill drm_sman
> No longer used. > > Signed-off-by: Daniel Vetter Acked-by: James Simmons > --- > drivers/gpu/drm/Makefile |2 +- > drivers/gpu/drm/drm_sman.c | 210 > > include/drm/drm_sman.h | 151 --- > 3 files changed, 1 insertions(+), 362 deletions(-) > delete mode 100644 drivers/gpu/drm/drm_sman.c > delete mode 100644 include/drm/drm_sman.h > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 89cf05a..ea083cf 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -9,7 +9,7 @@ drm-y :=drm_auth.o drm_buffer.o drm_bufs.o > drm_cache.o \ > drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ > drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ > drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \ > - drm_platform.o drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \ > + drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ > drm_crtc.o drm_modes.o drm_edid.o \ > drm_info.o drm_debugfs.o drm_encoder_slave.o \ > drm_trace_points.o drm_global.o drm_usb.o > diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c > deleted file mode 100644 > index 1a4fb9f..000 > --- a/drivers/gpu/drm/drm_sman.c > +++ /dev/null > @@ -1,210 +0,0 @@ > -/** > - * > - * Copyright 2006 Tungsten Graphics, Inc., Bismarck., ND., USA. > - * All Rights Reserved. > - * > - * Permission is hereby granted, free of charge, to any person obtaining a > - * copy of this software and associated documentation files (the > - * "Software"), to deal in the Software without restriction, including > - * without limitation the rights to use, copy, modify, merge, publish, > - * distribute, sub license, and/or sell copies of the Software, and to > - * permit persons to whom the Software is furnished to do so, subject to > - * the following conditions: > - * > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY > CLAIM, > - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > - * USE OR OTHER DEALINGS IN THE SOFTWARE. > - * > - * The above copyright notice and this permission notice (including the > - * next paragraph) shall be included in all copies or substantial portions > - * of the Software. > - * > - * > - **/ > -/* > - * Simple memory manager interface that keeps track on allocate regions on a > - * per "owner" basis. All regions associated with an "owner" can be released > - * with a simple call. Typically if the "owner" exists. The owner is any > - * "unsigned long" identifier. Can typically be a pointer to a file private > - * struct or a context identifier. > - * > - * Authors: > - * Thomas Hellstr?m > - */ > - > -#include "drm_sman.h" > - > -struct drm_owner_item { > - struct drm_hash_item owner_hash; > - struct list_head sman_list; > - struct list_head mem_blocks; > -}; > - > -void drm_sman_takedown(struct drm_sman * sman) > -{ > - kfree(sman->mm); > -} > - > -EXPORT_SYMBOL(drm_sman_takedown); > - > -int > -drm_sman_init(struct drm_sman * sman, unsigned int num_managers, > - unsigned int user_order, unsigned int owner_order) > -{ > - int ret = 0; > - > - sman->mm = kcalloc(num_managers, sizeof(*sman->mm), GFP_KERNEL); > - if (!sman->mm) { > - ret = -ENOMEM; > - return ret; > - } > - sman->num_managers = num_managers; > - > - return 0; > -} > - > -EXPORT_SYMBOL(drm_sman_init); > - > -static void *drm_sman_mm_allocate(void *private, unsigned long size, > - unsigned alignment) > -{ > - struct drm_mm *mm = (struct drm_mm *) private; > - struct drm_mm_node *tmp; > - > - tmp = drm_mm_search_free(mm, size, alignment, 1); > - if (!tmp) { > - return NULL; > - } > - tmp = drm_mm_get_block(tmp, size, alignment); > - return tmp; > -} > - > -static void drm_sman_mm_free(void *private, void *ref) > -{ > - struct drm_mm_node *node = (struct drm_mm_node *) ref; > - > - drm_mm_put_block(node); > -} > - > -static void drm_sman_mm_destroy(void *private) > -{ > - struct drm_mm *mm = (struct drm_mm *) private; > - drm_mm_takedown(mm); > - kfree(mm); > -} > - > -static unsigned long drm_sman_mm_offset(void *private, void *ref) > -{ > - struct drm_mm_node *node = (struct drm_mm_node *) ref; > - return node->start; > -} > - > -i
[PATCH 08/23] drm/via: use drm_mm instead of drm_sman
> Chris Wilson rightly complained that this doesn't explain the list_del > magic going on. New commit msg reads: > > To make the transition in a piece-wise and bisectable way possible, > I've hijacked the ->owner_list from drm_sman. While transitioning, the > list_add was done by the driver, while the list_del was still done by > the dying sman code. > > Now that we are in full control of ->owner_list, do the list_del > ourselves. > > He also noted the superflous additions of INIT_LIST_HEAD and the stale > comment about spinlock locking in the idr allocation (protected by > dev->struct_mutex) that I've copied over. All fixed up and pushed out for > the moment to my fdo repo: > > http://cgit.freedesktop.org/~danvet/drm/log/?h=kill-with-fire Speaking of I attempted to clone that repo but it gives me warning: remote HEAD refers to nonexistent ref, unable to checkout.