Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ui/ozone/platform/dri/gbm_buffer.cc

Issue 490233002: VaapiVideoAccelerator: make Vaapi accelerator work with ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed commented code from VaapiWrapper Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/dri/gbm_buffer.h" 5 #include "ui/ozone/platform/dri/gbm_buffer.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <gbm.h> 9 #include <gbm.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return NULL; 62 return NULL;
63 63
64 return buffer; 64 return buffer;
65 } 65 }
66 66
67 GbmPixmap::GbmPixmap(scoped_refptr<GbmBuffer> buffer) 67 GbmPixmap::GbmPixmap(scoped_refptr<GbmBuffer> buffer)
68 : buffer_(buffer), dma_buf_(-1) { 68 : buffer_(buffer), dma_buf_(-1) {
69 } 69 }
70 70
71 bool GbmPixmap::Initialize(DriWrapper* dri) { 71 bool GbmPixmap::Initialize(DriWrapper* dri) {
72 if (drmPrimeHandleToFD(dri->get_fd(), 72 dma_buf_ = gbm_bo_get_fd(buffer_->bo());
73 buffer_->GetHandle(), 73 if (dma_buf_ < 0) {
74 DRM_CLOEXEC,
75 &dma_buf_)) {
76 LOG(ERROR) << "Failed to export buffer to dma_buf"; 74 LOG(ERROR) << "Failed to export buffer to dma_buf";
77 return false; 75 return false;
78 } 76 }
79 77
80 return true; 78 return true;
81 } 79 }
82 80
83 GbmPixmap::~GbmPixmap() { 81 GbmPixmap::~GbmPixmap() {
84 if (dma_buf_ > 0) 82 if (dma_buf_ > 0)
85 close(dma_buf_); 83 close(dma_buf_);
86 } 84 }
87 85
88 void* GbmPixmap::GetEGLClientBuffer() { 86 void* GbmPixmap::GetEGLClientBuffer() {
89 return NULL; 87 return buffer_->bo();
90 } 88 }
91 89
92 int GbmPixmap::GetDmaBufFd() { 90 int GbmPixmap::GetDmaBufFd() {
93 return dma_buf_; 91 return dma_buf_;
94 } 92 }
95 93
96 int GbmPixmap::GetDmaBufPitch() { 94 int GbmPixmap::GetDmaBufPitch() {
97 return gbm_bo_get_stride(buffer_->bo()); 95 return gbm_bo_get_stride(buffer_->bo());
98 } 96 }
99 97
100 } // namespace ui 98 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698