Commit 8286b103 authored by jonross's avatar jonross Committed by Commit bot

Revert of Generalize V4L2 HW video codec device names (patchset #1 id:1 of...

Revert of Generalize V4L2 HW video codec device names (patchset #1 id:1 of https://codereview.chromium.org/730693005/)

Reason for revert:
This change breaks video_ChromeHWDecodeUsed, please see crbug.com/439175 for details.

Original issue's description:
> Generalize V4L2 HW video codec device names
>
> Switch to more generalized V4L2 video accelerator device names and update
> sandbox rules to reflect that.
>
> This is another attempt at crrev.com/763743002, reverted in
> crrev.com/767383002 with a fixup for sandbox permissions.
>
> BUG=405861,437598
> TEST=compile
>
> Committed: https://crrev.com/30a3721c82953428d445a93ebe2bf0014e27bc10
> Cr-Commit-Position: refs/heads/master@{#306642}

TBR=jorgelo@chromium.org,scherkus@chromium.org,posciak@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=405861,437598

Review URL: https://codereview.chromium.org/784553004

Cr-Commit-Position: refs/heads/master@{#307077}
parent 157ed95a
...@@ -14,23 +14,23 @@ ...@@ -14,23 +14,23 @@
#include "base/debug/trace_event.h" #include "base/debug/trace_event.h"
#include "base/files/scoped_file.h" #include "base/files/scoped_file.h"
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "content/common/gpu/media/generic_v4l2_video_device.h" #include "content/common/gpu/media/exynos_v4l2_video_device.h"
#include "ui/gl/gl_bindings.h" #include "ui/gl/gl_bindings.h"
namespace content { namespace content {
namespace { namespace {
const char kDecoderDevice[] = "/dev/video-dec"; const char kDecoderDevice[] = "/dev/mfc-dec";
const char kEncoderDevice[] = "/dev/video-enc"; const char kEncoderDevice[] = "/dev/mfc-enc";
const char kImageProcessorDevice[] = "/dev/gsc1"; const char kImageProcessorDevice[] = "/dev/gsc1";
} }
GenericV4L2Device::GenericV4L2Device(Type type) ExynosV4L2Device::ExynosV4L2Device(Type type)
: type_(type), : type_(type),
device_fd_(-1), device_fd_(-1),
device_poll_interrupt_fd_(-1) {} device_poll_interrupt_fd_(-1) {}
GenericV4L2Device::~GenericV4L2Device() { ExynosV4L2Device::~ExynosV4L2Device() {
if (device_poll_interrupt_fd_ != -1) { if (device_poll_interrupt_fd_ != -1) {
close(device_poll_interrupt_fd_); close(device_poll_interrupt_fd_);
device_poll_interrupt_fd_ = -1; device_poll_interrupt_fd_ = -1;
...@@ -41,11 +41,11 @@ GenericV4L2Device::~GenericV4L2Device() { ...@@ -41,11 +41,11 @@ GenericV4L2Device::~GenericV4L2Device() {
} }
} }
int GenericV4L2Device::Ioctl(int request, void* arg) { int ExynosV4L2Device::Ioctl(int request, void* arg) {
return HANDLE_EINTR(ioctl(device_fd_, request, arg)); return HANDLE_EINTR(ioctl(device_fd_, request, arg));
} }
bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { bool ExynosV4L2Device::Poll(bool poll_device, bool* event_pending) {
struct pollfd pollfds[2]; struct pollfd pollfds[2];
nfds_t nfds; nfds_t nfds;
int pollfd = -1; int pollfd = -1;
...@@ -70,7 +70,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { ...@@ -70,7 +70,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) {
return true; return true;
} }
void* GenericV4L2Device::Mmap(void* addr, void* ExynosV4L2Device::Mmap(void* addr,
unsigned int len, unsigned int len,
int prot, int prot,
int flags, int flags,
...@@ -78,11 +78,11 @@ void* GenericV4L2Device::Mmap(void* addr, ...@@ -78,11 +78,11 @@ void* GenericV4L2Device::Mmap(void* addr,
return mmap(addr, len, prot, flags, device_fd_, offset); return mmap(addr, len, prot, flags, device_fd_, offset);
} }
void GenericV4L2Device::Munmap(void* addr, unsigned int len) { void ExynosV4L2Device::Munmap(void* addr, unsigned int len) {
munmap(addr, len); munmap(addr, len);
} }
bool GenericV4L2Device::SetDevicePollInterrupt() { bool ExynosV4L2Device::SetDevicePollInterrupt() {
DVLOG(3) << "SetDevicePollInterrupt()"; DVLOG(3) << "SetDevicePollInterrupt()";
const uint64 buf = 1; const uint64 buf = 1;
...@@ -93,7 +93,7 @@ bool GenericV4L2Device::SetDevicePollInterrupt() { ...@@ -93,7 +93,7 @@ bool GenericV4L2Device::SetDevicePollInterrupt() {
return true; return true;
} }
bool GenericV4L2Device::ClearDevicePollInterrupt() { bool ExynosV4L2Device::ClearDevicePollInterrupt() {
DVLOG(3) << "ClearDevicePollInterrupt()"; DVLOG(3) << "ClearDevicePollInterrupt()";
uint64 buf; uint64 buf;
...@@ -109,7 +109,7 @@ bool GenericV4L2Device::ClearDevicePollInterrupt() { ...@@ -109,7 +109,7 @@ bool GenericV4L2Device::ClearDevicePollInterrupt() {
return true; return true;
} }
bool GenericV4L2Device::Initialize() { bool ExynosV4L2Device::Initialize() {
const char* device_path = NULL; const char* device_path = NULL;
switch (type_) { switch (type_) {
case kDecoder: case kDecoder:
...@@ -137,7 +137,7 @@ bool GenericV4L2Device::Initialize() { ...@@ -137,7 +137,7 @@ bool GenericV4L2Device::Initialize() {
return true; return true;
} }
EGLImageKHR GenericV4L2Device::CreateEGLImage(EGLDisplay egl_display, EGLImageKHR ExynosV4L2Device::CreateEGLImage(EGLDisplay egl_display,
EGLContext /* egl_context */, EGLContext /* egl_context */,
GLuint texture_id, GLuint texture_id,
gfx::Size frame_buffer_size, gfx::Size frame_buffer_size,
...@@ -187,21 +187,21 @@ EGLImageKHR GenericV4L2Device::CreateEGLImage(EGLDisplay egl_display, ...@@ -187,21 +187,21 @@ EGLImageKHR GenericV4L2Device::CreateEGLImage(EGLDisplay egl_display,
return egl_image; return egl_image;
} }
EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, EGLBoolean ExynosV4L2Device::DestroyEGLImage(EGLDisplay egl_display,
EGLImageKHR egl_image) { EGLImageKHR egl_image) {
return eglDestroyImageKHR(egl_display, egl_image); return eglDestroyImageKHR(egl_display, egl_image);
} }
GLenum GenericV4L2Device::GetTextureTarget() { return GL_TEXTURE_EXTERNAL_OES; } GLenum ExynosV4L2Device::GetTextureTarget() { return GL_TEXTURE_EXTERNAL_OES; }
uint32 GenericV4L2Device::PreferredInputFormat() { uint32 ExynosV4L2Device::PreferredInputFormat() {
// TODO(posciak): We should support "dontcare" returns here once we // TODO(posciak): We should support "dontcare" returns here once we
// implement proper handling (fallback, negotiation) for this in users. // implement proper handling (fallback, negotiation) for this in users.
CHECK_EQ(type_, kEncoder); CHECK_EQ(type_, kEncoder);
return V4L2_PIX_FMT_NV12M; return V4L2_PIX_FMT_NV12M;
} }
uint32 GenericV4L2Device::PreferredOutputFormat() { uint32 ExynosV4L2Device::PreferredOutputFormat() {
// TODO(posciak): We should support "dontcare" returns here once we // TODO(posciak): We should support "dontcare" returns here once we
// implement proper handling (fallback, negotiation) for this in users. // implement proper handling (fallback, negotiation) for this in users.
CHECK_EQ(type_, kDecoder); CHECK_EQ(type_, kDecoder);
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// This file contains the implementation of GenericV4L2Device used on // This file contains the implementation of ExynosV4L2Device used on
// Generic platform. // Exynos platform.
#ifndef CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_
#define CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_
#include "content/common/gpu/media/v4l2_video_device.h" #include "content/common/gpu/media/v4l2_video_device.h"
namespace content { namespace content {
class GenericV4L2Device : public V4L2Device { class ExynosV4L2Device : public V4L2Device {
public: public:
explicit GenericV4L2Device(Type type); explicit ExynosV4L2Device(Type type);
virtual ~GenericV4L2Device(); virtual ~ExynosV4L2Device();
// V4L2Device implementation. // V4L2Device implementation.
virtual int Ioctl(int request, void* arg) override; virtual int Ioctl(int request, void* arg) override;
...@@ -51,8 +51,8 @@ class GenericV4L2Device : public V4L2Device { ...@@ -51,8 +51,8 @@ class GenericV4L2Device : public V4L2Device {
// interrupted. // interrupted.
int device_poll_interrupt_fd_; int device_poll_interrupt_fd_;
DISALLOW_COPY_AND_ASSIGN(GenericV4L2Device); DISALLOW_COPY_AND_ASSIGN(ExynosV4L2Device);
}; };
} // namespace content } // namespace content
#endif // CONTENT_COMMON_GPU_MEDIA_GENERIC_V4L2_VIDEO_DEVICE_H_ #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_V4L2_VIDEO_DEVICE_H_
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "content/common/gpu/media/generic_v4l2_video_device.h" #include "content/common/gpu/media/exynos_v4l2_video_device.h"
#include "content/common/gpu/media/tegra_v4l2_video_device.h" #include "content/common/gpu/media/tegra_v4l2_video_device.h"
namespace content { namespace content {
...@@ -16,9 +16,9 @@ V4L2Device::~V4L2Device() {} ...@@ -16,9 +16,9 @@ V4L2Device::~V4L2Device() {}
scoped_ptr<V4L2Device> V4L2Device::Create(Type type) { scoped_ptr<V4L2Device> V4L2Device::Create(Type type) {
DVLOG(3) << __PRETTY_FUNCTION__; DVLOG(3) << __PRETTY_FUNCTION__;
scoped_ptr<GenericV4L2Device> generic_device(new GenericV4L2Device(type)); scoped_ptr<ExynosV4L2Device> exynos_device(new ExynosV4L2Device(type));
if (generic_device->Initialize()) if (exynos_device->Initialize())
return generic_device.Pass(); return exynos_device.Pass();
scoped_ptr<TegraV4L2Device> tegra_device(new TegraV4L2Device(type)); scoped_ptr<TegraV4L2Device> tegra_device(new TegraV4L2Device(type));
if (tegra_device->Initialize()) if (tegra_device->Initialize())
......
...@@ -59,19 +59,17 @@ void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { ...@@ -59,19 +59,17 @@ void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) {
// Device file needed by the ARM GPU userspace. // Device file needed by the ARM GPU userspace.
static const char kMali0Path[] = "/dev/mali0"; static const char kMali0Path[] = "/dev/mali0";
// Devices nodes for V4L2 video decode accelerator drivers. // Devices needed for video decode acceleration on ARM.
static const char kDevVideoDecPath[] = "/dev/video-dec"; static const char kDevMfcDecPath[] = "/dev/mfc-dec";
// Video processor used on ARM Exynos platforms.
static const char kDevGsc1Path[] = "/dev/gsc1"; static const char kDevGsc1Path[] = "/dev/gsc1";
// Devices nodes for V4L2 video encode accelerator drivers. // Devices needed for video encode acceleration on ARM.
static const char kDevVideoEncPath[] = "/dev/video-enc"; static const char kDevMfcEncPath[] = "/dev/mfc-enc";
permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path));
permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); permissions->push_back(BrokerFilePermission::ReadWrite(kDevMfcDecPath));
permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path)); permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path));
permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); permissions->push_back(BrokerFilePermission::ReadWrite(kDevMfcEncPath));
} }
void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) {
......
...@@ -754,8 +754,8 @@ ...@@ -754,8 +754,8 @@
'../media/media.gyp:media', '../media/media.gyp:media',
], ],
'sources': [ 'sources': [
'common/gpu/media/generic_v4l2_video_device.cc', 'common/gpu/media/exynos_v4l2_video_device.cc',
'common/gpu/media/generic_v4l2_video_device.h', 'common/gpu/media/exynos_v4l2_video_device.h',
'common/gpu/media/tegra_v4l2_video_device.cc', 'common/gpu/media/tegra_v4l2_video_device.cc',
'common/gpu/media/tegra_v4l2_video_device.h', 'common/gpu/media/tegra_v4l2_video_device.h',
'common/gpu/media/v4l2_image_processor.cc', 'common/gpu/media/v4l2_image_processor.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment