Re: [Intel-gfx] [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects

2015-09-20 Thread Ankitprasad Sharma
On Tue, 2015-09-15 at 10:49 +0100, Chris Wilson wrote:
> On Tue, Sep 15, 2015 at 02:03:25PM +0530, ankitprasad.r.sha...@intel.com 
> wrote:
> >  i915_gem_create(struct drm_file *file,
> > struct drm_device *dev,
> > uint64_t size,
> > +   uint32_t flags,
> > uint32_t *handle_p)
> >  {
> > struct drm_i915_gem_object *obj;
> > @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> > if (size == 0)
> > return -EINVAL;
> >  
> > +   if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> > +   return -EINVAL;
> > +
> > /* Allocate the new object */
> > -   obj = i915_gem_alloc_object(dev, size);
> > +   if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> > +   mutex_lock(&dev->struct_mutex);
> > +   obj = i915_gem_object_create_stolen(dev, size);
> > +   if (!obj) {
> > +   mutex_unlock(&dev->struct_mutex);
> > +   return -ENOMEM;
> 
> Note that you should change the i915_gem_object_create_stolen() to
> report the precise error, as with the eviction support we may trigger
> EINTR. Also ENOSPC will be preferrable for requesting a larger stolen
> object than the available space (to help distinguish between true oom).
> -Chris
I would prefer to do this as a separate patch, as this might require a
restructuring of the gem_stolen.c to some extent, something like this:

@@ -465,29 +467,29 @@ i915_gem_object_create_stolen(struct drm_device
*dev, u64 size)
int ret;
 
if (!drm_mm_initialized(&dev_priv->mm.stolen))
-   return NULL;
+   return ERR_PTR(-EINVAL);
 
DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
if (size == 0)
-   return NULL;
+   return ERR_PTR(-EINVAL);
 
stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
if (!stolen)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
if (ret) {
kfree(stolen);
-   return NULL;
+   return ERR_PTR(-ENOSPC);
}
 
obj = _i915_gem_object_create_stolen(dev, stolen);
-   if (obj)
+   if (!IS_ERR(obj))
return obj;
 
i915_gem_stolen_remove_node(dev_priv, stolen);
kfree(stolen);
-   return NULL;
+   return obj;
 }
 

Thanks,
Ankit



___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] Revert "sna: Coldplug unknown connections as well"

2015-09-20 Thread Sedat Dilek
Hi,

I am here on Ubuntu/precise AMD64 with libdrm v2.4.65 and mesa v10.6.8.

I cannot see my LightDM login-manager, my system hangs in VT-1.

When I revert...

commit 650da13c7257019728cfca361dfcbe34a6c526ef
"sna: Coldplug unknown connections as well"

...everything is as usual.

Please let me know when you need more informations.

Regards,
- Sedat -
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] Revert "sna: Coldplug unknown connections as well"

2015-09-20 Thread Sedat Dilek
On Sun, Sep 20, 2015 at 8:20 PM, Sedat Dilek  wrote:
> Hi,
>
> I am here on Ubuntu/precise AMD64 with libdrm v2.4.65 and mesa v10.6.8.
>
> I cannot see my LightDM login-manager, my system hangs in VT-1.
>
> When I revert...
>
> commit 650da13c7257019728cfca361dfcbe34a6c526ef
> "sna: Coldplug unknown connections as well"
>
> ...everything is as usual.
>
> Please let me know when you need more informations.
>

When doing a power-off... my machine hangs - after LightDM has
stopped/closed - in VT-1 - with this revert.

I will return to 2.99.917-459-g300319e2044c which was good here.

- Sedat -
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Clean up intel_plane->plane usage

2015-09-20 Thread Maarten Lankhorst
Op 18-09-15 om 03:55 schreef Matt Roper:
> intel_plane->plane has inconsistent meanings across the driver:
>  * For primary planes, intel_plane->plane is usually the pipe number
>(except for old platforms where it had to be swapped for FBC
>reasons).
>  * For sprite planes, intel_plane->plane represents the sprite index for
>the specific CRTC the sprite belongs to (0, 1, 2, ...)
>  * For cursor planes, intel_plane->plane is again the pipe number,
>but without the FBC swapping on old platforms.
>
> This overloading of the field can be quite confusing and easily leads to
> bugs due to differences in how the hardware actually gets programmed
> (e.g., SKL code needs to use p->plane + 1 because the hardware expects
> universal plane ID's that include the primary, whereas VLV code needs to
> use just p->plane because hardware expects a sprite index that does not
> include the primary).
>
> Let's try to clean up this situation by giving intel_plane->plane a
> consistent meaning across all plane types, and then update all uses
> across driver code to use macros to interpret it properly.  The
> following macros should be used in the code where we previously accessed
> p->plane and will do additional plane type checking to help prevent
> misuse:
>  * I915_UNIVERSAL_NUM(p) --- Universal plane ID (primary = 0, sprites
>start from 1); intended for use in gen9+ code.
>  * I915_I915_PRIMARY_NUM(p) --- Primary plane ID for pre-gen9 platforms;
>determines whether FBC-related swapping is needed or not.
The extra I915_ here should probably be fixed when committing, though it's
not sufficient to require a resend of this patch. :-)
>  * I915_SPRITE_NUM(p) --- Sprite plane ID (first sprite = 0); intended
>for use in pre-gen9 code.
>
Reviewed-by: Maarten Lankhorst 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx