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-xlib2xcb.h>
20 #include <dali/internal/window-system/common/window-render-surface.h>
22 #include <X11/Xlib-xcb.h>
31 VkSurfaceXlib2Xcb::VkSurfaceXlib2Xcb(Dali::RenderSurface& renderSurface)
34 auto ecoreSurface = dynamic_cast<Dali::ECore::WindowRenderSurface*>(&renderSurface);
35 assert( ecoreSurface != nullptr && "This is not ecore surface!");
36 mConnection = XGetXCBConnection(XOpenDisplay(nullptr));
37 mWindow = static_cast<decltype(mWindow)>(ecoreSurface->GetXWindow());
40 VkSurfaceXlib2Xcb::VkSurfaceXlib2Xcb(Display* display, Window window)
43 mConnection = XGetXCBConnection(display);
44 mWindow = static_cast<decltype(mWindow)>(window);
47 vk::SurfaceKHR VkSurfaceXlib2Xcb::Create(vk::Instance instance, vk::AllocationCallbacks* allocCallbacks,
48 vk::PhysicalDevice physicalDevice) const
50 vk::XcbSurfaceCreateInfoKHR info;
51 info.setConnection(mConnection).setWindow(mWindow);
52 auto retval = instance.createXcbSurfaceKHR(info, allocCallbacks).value;