gallium/winsys/kms: Fix double refcount when importing from prime FD (v2)
authorTomasz Figa <tfiga@chromium.org>
Tue, 2 Aug 2016 10:46:25 +0000 (19:46 +0900)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 24 Aug 2016 13:39:22 +0000 (14:39 +0100)
Currently the code creates a display target struct with refcount field
initialized to 1 and then the caller again increments it, leading to
a leaked reference. Let's remove the unnecessary increment.

v2: Split from one big patch into four fixing one thing at a time.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c

index 21ac0d7dae836f5e47da6b950da053d4cad6819e..0585fcce2076716fd0055a1f5b86c0c94f5cceaf 100644 (file)
@@ -276,7 +276,6 @@ kms_sw_displaytarget_from_handle(struct sw_winsys *ws,
    case DRM_API_HANDLE_TYPE_FD:
       kms_sw_dt = kms_sw_displaytarget_add_from_prime(kms_sw, whandle->handle);
       if (kms_sw_dt) {
-         kms_sw_dt->ref_count++;
          kms_sw_dt->width = templ->width0;
          kms_sw_dt->height = templ->height0;
          kms_sw_dt->stride = whandle->stride;