gallium/winsys/drm: add offset to struct winsys_handle
authorChristian König <christian.koenig@amd.com>
Tue, 12 Jan 2016 14:19:54 +0000 (15:19 +0100)
committerChristian König <christian.koenig@amd.com>
Thu, 17 Mar 2016 13:16:03 +0000 (14:16 +0100)
We are going to need this for EGL_EXT_image_dma_buf_import.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/include/state_tracker/drm_driver.h
src/gallium/state_trackers/dri/dri2.c
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/svga/drm/vmw_screen_dri.c
src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c

index 959a7625e3093cb5b4a8e757ffe6c3c5ef12286c..d81da8911e02db939210bad88a61ce99dff74b0d 100644 (file)
@@ -35,6 +35,11 @@ struct winsys_handle
     * Output for texture_get_handle.
     */
    unsigned stride;
+   /**
+    * Input to texture_from_handle.
+    * Output for texture_get_handle.
+    */
+   unsigned offset;
 };
 
 
index 7f7fbc47e6ddba24a23bfd7245ce7761bbe59d43..fb0a1802cf27b8112bd997e8089efd8a89ade3bd 100644 (file)
@@ -534,6 +534,7 @@ dri2_allocate_textures(struct dri_context *ctx,
          templ.bind = bind;
          whandle.handle = buf->name;
          whandle.stride = buf->pitch;
+         whandle.offset = 0;
          if (screen->can_share_buffer)
             whandle.type = DRM_API_HANDLE_TYPE_SHARED;
          else
@@ -756,6 +757,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
    templ.array_size = 1;
 
    whandle->stride = pitch * util_format_get_blocksize(pf);
+   whandle->offset = 0;
 
    img->texture = screen->base.screen->resource_from_handle(screen->base.screen,
          &templ, whandle, PIPE_HANDLE_USAGE_READ_WRITE);
index b670f2633291e6cd48b561428cc09955b83c7b6f..70993297ceb087bafdc5056834fe6ca15fc44966 100644 (file)
@@ -637,6 +637,7 @@ static boolean amdgpu_bo_get_handle(struct pb_buffer *buffer,
       return FALSE;
 
    whandle->stride = stride;
+   whandle->offset = 0;
    bo->is_shared = true;
    return TRUE;
 }
index 978df52447e357874cbc3b9540353409673b41bf..9e5d7d2e7a0ce1fc6ffcbb429e70b4de28597349 100644 (file)
@@ -1025,6 +1025,7 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
     }
 
     whandle->stride = stride;
+    whandle->offset = 0;
     return TRUE;
 }
 
index 01bb0e2d753103d6fc5c2286332ae297221f55f4..baa22a90beb912bf2e547756b57a0257ba0d9395 100644 (file)
@@ -357,6 +357,7 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
     vsrf = vmw_svga_winsys_surface(surface);
     whandle->handle = vsrf->sid;
     whandle->stride = stride;
+    whandle->offset = 0;
 
     switch (whandle->type) {
     case DRM_API_HANDLE_TYPE_SHARED:
index 1e859717f1cd209a3850ae3ee761acdfa61b371c..9aaee8844be28808ef65bb2b46c3da13363d847a 100644 (file)
@@ -309,17 +309,20 @@ kms_sw_displaytarget_get_handle(struct sw_winsys *winsys,
    case DRM_API_HANDLE_TYPE_KMS:
       whandle->handle = kms_sw_dt->handle;
       whandle->stride = kms_sw_dt->stride;
+      whandle->offset = 0;
       return TRUE;
    case DRM_API_HANDLE_TYPE_FD:
       if (!drmPrimeHandleToFD(kms_sw->fd, kms_sw_dt->handle,
                              DRM_CLOEXEC, (int*)&whandle->handle)) {
          whandle->stride = kms_sw_dt->stride;
+         whandle->offset = 0;
          return TRUE;
       }
       /* fallthrough */
    default:
       whandle->handle = 0;
       whandle->stride = 0;
+      whandle->offset = 0;
       return FALSE;
    }
 }