Re: [Spice-devel] [PATCH AUTOSEL 6.5 2/6] drm/qxl: prevent memory leak

2023-11-14 Thread Frediano Ziglio
Il giorno mer 15 nov 2023 alle ore 06:57 Sasha Levin ha scritto: > > From: Zongmin Zhou > > [ Upstream commit 0e8b9f258baed25f1c5672613699247c76b007b5 ] > > The allocated memory for qdev->dumb_heads should be released > in qxl_destroy_monitors_object before qxl suspend. >

Re: [Spice-devel] [PATCH 4/4] drm/qxl: add drm_driver.release callback.

2019-12-20 Thread Frediano Ziglio
> > Move final cleanups to qxl_drm_release() callback. Can you explain in the commit why this is better or preferable? > Add drm_atomic_helper_shutdown() call to qxl_pci_remove(). I suppose this is to replace the former manual cleanup calls, which were moved to qxl_drm_release, I think this

Re: [Spice-devel] [PATCH 1/2] drm/qxl: stop abusing TTM to call driver internal functions

2019-09-30 Thread Frediano Ziglio
> Am 30.09.19 um 11:51 schrieb Frediano Ziglio: > >> Am 27.09.19 um 18:31 schrieb Frediano Ziglio: > >>>> The ttm_mem_io_* functions are actually internal to TTM and shouldn't be > >>>> used in a driver. > >>>> > >>>

Re: [Spice-devel] Xorg indefinitely hangs in kernelspace

2019-09-30 Thread Frediano Ziglio
> > On 05.09.19 15:34, Jaak Ristioja wrote: > > On 05.09.19 10:14, Gerd Hoffmann wrote: > >> On Tue, Aug 06, 2019 at 09:00:10PM +0300, Jaak Ristioja wrote: > >>> Hello! > >>> > >>> I'm writing to report a crash in the QXL / DRM code in the Linux kernel. > >>> I originally filed the issue on

Re: [Spice-devel] [PATCH 1/2] drm/qxl: stop abusing TTM to call driver internal functions

2019-09-30 Thread Frediano Ziglio
> > Am 27.09.19 um 18:31 schrieb Frediano Ziglio: > >> The ttm_mem_io_* functions are actually internal to TTM and shouldn't be > >> used in a driver. > >> > > As far as I can see by your second patch QXL is just using exported > > (that is not interna

Re: [Spice-devel] [PATCH 1/2] drm/qxl: stop abusing TTM to call driver internal functions

2019-09-27 Thread Frediano Ziglio
> > The ttm_mem_io_* functions are actually internal to TTM and shouldn't be > used in a driver. > As far as I can see by your second patch QXL is just using exported (that is not internal) functions. Not that the idea of making them internal is bad but this comment is a wrong statement. >

Re: [PATCH v2] drm/qxl: get vga ioports

2019-09-11 Thread Frediano Ziglio
2: Skip this for secondary qxl cards which don't have vga mode in the > first place (Frediano). > > Cc: Frediano Ziglio > Signed-off-by: Gerd Hoffmann Acked-by: Frediano Ziglio > --- > drivers/gpu/drm/qxl/qxl_drv.c | 20 +++- > 1 file changed, 19 inserti

Re: [Spice-devel] Xorg indefinitely hangs in kernelspace

2019-09-06 Thread Frediano Ziglio
> > On Tue, 6 Aug 2019 21:00:10 +0300 From: Jaak Ristioja > > Hello! > > > > I'm writing to report a crash in the QXL / DRM code in the Linux kernel. > > I originally filed the issue on LaunchPad and more details can be found > > there, although I doubt whether these details are useful. > >

Re: [Spice-devel] [PATCH] drm/qxl: get vga ioports

2019-08-05 Thread Frediano Ziglio
> > qxl has two modes: "native" (used by the drm driver) and "vga" (vga > compatibility mode, typically used for boot display and firmware > framebuffers). > > Accessing any vga ioport will switch the qxl device into vga mode. > The qxl driver never does that, but other drivers accessing vga

Re: [Spice-devel] [PATCH 1/3] drm/qxl: add mode/framebuffer check functions

2019-01-16 Thread Frediano Ziglio
> > Add a helper functions to check video modes. Also add a helper to check > framebuffer buffer objects, using the former for consistency. That way > we should not fail in qxl_primary_atomic_check() because video modes > which are too big will not be added to the mode list in the first place.

Re: [Spice-devel] [PATCH 1/3] drm/qxl: allow both PRIV and VRAM placement for QXL_GEM_DOMAIN_SURFACE

2018-12-06 Thread Frediano Ziglio
> > On Thu, Dec 06, 2018 at 05:55:58AM -0500, Frediano Ziglio wrote: > > > > > qxl surfaces (used for framebuffers and gem objects) can live in both > > > VRAM and PRIV ttm domains. Update placement setup to include both. Put > > > PRIV first in the lis

Re: [Spice-devel] [PATCH] drm/qxl: use qxl_num_crtc directly

2018-12-06 Thread Frediano Ziglio
> > On Thu, Dec 06, 2018 at 07:53:10AM -0500, Frediano Ziglio wrote: > > > > > > On Thu, Dec 06, 2018 at 05:59:25AM -0500, Frediano Ziglio wrote: > > > > > > > > > > Just use qxl_num_crtc directly everywhere instead of using > >

Re: [Spice-devel] [PATCH] drm/qxl: use qxl_num_crtc directly

2018-12-06 Thread Frediano Ziglio
> > On Thu, Dec 06, 2018 at 05:59:25AM -0500, Frediano Ziglio wrote: > > > > > > Just use qxl_num_crtc directly everywhere instead of using > > > qdev->monitors_config->max_allowed. Drops pointless indirection > > > and also is less confusi

Re: [Spice-devel] [PATCH] drm/qxl: use qxl_num_crtc directly

2018-12-06 Thread Frediano Ziglio
> > Just use qxl_num_crtc directly everywhere instead of using > qdev->monitors_config->max_allowed. Drops pointless indirection > and also is less confusing. > To me is MORE confusing, why comparing number of something with another number? Previously code was comparing number of monitors with

Re: [Spice-devel] [PATCH 1/3] drm/qxl: allow both PRIV and VRAM placement for QXL_GEM_DOMAIN_SURFACE

2018-12-06 Thread Frediano Ziglio
> qxl surfaces (used for framebuffers and gem objects) can live in both > VRAM and PRIV ttm domains. Update placement setup to include both. Put > PRIV first in the list so it is preferred, so VRAM will have more room > for objects which must be allocated there. > > Signed-off-by: Gerd

Re: [Spice-devel] [PATCH] drm/qxl: workaround broken qxl hw primary setting.

2017-10-19 Thread Frediano Ziglio
> > From: Dave Airlie > > QXL hw can't change primary surfaces easily, the server sends a msg > and the client flickers a lo when it does. The old pre-atomic > page flip code endeavoured to workaround this with a copy operation. > > This worked by another accident of how

Re: [Spice-devel] [PATCH] drm/qxl: workaround broken qxl hw primary setting.

2017-10-19 Thread Frediano Ziglio
> > From: Dave Airlie > > QXL hw can't change primary surfaces easily, the server sends a msg > and the client flickers a lo when it does. The old pre-atomic typo: lo -> lot > page flip code endeavoured to workaround this with a copy operation. > not clear. Do you mean a

[Spice-devel] [PATCH drm/qxl v4 6/7] qxl: Don't notify userspace when monitors config is unchanged

