1# Copyright (C) 2010 Chia-I Wu <olvaffe@gmail.com>
2# Copyright (C) 2010-2011 LunarG Inc.
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice shall be included
12# in all copies or substantial portions of the Software.
13#
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20# DEALINGS IN THE SOFTWARE.
21
22# Android.mk for drm_gralloc
23
24DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
25
26intel_drivers := i915 i965 i915g ilo
27radeon_drivers := r300g r600g
28rockchip_drivers := rockchip
29nouveau_drivers := nouveau
30vmwgfx_drivers := vmwgfx
31
32valid_drivers := \
33	prebuilt \
34	$(intel_drivers) \
35	$(radeon_drivers) \
36	$(rockchip_drivers) \
37	$(nouveau_drivers) \
38	$(vmwgfx_drivers)
39
40# warn about invalid drivers
41invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS))
42ifneq ($(invalid_drivers),)
43$(warning invalid GPU drivers: $(invalid_drivers))
44# tidy up
45DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS))
46endif
47
48ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
49DRM_USES_PIPE := true
50else
51DRM_USES_PIPE := false
52endif
53
54ifneq ($(strip $(DRM_GPU_DRIVERS)),)
55
56LOCAL_PATH := $(call my-dir)
57
58
59# Use the PREBUILT libraries
60ifeq ($(strip $(DRM_GPU_DRIVERS)),prebuilt)
61
62include $(CLEAR_VARS)
63LOCAL_MODULE := libgralloc_drm
64LOCAL_MODULE_TAGS := optional
65LOCAL_SRC_FILES := ../../$(BOARD_GPU_DRIVER_BINARY)
66LOCAL_MODULE_CLASS := SHARED_LIBRARIES
67LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
68include $(BUILD_PREBUILT)
69
70include $(CLEAR_VARS)
71LOCAL_MODULE := gralloc.$(TARGET_PRODUCT)
72LOCAL_MODULE_TAGS := optional
73LOCAL_MODULE_RELATIVE_PATH := hw
74LOCAL_SRC_FILES := ../../$(BOARD_GPU_DRIVER_BINARY)
75LOCAL_MODULE_CLASS := SHARED_LIBRARIES
76LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
77include $(BUILD_PREBUILT)
78
79# Use the sources
80else
81
82include $(CLEAR_VARS)
83LOCAL_MODULE := libgralloc_drm
84LOCAL_MODULE_TAGS := optional
85
86LOCAL_SRC_FILES := \
87	gralloc_drm.cpp
88
89LOCAL_C_INCLUDES := \
90	external/libdrm \
91	external/libdrm/include/drm
92
93LOCAL_SHARED_LIBRARIES := \
94	libdrm \
95	liblog \
96	libcutils \
97	libhardware_legacy \
98	libutils
99
100ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),)
101LOCAL_SRC_FILES += gralloc_drm_intel.c
102LOCAL_C_INCLUDES += external/libdrm/intel
103LOCAL_CFLAGS += -DENABLE_INTEL
104LOCAL_SHARED_LIBRARIES += libdrm_intel
105endif
106
107ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
108LOCAL_SRC_FILES += gralloc_drm_radeon.c
109LOCAL_C_INCLUDES += external/libdrm/radeon
110LOCAL_CFLAGS += -DENABLE_RADEON
111LOCAL_SHARED_LIBRARIES += libdrm_radeon
112endif
113
114ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),)
115LOCAL_SRC_FILES += gralloc_drm_nouveau.c
116LOCAL_C_INCLUDES += external/libdrm/nouveau
117LOCAL_CFLAGS += -DENABLE_NOUVEAU
118LOCAL_SHARED_LIBRARIES += libdrm_nouveau
119endif
120
121ifneq ($(filter $(rockchip_drivers), $(DRM_GPU_DRIVERS)),)
122LOCAL_SRC_FILES += gralloc_drm_rockchip.c
123LOCAL_CFLAGS += -DENABLE_ROCKCHIP
124LOCAL_SHARED_LIBRARIES += libdrm_rockchip
125endif
126
127ifeq ($(strip $(DRM_USES_PIPE)),true)
128LOCAL_SRC_FILES += gralloc_drm_pipe.c
129LOCAL_CFLAGS += -DENABLE_PIPE
130LOCAL_C_INCLUDES += \
131	external/mesa/include \
132	external/mesa/src/gallium/include \
133	external/mesa/src/gallium/winsys \
134	external/mesa/src/gallium/drivers \
135	external/mesa/src/gallium/auxiliary
136
137ifneq ($(filter r600g, $(DRM_GPU_DRIVERS)),)
138LOCAL_CFLAGS += -DENABLE_PIPE_R600
139LOCAL_STATIC_LIBRARIES += \
140	libmesa_pipe_r600 \
141	libmesa_pipe_radeon \
142	libmesa_winsys_radeon
143endif
144ifneq ($(filter vmwgfx, $(DRM_GPU_DRIVERS)),)
145LOCAL_CFLAGS += -DENABLE_PIPE_VMWGFX
146LOCAL_STATIC_LIBRARIES += \
147	libmesa_pipe_svga \
148	libmesa_winsys_svga
149LOCAL_C_INCLUDES += \
150	external/mesa/src/gallium/drivers/svga/include
151endif
152
153LOCAL_STATIC_LIBRARIES += \
154	libmesa_gallium
155LOCAL_SHARED_LIBRARIES += libdl
156endif # DRM_USES_PIPE
157include $(BUILD_SHARED_LIBRARY)
158
159
160include $(CLEAR_VARS)
161LOCAL_SRC_FILES := \
162	gralloc.cpp
163
164LOCAL_C_INCLUDES := \
165	external/libdrm \
166	external/libdrm/include/drm
167
168LOCAL_SHARED_LIBRARIES := \
169	libgralloc_drm \
170	liblog \
171	libutils
172
173# for glFlush/glFinish
174LOCAL_SHARED_LIBRARIES += \
175	libGLESv1_CM
176
177LOCAL_MODULE := gralloc.drm
178LOCAL_MODULE_TAGS := optional
179LOCAL_MODULE_RELATIVE_PATH := hw
180include $(BUILD_SHARED_LIBRARY)
181
182endif # DRM_GPU_DRIVERS=prebuilt
183endif # DRM_GPU_DRIVERS
184