2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <adaptors/devel-api/adaptor-framework/render-surface.h>
19 #include <dali/internal/graphics/vulkan/x11/vk-surface-xlib.h>
20 #include <dali/internal/window-system/common/window-render-surface.h>
29 VkSurfaceXlib::VkSurfaceXlib(Dali::RenderSurface& renderSurface)
32 auto ecoreSurface = dynamic_cast<Dali::ECore::WindowRenderSurface*>(&renderSurface);
33 assert( ecoreSurface != nullptr && "This is not ecore surface!");
34 mWindow = ecoreSurface->GetXWindow();
35 mDisplay = XOpenDisplay(nullptr);
38 VkSurfaceXlib::VkSurfaceXlib(Display* display, Window window)
39 : VkSurfaceFactory(), mDisplay(display), mWindow(window)
43 vk::SurfaceKHR VkSurfaceXlib::Create(vk::Instance instance, vk::AllocationCallbacks* allocCallbacks,
44 vk::PhysicalDevice physicalDevice) const
46 vk::XlibSurfaceCreateInfoKHR info;
47 info.setDpy(mDisplay).setWindow(mWindow);
48 auto retval = instance.createXlibSurfaceKHR(info, allocCallbacks).value;