2016-11-08 Thread Frediano Ziglio
ic void qxl_update_offset_props(struct qxl_device *qdev) > @@ -124,9 +157,18 @@ void qxl_display_read_client_monitors_config(struct > qxl_device *qdev) > { > > struct drm_device *dev = qdev->ddev; > - while (qxl_display_copy_rom_client_monitors_config(qdev)

[Spice-devel] [drm/qxl v3 6/7] qxl: Don't notify userspace when monitors config is unchanged

2016-11-07 Thread Frediano Ziglio
> > When the QXL driver receives a QXL_INTERRUPT_CLIENT_MONITORS_CONFIG > interrupt, > we currently always notify userspace that there was some hotplug event. > > However, gnome-shell/mutter is reacting to this event by attempting a > resolution change, which it does by issueing drmModeRmFB,

[Spice-devel] [drm/qxl v3 5/7] qxl: Remove qxl_bo_init() return value

2016-11-07 Thread Frediano Ziglio
> > It's always returning 0, and it's always ignored. Missing the Signed-off-by. Acked-by: Frediano Ziglio You should add the Acked-by message when posting new versions of the patch series. Frediano > --- > drivers/gpu/drm/qxl/qxl_drv.h | 2 +- > drivers/gpu/drm/qxl/qxl_gem

[Spice-devel] [drm/qxl 5/6] qxl: Don't notify userspace when monitors config is unchanged

2016-10-31 Thread Frediano Ziglio
or (;;) { status = qxl_display_copy_rom_client_monitors_config(qdev); if (status != MONITORS_CONFIG_BAD_CRC) break; qxl_io_log(qdev, "failed crc check for client_monitors_config," " retrying\n"); } or while ((status = qxl_display_copy_rom_client_monitors_config(qdev)) == MONITORS_CONFIG_BAD_CRC) { qxl_io_log(qdev, "failed crc check for client_monitors_config," " retrying\n"); } (just style and probably indentation is even wrong) > + if (status == MONITORS_CONFIG_UNCHANGED) { > + qxl_io_log(qdev, "config unchanged\n"); > + DRM_DEBUG("ignoring unchanged client monitors config"); > + return; > } > > drm_modeset_lock_all(dev); Beside all that style paranoia/opinions: Acked-by: Frediano Ziglio (feel free to take into account some or none of them). Frediano

[Spice-devel] [drm/qxl 4/6] qxl: Call qxl_gem_{init,fini}

2016-10-31 Thread Frediano Ziglio
> > qdev->gem.objects was initialized directly in qxl_device_init() rather > than going through qxl_gem_init(), and qxl_gem_fini() was never called. > Considering "qxl_gem_fini() was never called" did we have a leak? > Signed-off-by: Christophe Fergeau > --- > drivers/gpu/drm/qxl/qxl_kms.c |

[Spice-devel] [drm/qxl 6/6] qxl: Allow resolution which are not multiple of 8

2016-10-31 Thread Frediano Ziglio
> > The use of drm_cvt_mode() in qxl_add_monitors_config_modes() means that > the resolutions we are going to present to user-space are going to be > rounded down to a multiple of 8. In the QXL arbitrary resolution case, > this is not useful. > This commit forces the actual width/height that was

[Spice-devel] [drm/qxl 2/6] qxl: Remove unused prototype

2016-10-31 Thread Frediano Ziglio
> > qxl_crtc_set_from_monitors_config() is defined in qxl_drv.h but never > implemented. > > Signed-off-by: Christophe Fergeau Acked-by: Frediano Ziglio > --- > drivers/gpu/drm/qxl/qxl_drv.h | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/g

[Spice-devel] [drm/qxl 3/6] qxl: Add missing '\n' to qxl_io_log() call

2016-10-31 Thread Frediano Ziglio
> > The message has to be terminated by a newline as it's not going to get > added automatically. > > Signed-off-by: Christophe Fergeau Acked-by: Frediano Ziglio > --- > drivers/gpu/drm/qxl/qxl_fb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >

[Spice-devel] [drm/qxl 1/6] qxl: Mark some internal functions as static

2016-10-31 Thread Frediano Ziglio
> > They are not used outside of their respective source file > > Signed-off-by: Christophe Fergeau Acked-by: Frediano Ziglio > --- > drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- > drivers/gpu/drm/qxl/qxl_display.c | 4 ++-- > drivers/gpu/drm/qxl/qxl_drv.h | 3 -

[PATCH 2/2] drm/qxl: allocate objects in both video rams

2015-10-19 Thread Frediano Ziglio
If memory is not enough in the default BAR for a type try other BAR this allow better memory usage and avoid memory allocation failure if a BAR is quite small and other is quite unused. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_object.c | 11 +++ 1 file changed, 7

[PATCH 1/2] drm/qxl: change the way slot is detected

2015-10-19 Thread Frediano Ziglio
Instead of relaying on surface type use the actual placement. This allow to have different placement for a single type of surface. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 9 - 2 files changed, 9 insertions(+), 2 deletions

[PATCH 0/2] Smartly allocate memory on the two BARs

2015-10-19 Thread Frediano Ziglio
and continued working. Setting large resolution is working fine while without these patches fails for not so big BAR sizes. Changes from previous version: - remove RFC; - added signed-off-by; - added prefix in commit title; - rebased. Frediano Ziglio (2): drm/qxl: change the way slot is detected drm

[PATCH 2/2] Allocate objects in both video rams

2015-10-12 Thread Frediano Ziglio
If memory is not enough in the default BAR for a type try other BAR this allow better memory usage and avoid memory allocation failure if a BAR is quite small and other is quite unused. --- qxl/qxl_object.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git

[PATCH 1/2] Change the way slot is detected

2015-10-12 Thread Frediano Ziglio
Instead of relaying on surface type use the actual placement. This allow to have different placement for a single type of surface. --- qxl/qxl_cmd.c | 2 +- qxl/qxl_drv.h | 9 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qxl/qxl_cmd.c b/qxl/qxl_cmd.c index

[RFC PATCH 0/2] Try to smartly allocate memory on the two BARs

2015-10-12 Thread Frediano Ziglio
and continued working. Setting large resolution is working fine while without these patches fails for not so big BAR sizes. Frediano Ziglio (2): Change the way slot is detected Allocate objects in both video rams qxl/qxl_cmd.c| 2 +- qxl/qxl_drv.h| 9 - qxl/qxl_object.c | 11

[PATCH v2 2/2] drm/qxl: avoid dependency lock

2015-09-24 Thread Frediano Ziglio
hem and the possible deadlock. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_release.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index b66ec33..4efa8e2 100644 --- a/drivers/gpu/drm/

[PATCH v2 1/2] drm/qxl: avoid buffer reservation in qxl_crtc_page_flip

2015-09-24 Thread Frediano Ziglio
problem. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_display.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index a8dbb3e..656752d 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c

[PATCH v2 0/2] Dependency locks fixes for QXL driver

2015-09-24 Thread Frediano Ziglio
These two patches fixes two lock dependencies issues. Changes from v1: Sent a wrong patch. Frediano Ziglio (2): drm/qxl: avoid buffer reservation in qxl_crtc_page_flip drm/qxl: avoid dependency lock drivers/gpu/drm/qxl/qxl_display.c | 10 +- drivers/gpu/drm/qxl/qxl_release.c | 4

[PATCH 2/2] drm/qxl: avoid dependency lock

2015-09-24 Thread Frediano Ziglio
hem and the possible deadlock. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_release.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index b66ec33..4efa8e2 100644 --- a/drivers/gpu/drm/

[PATCH 1/2] drm/qxl: use to_qxl_bo macro

2015-09-24 Thread Frediano Ziglio
Instead of using container_of directly use to_qxl_bo macro. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_object.c | 2 +- drivers/gpu/drm/qxl/qxl_ttm.c| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm

[PATCH 0/2] Dependency locks fixes for QXL driver

2015-09-24 Thread Frediano Ziglio
These two patches fixes two lock dependencies issues. Frediano Ziglio (2): drm/qxl: use to_qxl_bo macro drm/qxl: avoid dependency lock drivers/gpu/drm/qxl/qxl_object.c | 2 +- drivers/gpu/drm/qxl/qxl_release.c | 4 +--- drivers/gpu/drm/qxl/qxl_ttm.c | 4 ++-- 3 files changed, 4

[PATCH] drm/qxl: use to_qxl_bo macro

2015-09-24 Thread Frediano Ziglio
Instead of using container_of directly use to_qxl_bo macro. Signed-off-by: Frediano Ziglio --- drivers/gpu/drm/qxl/qxl_object.c | 2 +- drivers/gpu/drm/qxl/qxl_ttm.c| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm

[patch 4/4 v2] drm/qxl: integer overflow in qxl_alloc_surf_ioctl()

2015-09-23 Thread Frediano Ziglio
> > The size calculation can overflow. I don't know if this leads to > memory corruption, but it causes a static checker warning. > > Signed-off-by: Dan Carpenter > --- > v2: I don't know think the size is capped anywhere. In my first version > of this patch, I introduced a divide by zero

[patch 1/4] drm/qxl: integer overflow in qxl_process_single_command()

2015-09-18 Thread Frediano Ziglio
> > This size calculation can overflow on 32 bit systems leading to memory > corruption. > > Reported-by: Ilja Van Sprundel > Signed-off-by: Dan Carpenter > > diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c > b/drivers/gpu/drm/qxl/qxl_ioctl.c > index bda5c5f..eda6f30 100644 > ---

[patch 4/4] drm/qxl: integer overflow in qxl_alloc_surf_ioctl()

2015-09-18 Thread Frediano Ziglio
> The size calculation can overflow. > > Signed-off-by: Dan Carpenter > > diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c > b/drivers/gpu/drm/qxl/qxl_ioctl.c > index 552dc06..5da9a60 100644 > --- a/drivers/gpu/drm/qxl/qxl_ioctl.c > +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c > @@ -401,6 +401,8 @@ static

[patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl()

2015-09-17 Thread Frediano Ziglio
4 bytes (which I don't think is supported under Linux). However I agree with the patch. Acked! Frediano Ziglio

[PATCH 11/11] drm/qxl: Propagate correctly errors from qxlhw_handle_to_bo

2015-06-03 Thread Frediano Ziglio
of assuming EINVAL. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_ioctl.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index bb326ff

[PATCH 10/11] drm/qxl: Simplify cleaning qxl processing command

2015-06-03 Thread Frediano Ziglio
In qxlhw_handle_to_bo we incremented counters twice, one time for release object and one for reloc_info. In the main function however reloc_info references was drop much earlier than release so keeping the pointer only on release is safe and make cleaning process easier. Signed-off-by: Frediano

[PATCH 09/11] drm/qxl: Move main reference counter to GEM object instead of TTM ones

2015-06-03 Thread Frediano Ziglio
moving main counter (the one used by qxl_bo_(un)ref) to GEM object which cleanup routine (qxl_gem_object_free) remove the idr pointer (using qxl_surface_evict) when the counters are still valid. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_gem.c| 10

[PATCH 08/11] drm/qxl: Remove format string errors

2015-06-03 Thread Frediano Ziglio
Enable format string checks for qxl_io_log and remove resulting warnings which could lead to memory errors on different platform or just printing wrong information. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl

[PATCH 07/11] drm/qxl: Handle correctly failures in qxl_alloc_relase_reserved

2015-06-03 Thread Frediano Ziglio
Free resources correctly if function fails Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_release.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index

[PATCH 06/11] drm/qxl: Fix return for qxl_release_alloc

2015-06-03 Thread Frediano Ziglio
This function return handle to allocated release object which is an int. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_release.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl

[PATCH 05/11] drm/qxl: Handle all errors in qxl_surface_evict

2015-06-03 Thread Frediano Ziglio
Only EBUSY error was handled. This could cause code to believe reserve was successful while it failed. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_cmd.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/qxl

[PATCH 04/11] drm/qxl: Avoid double free on error

2015-06-03 Thread Frediano Ziglio
Is we are not able to get source bo object from handle we free destination bo object and call cleanup code however destination object was already inserted in reloc_info array (num_relocs was already incremented) so on cleanup we free destination again. Signed-off-by: Frediano Ziglio Reviewed

[PATCH 03/11] drm/qxl: Fix print statement not using uninitialized variable

2015-06-03 Thread Frediano Ziglio
reloc_info[i] is not still initialized in the print statement. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index

[PATCH 02/11] drm/qxl: Do not leak memory if qxl_release_list_add fails

2015-06-03 Thread Frediano Ziglio
If the function fails reference counter to the object is not decremented causing leaks. This is hard to spot as it happens only on very low memory situations. Signed-off-by: Frediano Ziglio Reviewed-by: Dave Airlie --- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +++- 1 file changed, 3 insertions

[PATCH 01/11] drm/qxl: Do not cause spice-server to clean our objects

2015-06-03 Thread Frediano Ziglio
If objects are moved back from system memory to VRAM (and spice id created again) memory is already initialized so we need to set flag to not clear memory. If you don't do it after a while using desktop many images turns to black or transparents. Signed-off-by: Frediano Ziglio Reviewed-by: Dave

[PATCH 00/11 v2] Miscellaneous stability patches

2015-06-03 Thread Frediano Ziglio
ng errors" should just print garbage and debugging is disabled by default, not necessary. Frediano Ziglio (11): drm/qxl: Do not cause spice-server to clean our objects drm/qxl: Do not leak memory if qxl_release_list_add fails drm/qxl: Fix print statement not using uninitial

[Spice-devel] [PATCH 09/11] Move main reference counter to GEM object instead of TTM ones

2015-05-29 Thread Frediano Ziglio
> On 27 May 2015 at 20:04, Frediano Ziglio wrote: > > qxl_bo structure has two reference counters, one in the GEM object and > > another in the TTM object. The GEM object keep a counter to the TTM object > > so when GEM counter reached zero the TTM counte

[Spice-devel] [PATCH 00/11] Miscellaneous stability patches

2015-05-28 Thread Frediano Ziglio
> > > I was using a different repository with only QXL driver. I tested and all > > patches apply and compile perfectly even with Linus master branch. > > Lets only post patches people can apply, it makes it harder to figure > out stuff. I'll take a look at the patches, but it would be good to >

[PATCH 11/11] Propagate correctly errors from qxlhw_handle_to_bo

2015-05-27 Thread Frediano Ziglio
of assuming EINVAL. Signed-off-by: Frediano Ziglio --- qxl/qxl_ioctl.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/qxl/qxl_ioctl.c b/qxl/qxl_ioctl.c index bb326ff..37f1faf 100644 --- a/qxl/qxl_ioctl.c +++ b/qxl/qxl_ioctl.c @@ -107,9 +107,9

[PATCH 10/11] Simplify cleaning qxl processing command

2015-05-27 Thread Frediano Ziglio
In qxlhw_handle_to_bo we incremented counters twice, one time for release object and one for reloc_info. In the main function however reloc_info references was drop much earlier than release so keeping the pointer only on release is safe and make cleaning process easier. Signed-off-by: Frediano

[PATCH 09/11] Move main reference counter to GEM object instead of TTM ones

2015-05-27 Thread Frediano Ziglio
moving main counter (the one used by qxl_bo_(un)ref) to GEM object which cleanup routine (qxl_gem_object_free) remove the idr pointer (using qxl_surface_evict) when the counters are still valid. Signed-off-by: Frediano Ziglio --- qxl/qxl_gem.c| 10 -- qxl/qxl_object.c | 11 --- 2

[PATCH 08/11] Remove format string errors

2015-05-27 Thread Frediano Ziglio
Enable format string checks for qxl_io_log and remove resulting warnings which could lead to memory errors on different platform or just printing wrong information. Signed-off-by: Frediano Ziglio --- qxl/qxl_cmd.c | 2 +- qxl/qxl_display.c | 2 +- qxl/qxl_drv.h | 2 +- qxl/qxl_release.c

[PATCH 07/11] Handle correctly failures in qxl_alloc_relase_reserved

2015-05-27 Thread Frediano Ziglio
Free resources correctly if function fails Signed-off-by: Frediano Ziglio --- qxl/qxl_release.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qxl/qxl_release.c b/qxl/qxl_release.c index 6fd8e50..00604ed 100644 --- a/qxl/qxl_release.c +++ b/qxl/qxl_release.c

[PATCH 06/11] Fix return for qxl_release_alloc

2015-05-27 Thread Frediano Ziglio
This function return handle to allocated release object which is an int. Signed-off-by: Frediano Ziglio --- qxl/qxl_release.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qxl/qxl_release.c b/qxl/qxl_release.c index d9b2568..6fd8e50 100644 --- a/qxl/qxl_release.c +++ b/qxl

[PATCH 05/11] Handle all errors in qxl_surface_evict

2015-05-27 Thread Frediano Ziglio
Only EBUSY error was handled. This could cause code to believe reserve was successful while it failed. Signed-off-by: Frediano Ziglio --- qxl/qxl_cmd.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qxl/qxl_cmd.c b/qxl/qxl_cmd.c index 85ed5dc..b18f84c 100644

[PATCH 04/11] Avoid double free on error

2015-05-27 Thread Frediano Ziglio
Is we are not able to get source bo object from handle we free destination bo object and call cleanup code however destination object was already inserted in reloc_info array (num_relocs was already incremented) so on cleanup we free destination again. Signed-off-by: Frediano Ziglio --- qxl

[PATCH 03/11] Fix print statement not using uninitialized variable

2015-05-27 Thread Frediano Ziglio
reloc_info[i] is not still initialized in the print statement. Signed-off-by: Frediano Ziglio --- qxl/qxl_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qxl/qxl_ioctl.c b/qxl/qxl_ioctl.c index e8b5207..230ab84 100644 --- a/qxl/qxl_ioctl.c +++ b/qxl/qxl_ioctl.c

[PATCH 02/11] Do not leak memory if qxl_release_list_add fails

2015-05-27 Thread Frediano Ziglio
If the function fails reference counter to the object is not decremented causing leaks. This is hard to spot as it happens only on very low memory situations. Signed-off-by: Frediano Ziglio --- qxl/qxl_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qxl

[PATCH 01/11] Do not cause spice-server to clean our objects

2015-05-27 Thread Frediano Ziglio
If objects are moved back from system memory to VRAM (and spice id created again) memory is already initialized so we need to set flag to not clear memory. If you don't do it after a while using desktop many images turns to black or transparents. Signed-off-by: Frediano Ziglio --- qxl/qxl_cmd.c

[PATCH 00/11] Miscellaneous stability patches

2015-05-27 Thread Frediano Ziglio
This set of patches mainly contains fix for some memory issues using quite aggressively surfaces and other minor problems like images going black after a while. Frediano Ziglio (11): Do not cause spice-server to clean our objects Do not leak memory if qxl_release_list_add fails Fix print

[PATCH 00/11] Miscellaneous stability patches

2015-05-27 Thread Frediano Ziglio
> > On Wed, May 27, 2015 at 8:47 AM, Josh Boyer > wrote: > > On Wed, May 27, 2015 at 6:03 AM, Frediano Ziglio > > wrote: > >> This set of patches mainly contains fix for some memory issues > >> using quite aggressively surfaces and other minor problems lik

[Spice-devel] [PATCH] Do not loop on ERESTARTSYS using interruptible waits

2015-05-22 Thread Frediano Ziglio
> > Hey, > > On Tue, May 19, 2015 at 05:54:54AM -0400, Frediano Ziglio wrote: > > This problem happens using KMS surfaces and QXL driver. > > To easy reproduce use KDE Plasma (which use surfaces a lot) and assure > > you are using KMS surfaces (QXL drive

[PATCH] Do not loop on ERESTARTSYS using interruptible waits

2015-05-19 Thread Frediano Ziglio
CPU usage on Qemu side too. Signed-off-by: Frediano Ziglio --- qxl/qxl_cmd.c | 12 +++- qxl/qxl_drv.h | 2 +- qxl/qxl_ioctl.c | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drivers/gpu/drm/qxl/qxl_cmd.c b/qxl/qxl_cmd.c index 9782364..bd5404e