From 4b3db54505933738ec33f92ec7e2c5304cb18325 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Thu, 11 Apr 2013 10:41:50 +0300 Subject: gralloc_drm: fix building errors with latest mesa Change-Id: Ifdf23b59542152c364d3ed010a4cc82bbf1a0103 Signed-off-by: Chih-Wei Huang --- Android.mk | 3 ++- gralloc_drm.h | 7 +++++++ gralloc_drm_handle.h | 7 +++++++ gralloc_drm_nouveau.c | 4 ++-- gralloc_drm_pipe.c | 32 +++++++++++++++----------------- gralloc_drm_priv.h | 7 +++++++ gralloc_drm_radeon.c | 4 ++-- 7 files changed, 42 insertions(+), 22 deletions(-) diff --git a/Android.mk b/Android.mk index 6acf057..9c9cf2c 100644 --- a/Android.mk +++ b/Android.mk @@ -120,6 +120,7 @@ ifeq ($(strip $(DRM_USES_PIPE)),true) LOCAL_SRC_FILES += gralloc_drm_pipe.c LOCAL_CFLAGS += -DENABLE_PIPE LOCAL_C_INCLUDES += \ + external/mesa/include \ external/mesa/src/gallium/include \ external/mesa/src/gallium/winsys \ external/mesa/src/gallium/drivers \ @@ -129,7 +130,7 @@ ifneq ($(filter r600g, $(DRM_GPU_DRIVERS)),) LOCAL_CFLAGS += -DENABLE_PIPE_R600 LOCAL_STATIC_LIBRARIES += \ libmesa_pipe_r600 \ - libmesa_winsys_r600 + libmesa_winsys_radeon endif ifneq ($(filter vmwgfx, $(DRM_GPU_DRIVERS)),) LOCAL_CFLAGS += -DENABLE_PIPE_VMWGFX diff --git a/gralloc_drm.h b/gralloc_drm.h index 8059907..891526f 100644 --- a/gralloc_drm.h +++ b/gralloc_drm.h @@ -27,6 +27,10 @@ #include #include "gralloc_drm_formats.h" +#ifdef __cplusplus +extern "C" { +#endif + struct gralloc_drm_t; struct gralloc_drm_bo_t; @@ -132,4 +136,7 @@ int gralloc_drm_bo_add_fb(struct gralloc_drm_bo_t *bo); void gralloc_drm_bo_rm_fb(struct gralloc_drm_bo_t *bo); int gralloc_drm_bo_post(struct gralloc_drm_bo_t *bo); +#ifdef __cplusplus +} +#endif #endif /* _GRALLOC_DRM_H_ */ diff --git a/gralloc_drm_handle.h b/gralloc_drm_handle.h index 70a1ae8..7d431e4 100644 --- a/gralloc_drm_handle.h +++ b/gralloc_drm_handle.h @@ -27,6 +27,10 @@ #include #include "gralloc_drm_formats.h" +#ifdef __cplusplus +extern "C" { +#endif + struct gralloc_drm_handle_t { native_handle_t base; @@ -63,4 +67,7 @@ static inline struct gralloc_drm_handle_t *gralloc_drm_handle(buffer_handle_t _h return handle; } +#ifdef __cplusplus +} +#endif #endif /* _GRALLOC_DRM_HANDLE_H_ */ diff --git a/gralloc_drm_nouveau.c b/gralloc_drm_nouveau.c index cbbb76d..4536e7e 100644 --- a/gralloc_drm_nouveau.c +++ b/gralloc_drm_nouveau.c @@ -273,12 +273,12 @@ static void nouveau_init_kms_features(struct gralloc_drm_drv_t *drv, { struct nouveau_info *info = (struct nouveau_info *) drv; - switch (drm->fb_format) { + switch (drm->primary.fb_format) { case HAL_PIXEL_FORMAT_BGRA_8888: case HAL_PIXEL_FORMAT_RGB_565: break; default: - drm->fb_format = HAL_PIXEL_FORMAT_BGRA_8888; + drm->primary.fb_format = HAL_PIXEL_FORMAT_BGRA_8888; break; } diff --git a/gralloc_drm_pipe.c b/gralloc_drm_pipe.c index 9987d52..8eda223 100644 --- a/gralloc_drm_pipe.c +++ b/gralloc_drm_pipe.c @@ -212,7 +212,7 @@ static void pipe_free(struct gralloc_drm_drv_t *drv, struct gralloc_drm_bo_t *bo pthread_mutex_lock(&pm->mutex); if (buf->transfer) - pipe_transfer_destroy(pm->context, buf->transfer); + pipe_transfer_unmap(pm->context, buf->transfer); pipe_resource_reference(&buf->resource, NULL); pthread_mutex_unlock(&pm->mutex); @@ -252,12 +252,11 @@ static int pipe_map(struct gralloc_drm_drv_t *drv, * ignore x, y, w and h so that returned addr points at the * start of the buffer */ - buf->transfer = pipe_get_transfer(pm->context, buf->resource, - 0, 0, usage, 0, 0, - buf->resource->width0, buf->resource->height0); - if (buf->transfer) - *addr = pipe_transfer_map(pm->context, buf->transfer); - else + *addr = pipe_transfer_map(pm->context, buf->resource, + 0, 0, usage, 0, 0, + buf->resource->width0, buf->resource->height0, + &buf->transfer); + if (*addr == NULL) err = -ENOMEM; } @@ -277,10 +276,9 @@ static void pipe_unmap(struct gralloc_drm_drv_t *drv, assert(buf && buf->transfer); pipe_transfer_unmap(pm->context, buf->transfer); - pipe_transfer_destroy(pm->context, buf->transfer); buf->transfer = NULL; - pm->context->flush(pm->context, NULL); + pm->context->flush(pm->context, NULL, 0); pthread_mutex_unlock(&pm->mutex); } @@ -331,7 +329,7 @@ static void pipe_blit(struct gralloc_drm_drv_t *drv, pm->context->resource_copy_region(pm->context, dst->resource, 0, dst_x1, dst_y1, 0, src->resource, 0, &src_box); - pm->context->flush(pm->context, NULL); + pm->context->flush(pm->context, NULL, 0); pthread_mutex_unlock(&pm->mutex); } @@ -340,12 +338,12 @@ static void pipe_init_kms_features(struct gralloc_drm_drv_t *drv, struct gralloc { struct pipe_manager *pm = (struct pipe_manager *) drv; - switch (drm->fb_format) { + switch (drm->primary.fb_format) { case HAL_PIXEL_FORMAT_BGRA_8888: case HAL_PIXEL_FORMAT_RGB_565: break; default: - drm->fb_format = HAL_PIXEL_FORMAT_BGRA_8888; + drm->primary.fb_format = HAL_PIXEL_FORMAT_BGRA_8888; break; } @@ -378,7 +376,7 @@ static void pipe_destroy(struct gralloc_drm_drv_t *drv) #include "radeon/drm/radeon_drm_public.h" #include "r300/r300_public.h" /* for r600 */ -#include "r600/drm/r600_drm_public.h" +#include "radeon/drm/radeon_winsys.h" #include "r600/r600_public.h" /* for vmwgfx */ #include "svga/drm/svga_drm_public.h" @@ -408,12 +406,12 @@ static int pipe_init_screen(struct pipe_manager *pm) #endif #ifdef ENABLE_PIPE_R600 if (strcmp(pm->driver, "r600") == 0) { - struct radeon *rw = r600_drm_winsys_create(pm->fd); + struct radeon_winsys *sws = radeon_drm_winsys_create(pm->fd); - if (rw) { - screen = r600_screen_create(rw); + if (sws) { + screen = r600_screen_create(sws); if (!screen) - FREE(rw); + sws->destroy(sws); } } #endif diff --git a/gralloc_drm_priv.h b/gralloc_drm_priv.h index eed433f..dc7d505 100644 --- a/gralloc_drm_priv.h +++ b/gralloc_drm_priv.h @@ -30,6 +30,10 @@ #include "gralloc_drm_handle.h" +#ifdef __cplusplus +extern "C" { +#endif + /* how a bo is posted */ enum drm_swap_mode { DRM_SWAP_NOOP, @@ -165,4 +169,7 @@ struct gralloc_drm_drv_t *gralloc_drm_drv_create_for_intel(int fd); struct gralloc_drm_drv_t *gralloc_drm_drv_create_for_radeon(int fd); struct gralloc_drm_drv_t *gralloc_drm_drv_create_for_nouveau(int fd); +#ifdef __cplusplus +} +#endif #endif /* _GRALLOC_DRM_PRIV_H_ */ diff --git a/gralloc_drm_radeon.c b/gralloc_drm_radeon.c index 94c7613..94dc2ed 100644 --- a/gralloc_drm_radeon.c +++ b/gralloc_drm_radeon.c @@ -324,12 +324,12 @@ static void drm_gem_radeon_unmap(struct gralloc_drm_drv_t *drv, static void drm_gem_radeon_init_kms_features(struct gralloc_drm_drv_t *drv, struct gralloc_drm_t *drm) { - switch (drm->fb_format) { + switch (drm->primary.fb_format) { case HAL_PIXEL_FORMAT_BGRA_8888: case HAL_PIXEL_FORMAT_RGB_565: break; default: - drm->fb_format = HAL_PIXEL_FORMAT_BGRA_8888; + drm->primary.fb_format = HAL_PIXEL_FORMAT_BGRA_8888; break; } -- cgit v1.1