Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
| diff --git a/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h b/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d8e4ef5343febbdd38929a5b4643ef576eebb2fe |
| --- /dev/null |
| +++ b/ui/ozone/platform/drm/gpu/intel_drm_pixmap.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
| +#define UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/gfx/geometry/size.h" |
| +#include "ui/ozone/public/native_pixmap.h" |
| +#include "ui/ozone/public/surface_factory_ozone.h" |
| + |
| +typedef struct _drm_intel_bo drm_intel_bo; |
| + |
| +namespace ui { |
| + |
| +class IntelDrmPixmap : public NativePixmap { |
|
dshwang
2015/06/29 17:22:05
All code using Intel DRM are in this class. Both G
|
| + public: |
| + static scoped_refptr<IntelDrmPixmap> Create( |
| + base::FileDescriptor device_fd, |
| + SurfaceFactoryOzone::BufferFormat format, |
| + const gfx::Size& size); |
| + |
| + // Renderer uses this API. |
| + static scoped_refptr<IntelDrmPixmap> CreateFromHandle( |
| + base::FileDescriptor device_fd, |
| + base::FileDescriptor handle, |
| + SurfaceFactoryOzone::BufferFormat format, |
| + const gfx::Size& size); |
| + |
| + // NativePixmap: |
| + void* GetEGLClientBuffer() override; |
| + int GetDmaBufFd() override; |
| + int GetDmaBufPitch() override; |
| + |
| + bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| + int plane_z_order, |
| + gfx::OverlayTransform plane_transform, |
| + const gfx::Rect& display_bounds, |
| + const gfx::RectF& crop_rect) override; |
| + void SetScalingCallback(const ScalingCallback& scaling_callback) override; |
| + scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; |
| + BufferUsage GetBufferUsage() const override; |
| + void* Map() override; |
| + void Unmap() override; |
| + |
| + private: |
| + IntelDrmPixmap(); |
| + ~IntelDrmPixmap() override; |
| + |
| + bool Initialize(base::FileDescriptor device_fd, |
| + SurfaceFactoryOzone::BufferFormat format, |
| + const gfx::Size& size); |
| + bool InitializeFromHandle(base::FileDescriptor device_fd, |
| + base::FileDescriptor handle, |
| + SurfaceFactoryOzone::BufferFormat format, |
| + const gfx::Size& size); |
| + |
| + drm_intel_bo* buffer_; |
| + base::ScopedFD prime_fd_; |
| + uint32 stride_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IntelDrmPixmap); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_OZONE_PLATFORM_DRM_GPU_INTEL_DRM_PIXMAP_H_ |